Joe.wang
Joe.wang

Reputation: 11791

Understanding ZooKeeper startup command line

I was reading the ZooKeeper Cluster Set-Up Document from here .

But unfortunately can't understand the java command to start up ZooKeeper service.

$ java -cp zookeeper.jar:lib/log4j-1.2.15.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg

As far as I knew(Please correct if I was wrong.thanks), -cp means -classpath option. :lib/log4j-1.2.15.jar means the reference libraries of the executable jar zookeeper.jar. org.apache.zookeeper.server.quorum.QuorumPeerMain is the main class which command needed. and zoo.cfg means the argument of the main class.

What I can't understand is the :conf \ part. What does it mean?

I tried to read the document from Java document. But didn't anything helpful.

Could someone please help to shed some light on it ?Thanks.

Upvotes: 2

Views: 793

Answers (1)

Robby Cornelissen
Robby Cornelissen

Reputation: 97152

The conf part adds classes and resources from the conf directory to the classpath.

The classpath contains three entries:

  • zookeeper.jar, i.e. the Zookeeper JAR file in the current working directory
  • lib/log4j-1.2.15.jar, i.e. the Log4J JAR file in the lib directory
  • conf, i.e. all compiled classes and resources in the conf directory

The backslash is just there to indicate to the shell that the command continues on the next line.

Upvotes: 1

Related Questions