启动客户端时修改服务名称:
./zkCli.sh -server hadoop128:2181
hadoop为客户端名字,2181为端口号
客户端中
create /sanguo “diaochan” //新建一个持久的节点
create -e /sanguo //新建一个带序号的持久的节点
create -s /sanguo //新建一个短暂的节点
get /sanguo //获得节点的值
get -s /sanguo //获得节点值和属性
get -w /sanguo //节点注册监听,注册一次生效一次
ls -w /sanguo //路径注册监听,注册一次生效一次
set /sanguo “lvbu” //修改节点值
delete /sanguo //删除节点
deleteall /sanguo/shuguo //递归删除节点
stat /sanguo //查看节点状态