zookeeper安装配置---coco
#by coco
#2014-07-25
本文主要是简单介绍zookeeper的安装过程。
3. 安装配置zookeeper
[root@db96 ~]# wget http://mirror.bit.edu.cn/apache//zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
解压到/usr/local/ 并做软连接
[root@db96 local]# ln -s /usr/local/zookeeper-3.4.5-cdh5.0.2/ zookeeper
[root@db96 zookeeper]# cd conf/
[root@db96 conf]# cp zoo_sample.cfg zoo.cfg
[root@db96 conf]# vi 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
dataLogDir=/usr/local/zookeeper/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
server.96=db96:2888:3888
server.98=db98:2888:3888
server.99=db99:2888:3888
保存退出。在dataDir=/usr/local/zookeeper/data 目录下创建myid文件。该文件在不同主机上不同
唯一标示主机id.
[root@db96 zookeeper]# pwd
/usr/local/zookeeper
[root@db96 zookeeper]# mkdir -p /usr/local/zookeeper/data
[root@db96 zookeeper]# mkdir -p /usr/local/zookeeper/logs
[root@db96 zookeeper]# cd /usr/local/zookeeper/data/
[root@db96 data]# vim myid //注意zoo.cfg中配置的server.X 则myid中对应 相应的X
96
保存退出。
[root@db96 data]# ll
总用量 4
-rw-r--r-- 1 root root 3 7月 18 15:40 myid
[root@db96 data]# cat myid
96
[root@db96 data]#
scp zookeeper到集群的其他机器上。
[root@db96 data]# scp -r /usr/local/zookeeper-3.4.5 db98:/usr/local/
[root@db96 data]# scp -r /usr/local/zookeeper-3.4.5 db99:/usr/local/
[root@db98 local]# ln -s /usr/local/zookeeper-3.4.5/ zookeeper
[root@db98 local]# vim ./zookeeper/data/myid //修改db98上的myid
98
[root@db99 local]# ln -s /usr/local/zookeeper-3.4.5/ zookeeper
[root@db99 local]# vim ./zookeeper/data/myid
99
启动zookeeper
[root@db96 hadoop]# /usr/local/zookeeper/bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
注意:我启动的顺序是db96>db98>db99,由于ZooKeeper集群启动的时候,
每个结点都试图去连接集群中的其它结点,先启动的肯定连不上后面还没启动的,
所以上面日志前面部分的异常是可以忽略的。通过后面部分可以看到,
集群在选出一个Leader后,最后稳定了。
其他结点可能也出现类似问题,属于正常。
[root@db96 local]# ./zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
*************到此zookeeper配置完毕。
#by coco
#2014-07-25
本文主要是简单介绍zookeeper的安装过程。
3. 安装配置zookeeper
[root@db96 ~]# wget http://mirror.bit.edu.cn/apache//zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
解压到/usr/local/ 并做软连接
[root@db96 local]# ln -s /usr/local/zookeeper-3.4.5-cdh5.0.2/ zookeeper
[root@db96 zookeeper]# cd conf/
[root@db96 conf]# cp zoo_sample.cfg zoo.cfg
[root@db96 conf]# vi 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
dataLogDir=/usr/local/zookeeper/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
server.96=db96:2888:3888
server.98=db98:2888:3888
server.99=db99:2888:3888
保存退出。在dataDir=/usr/local/zookeeper/data 目录下创建myid文件。该文件在不同主机上不同
唯一标示主机id.
[root@db96 zookeeper]# pwd
/usr/local/zookeeper
[root@db96 zookeeper]# mkdir -p /usr/local/zookeeper/data
[root@db96 zookeeper]# mkdir -p /usr/local/zookeeper/logs
[root@db96 zookeeper]# cd /usr/local/zookeeper/data/
[root@db96 data]# vim myid //注意zoo.cfg中配置的server.X 则myid中对应 相应的X
96
保存退出。
[root@db96 data]# ll
总用量 4
-rw-r--r-- 1 root root 3 7月 18 15:40 myid
[root@db96 data]# cat myid
96
[root@db96 data]#
scp zookeeper到集群的其他机器上。
[root@db96 data]# scp -r /usr/local/zookeeper-3.4.5 db98:/usr/local/
[root@db96 data]# scp -r /usr/local/zookeeper-3.4.5 db99:/usr/local/
[root@db98 local]# ln -s /usr/local/zookeeper-3.4.5/ zookeeper
[root@db98 local]# vim ./zookeeper/data/myid //修改db98上的myid
98
[root@db99 local]# ln -s /usr/local/zookeeper-3.4.5/ zookeeper
[root@db99 local]# vim ./zookeeper/data/myid
99
启动zookeeper
[root@db96 hadoop]# /usr/local/zookeeper/bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
注意:我启动的顺序是db96>db98>db99,由于ZooKeeper集群启动的时候,
每个结点都试图去连接集群中的其它结点,先启动的肯定连不上后面还没启动的,
所以上面日志前面部分的异常是可以忽略的。通过后面部分可以看到,
集群在选出一个Leader后,最后稳定了。
其他结点可能也出现类似问题,属于正常。
[root@db96 local]# ./zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
*************到此zookeeper配置完毕。