ZooKeeper 명령: 시작, 상태 보기, help, ls,create,get,set,stat,delete, 네 가지 노드, 감시watch
상태 보기
[worker@103-17-143-sh-K05 bin]$ /ssd1/workspace/zookeeper/zookeeper2-3.4.12/bin/./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /ssd1/workspace/zookeeper/zookeeper2-3.4.12/bin/../conf/zoo.cfg
Mode: leader
클라이언트 시작
[worker@103-17-143-sh-K05 bin]$ /ssd1/workspace/zookeeper/zookeeper2-3.4.12/bin/zkCli.sh -server localhost:2181
Connecting to localhost:2181
...( )
[zk: localhost:2181(CONNECTED) 0]
기본 명령
도움말
[zk: localhost:2181(CONNECTED) 0] help
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
디렉토리 ls 보기
[zk: localhost:2181(CONNECTED) 3] ls /
[jodis, zk, zookeeper, codis, codis3, worker_id_forever]
디렉토리create 만들기
[zk: localhost:2181(CONNECTED) 4] create /zk_test hanchao_test
Created /zk_test
데이터 가져오기get
[zk: localhost:2181(CONNECTED) 5] get /zk_test
hanchao_test
cZxid = 0x4000092ec
ctime = Thu Mar 07 10:34:59 CST 2019
mZxid = 0x4000092ec
mtime = Thu Mar 07 10:34:59 CST 2019
pZxid = 0x4000092ec
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 12
numChildren = 0
[zk: localhost:2181(CONNECTED) 6] set /zk_test hanchaohanchao
cZxid = 0x4000092ec
ctime = Thu Mar 07 10:34:59 CST 2019
mZxid = 0x4000092ed
mtime = Thu Mar 07 10:35:55 CST 2019
pZxid = 0x4000092ec
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 14
numChildren = 0
상태 점검stat
[zk: localhost:2181(CONNECTED) 12] stat /hanchao_test/defatul_node
cZxid = 0x4000092f3
ctime = Thu Mar 07 10:50:52 CST 2019
mZxid = 0x4000092f6
mtime = Thu Mar 07 10:54:22 CST 2019
pZxid = 0x4000092f3
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 22
numChildren = 0
경로 삭제
[zk: localhost:2181(CONNECTED) 8] delete /zk_test
[zk: localhost:2181(CONNECTED) 9] ls /
[jodis, zk, zookeeper, codis, codis3, worker_id_forever]
네 가지 노드
create /path data
무질서 영구 노드 (기본값)
[zk: localhost:2181(CONNECTED) 20] create /hanchao_test/defatul_node "persistent,no-sequence"
Created /hanchao_test/defatul_node
[zk: localhost:2181(CONNECTED) 21] ls /hanchao_test
[defatul_node]
질서정연한 지속 노드
-s
:sequence [zk: localhost:2181(CONNECTED) 3] create -s /hanchao_test/sequence_node "persistent,sequence"
Created /hanchao_test/sequence_node0000000001
[zk: localhost:2181(CONNECTED) 4] ls /hanchao_test
[defatul_node, sequence_node0000000001]
[zk: localhost:2181(CONNECTED) 5] create -s /hanchao_test/sequence_node "persistent,sequence"
Created /hanchao_test/sequence_node0000000002
[zk: localhost:2181(CONNECTED) 6] ls /hanchao_test
[defatul_node, sequence_node0000000001, sequence_node0000000002]
무질서 임시 노드
-e
: temp # client1
[zk: localhost:2181(CONNECTED) 3] create -e /hanchao_test/temp_node "no-persistent,no-sequence"
Created /hanchao_test/temp_node
[zk: localhost:2181(CONNECTED) 4] ls /hanchao_test
[temp_node, defatul_node, sequence_node0000000001, sequence_node0000000002]
# client2
# client1
[zk: localhost:2181(CONNECTED) 7] ls /hanchao_test
[temp_node, defatul_node, sequence_node0000000001, sequence_node0000000002]
# client1
[zk: localhost:2181(CONNECTED) 8] ls /hanchao_test
[defatul_node, sequence_node0000000001, sequence_node0000000002]
순서 임시 노드
[zk: localhost:2181(CONNECTED) 1] create -s -e /hanchao_test/temp_node_p "no-persistent,order"
Created /hanchao_test/temp_node_p0000000004
[zk: localhost:2181(CONNECTED) 2] ls /hanchao_test
[defatul_node, temp_node_p0000000004, sequence_node0000000001, sequence_node0000000002]
[zk: localhost:2181(CONNECTED) 3] create -s -e /hanchao_test/temp_node_p "no-persistent,order"
Created /hanchao_test/temp_node_p0000000005
[zk: localhost:2181(CONNECTED) 4] ls /hanchao_test
[defatul_node, temp_node_p0000000005, temp_node_p0000000004, sequence_node0000000001, sequence_node0000000002]
# client1
[zk: localhost:2181(CONNECTED) 14] get /hanchao_test/defatul_node 1
persistent,no-sequence
cZxid = 0x4000092f3
ctime = Thu Mar 07 10:50:52 CST 2019
mZxid = 0x4000092f6
mtime = Thu Mar 07 10:54:22 CST 2019
pZxid = 0x4000092f3
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 22
numChildren = 0
# client2 set
[zk: localhost:2181(CONNECTED) 0] set /hanchao_test/defatul_node "hhhhh"
cZxid = 0x4000092f3
ctime = Thu Mar 07 10:50:52 CST 2019
mZxid = 0x400009301
mtime = Thu Mar 07 11:10:26 CST 2019
pZxid = 0x4000092f3
cversion = 0
dataVersion = 2
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
# client1
[zk: localhost:2181(CONNECTED) 15]
WATCHER::
WatchedEvent state:SyncConnected type:NodeDataChanged path:/hanchao_test/defatul_node
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
zookeeper 오류 보고: NodeException: KeeperErrorCodezookeeper 오류 보고: NodeException: KeeperErrorCode = Node for/consumes/xxx/xxx Node does not exist zookeeper 서버에 로그인하여 node...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.