[root@hadoop ~]# tree -L 2 apache-zookeeper-3.5.6-binapache-zookeeper-3.5.6-bin├──bin│├──README.txt│├──zkCleanup.sh│├──zkCli.cmd│├──zkCli.sh│├──zkEnv.cmd│├──zkEnv.sh│├──zkServer.cmd│├──zkServer-initialize.sh│├──zkServer.sh│├──zkTxnLogToolkit.cmd│└──zkTxnLogToolkit.sh├──conf│├──configuration.xsl│├──log4j.properties│└──zoo_sample.cfg
创建成功,进入到zookeeper的conf目录
cd zookeeper/conf/ 有三个文件,zookeeper的配置文件叫做zoo.cfg,这里边没有,我们把 zoo_sample.cfg 拷贝一份出来
zookeeper部署方式
单机模式
伪分布式集群
完全分布式集群
原始配置
vimzoo.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/tmp/zookeeper# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## 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
# 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=/usr/local/zookeeper-3.4.9/data/data_1
dataLogDir=/usr/local/zookeeper-3.4.9/dataLog/dataLog_1
# the port at which the clients will connect
clientPort=2181
server.0=localhost:2287:3387
server.1=localhost:2288:3388
server.2=localhost:2289:3389