欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

zookeeper部署

程序员文章站 2022-06-19 08:53:14
...

版本:zookeeper-3.4.5-cdh5.10.0.tar.gz

网址:http://archive-primary.cloudera.com/cdh5/cdh/5/

 

1. 解压

$ tar -zxf zookeeper-3.4.5-cdh5.10.0.tar.gz -C /usr/local
$ mv zookeeper-3.4.5-cdh5.10.0 ./zookeeper

  

2. 配置文件

$ vim /usr/local/zookeeper/conf/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=/usr/local/zookeeper/data
# 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

server.1=master:2888:3888
server.2=data1:2888:3888
server.3=data2:2888:3888
server.4=data3:2888:3888

  

3. 在zookeeper/下

$ mkdir data
$ vim data/myid
1

  

4. scp 至另外三台

$ scp /usr/local/zookeeper data1:/usr/local/zookeeper
$ scp /usr/local/zookeeper data2:/usr/local/zookeeper
$ scp /usr/local/zookeeper data3:/usr/local/zookeeper

修改myid 编号1-4

  

5. 启动zookeeper

# master
$ /usr/local/zookeeper/bin/zkServer.sh start
# data1,data2,data3
$ /usr/local/zookeeper/bin/zkServer.sh start

  

6. jps

1282 QuorumPeerMain
1363 Jps