zookeeper分布式环境的搭建

官网配置地址:http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

安装jdk

关闭防火墙

下载zookeeper-3.3.6并解压

进入到解压文件中的conf目录下,重命名 zoo_sample.cfg为 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.
dataDir=/home/hadoop/app/zookeeper-3.3.6/data
# the port at which the clients will connect
clientPort=2181
server.1=192.168.19.100:2888:3888   # 28888 zookeeper监听端口, 3888选举端口
server.2=192.168.19.101:2888:3888
server.3=192.168.19.102:2888:3888

 

配置好后需要在dataDir目录下创建一个myid的文件,文件的内容为 server.x=ip:2888:3888中的x的值,如server.1=192.168.19.100:2888:3888,则在ip为192.168.19.100的机器上的/home/hadoop/app/zookeeper-3.3.6/data存在一个内容为1的myid文件

 拷贝zookeeper到其他的机器

启动zookeeper: bin/zkServer.sh start

停止zookeeper: bin/zkServer.sh stop

查看zookeeper状态: bin/zkServer.sh status

 

posted @ 2016-10-24 15:41  天之涯0204  阅读(357)  评论(0编辑  收藏  举报