Why is ZooKeeper changing the name of my znode?
I am learning how to use ZooKeeper (version 3.3.3) and have it running with Cygwin (version 1.7.9). In order to create a znode, I do the following:
$ zkServer.sh start
$ zkCli.sh
[zk: localhost:2181(CONNECTED) 0] create /zoo-1 "Hello World!" null
Created /zoo-1
This appears to work fine:
[zk: localhost:2181(CONNECTED) 1] ls /
[zoo-1, zookeeper]
However, if I try to use the -s flag this happens:
[zk: localhost:2181(CONNECTED) 2] create -s /zoo-2 "Hello World!" null
Created /zoo-20000000007
[zk: localhost:2181(CONNECTED) 3] ls /
[zoo-20000000007, zoo-1, zookeeper]
Removing the flag, though, keeps the name the same:
[zk: local开发者_C百科host:2181(CONNECTED) 4] create -s /zoo-2 "Hello World!" null
Created /zoo-2
[zk: localhost:2181(CONNECTED) 5] ls /
[zoo-2, zoo-20000000007, zoo-1, zookeeper]
Why does using the -s flag, which makes the znode persistent, also change the name of the znode? I was following along the following tutorial http://java.dzone.com/articles/zookeeper-primer, and from his example the same thing does not happen to him.
Thank you for your time!
the -s flag is to create a sequential node. The dzone article looks like it has a mistake.
精彩评论