使用ZK 3.4.5和zkCli.sh,我得到以下内容:
./zkCli.sh -server localhost:2181
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] create /test 100
Created /test
[zk: localhost:2181(CONNECTED) 1] create /test/spacesString "this string has spaces in it"
Created /test/spacesString
[zk: localhost:2181(CONNECTED) 2] get /test/spacesString
"this
cZxid = 0x9c220
ctime = Wed Mar 11 06:46:10 EDT 2015
mZxid = 0x9c220
mtime = Wed Mar 11 06:46:10 EDT 2015
[deleted rest of output here]
[zk: localhost:2181(CONNECTED) 3] set /test/spacesString "new value"
Command failed: java.lang.NumberFormatException: For input string: "value""
由于here,我尝试了这种方法。 从那以后,我收集了我尝试的应该工作。两个问题:
为什么没有正确创建带空格的第一个字符串?
为什么随后的'设置'抛出NumberFormatException?
答案 0 :(得分:1)
之所以不起作用,是因为命令解析器使用空格来标记输入,并且没有正确处理字符串。该问题的解决方法:
ZOOKEEPER-1853-“ zkCli.sh无法发出包含数据中空格的CREATE命令”。
根据JIRA,此修复程序应位于3.4.7、3.5.2和3.6.0中。