CentOS6.5+hadoop-2.5.2+hbase-1.0.1.1+zookeeper-3.4.6之zookeeper配置

当hadoop集群如上篇博客CentOS6.5上搭建hadoop 2.5.2 笔记配置成功后,其他配置就容易了许多。

下面来记录zookeeper的配置过程,

1、在下载的zookeeper 压缩包中,并不包含真正使用的配置文件,而是一个/conf/zoo_sample.cfg文件,需要使用复制命令复制一份为zoo.cfg的文件。

#cp zoo_sample.cfg zoo.cfg

2、在该文件中已经包含了部分配置,只需要修改一下dataDir路径,并配置一下server的hostname:port即可(其中server.1中的1,为服务序号,需要再zookeeper的安装目录下创建data文件夹,在里边创建myid文件,里边的内容即为该服务序号,结构为/zookeeper-3.4.6/data/myid),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=/data/hadoop/zookeeper-3.4.6/data
# the port at which the clients will connect
clientPort=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
dataLogDir=/data/hadoop/zookeeper-3.4.6/datalog
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
master的/data/myid的内容:
1

 将配置好的安装目录拷贝到其他机器:

scp -r /data/hadoop/zookeeper-3.4.6/ slave1:/data/hadoop/
scp -r /data/hadoop/zookeeper-3.4.6/ slave2:/data/hadoop/

同样需要在其他机器上配置myid文件,内容要与zoo.cfg中的序号对应。

如上都配置完成后,即可启动zookeeper,到目录/zookeeper-3.4.6/bin/,执行:

./zkServer.sh start
[root@master bin]# ./zkServer.sh start
JMX enabled by default
Using config: /data/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@master bin]# jps
3553 QuorumPeerMain
3571 Jps

三个机器都启动后,可以使用

./zkCli.sh master:2181来测试各节点是否安装成功

 

参考资料:http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

 

posted on 2015-05-28 10:24  273度  阅读(304)  评论(0编辑  收藏  举报

导航