4、修改zoo.cfg配置文件
修改zoo.cfg内容为:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/hadooptest/zookeeper-3.4.3/zookeeperdir/zookeeper-data
dataLogDir=/home/hadooptest/zookeeper-3.4.3/zookeeperdir/logs
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
# 2888,3888 are election port
server.1=zookeeper:2888:3888
3、查看状态:zookeeper-3.4.3/bin/zkServer.sh status
JMX enabled by default
Using config: /home/hadooptest/zookeeper-3.4.3/bin/../conf/zoo.cfg
Mode: standalone
4、启动客户端脚本:zookeeper-3.4.3/bin/zkCli.sh -server zookeeper:2181
WatchedEvent state:SyncConnected type:None path:null
[zk: zookeeper:2181(CONNECTED) 0]
[zk: zookeeper: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
[zk: zookeeper:2181(CONNECTED) 1] ls /
[hbase, zookeeper]
[zk: zookeeper:2181(CONNECTED) 2]