【发布时间】:2018-08-02 13:29:27
【问题描述】:
使用 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,我尝试了这种方法。 由此,我认为我尝试过的应该有效。两个问题:
为什么没有正确创建第一个带空格的字符串?
为什么后面的'set'会抛出NumberFormatException?
【问题讨论】:
-
根据我的阅读,您不能通过 Zookeeper 的命令行工具添加带空格的字符串值。
标签: java apache-zookeeper