zookeeper learning (zero) _ Installation and Startup

zookeeper learning (zero) _ Installation and Startup

Recently I switched to a new computer, finally bought the coveted macbook. Recently switched to a new company, its technology stack used the zookeeper. Of course we also have to install under study. Slag slag province, I was despised in trouble. This article explains how to install, after install on, and then specific learning.

installation

As used herein, brewthe installation, silently say, mac system is easy to use than the win. Children's brew is not installed and the jdk Install these two.

  1. Open a terminal command execution
brew install zookeeper
  1. Boot Execution
zkServer start
  1. Execution zk connection
zkCli -timeout 5000 -server 127.0.0.1:2181
  1. Simple operation
 [zk: 127.0.0.1:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: 127.0.0.1:2181(CONNECTED) 1] create /zk_test kevin
Created /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 2] ls /
[zookeeper, zk_test]
[zk: 127.0.0.1:2181(CONNECTED) 3] get zk_test
Command failed: java.lang.IllegalArgumentException: Path must start with / character
[zk: 127.0.0.1:2181(CONNECTED) 4] get /zk_test
kevin
cZxid = 0x7
ctime = Sat Sep 14 21:14:18 CST 2019
mZxid = 0x7
mtime = Sat Sep 14 21:14:18 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 5] set /zk_test zookeeper
cZxid = 0x7
ctime = Sat Sep 14 21:14:18 CST 2019
mZxid = 0x8
mtime = Sat Sep 14 21:15:28 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 9
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 6] get /zk_test
zookeeper
cZxid = 0x7
ctime = Sat Sep 14 21:14:18 CST 2019
mZxid = 0x8
mtime = Sat Sep 14 21:15:28 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 9
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 7] delete /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 8] ls /
[zookeeper]

5. Stop Server

zkServer stop

to sum up

Today feel under zookeeper, of course, simply install a bit, experience a bit. I am also a rookie. I do not know about this, and slowly learn it.

Guess you like

Origin www.cnblogs.com/zhenghengbin/p/11520351.html