Zookeeper zkCli.sh Generates Switch Information

Sorry, this is a pretty lame question. I searched for and searched on ZK sites for a long time before I finally decided to ask here!

When I start ZooKeeper zkCli.sh and type help, for the create command it says:

create [-s] [-e] path data acl

What are -s and -e for?

Although I really need to know, I would also like to know where this information is defined, documented and / or described, because, as I said, I searched for it for a long time and could not find it!

Thanks for any help!

+4
source share
1 answer

The -s and -e options are for specifying sequential or ephemeral nodes.

, , - . , Zookeeper . - .

https://github.com/apache/zookeeper/blob/trunk/bin/zkCli.sh

script java- - org.apache.zookeeper.ZooKeeperMain. Java, , - :

https://github.com/apache/zookeeper/blob/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java

, :

https://github.com/apache/zookeeper/blob/trunk/src/java/main/org/apache/zookeeper/cli/CreateCommand.java

. :

 options.addOption(new Option("e", false, "ephemeral"));
 options.addOption(new Option("s", false, "sequential"));

. :

CreateMode flags = CreateMode.PERSISTENT;
if(cl.hasOption("e") && cl.hasOption("s")) {
    flags = CreateMode.EPHEMERAL_SEQUENTIAL;
} else if (cl.hasOption("e")) {
    flags = CreateMode.EPHEMERAL;
} else if (cl.hasOption("s")) {
    flags = CreateMode.PERSISTENT_SEQUENTIAL;
}
+5
source

All Articles