Zookeeper安装与基础配置(CentOS)

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

一、确保JDK已安装 (JDK 1.6以上)

二、下载Zookeeper安装包

        可以到这个链接去下载http://mirrors.gigenet.com/apache/zookeeper/stable/

三、解压zookeeper-3.4.6.tar.gz

    # cd /home

    # tar -zxvf zookeeper-3.4.6.tar.gz

四、修改zookeeper配置文件

参考:http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_configuration

   cd /home/zookeeper-3.4.6/conf/;

   mv zoo_sample.cfg zoo.cfg

   将文件内容修改为如下:

# The number of milliseconds of each tick

#It is used to do heartbeats and the minimum session timeout will be twice the tickTime.

#用于心跳以及会话超时时间

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=/home/data/zookeeper

# 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=0

#

# 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

五、新建存放zookeeper数据文件夹

   mkdir /home/data/zookeeper

六、启动zookeeper

bin/zkServer.sh start

七、设置开机启动

echo "/home/zookeeper-3.4.6/bin/zkServer.sh start">>/etc/rc.local

八、查看zookeeper的日志zookeeper.out

tail -n 100 bin/zookeeper.out


你可能感兴趣的:(Zookeeper安装与基础配置(CentOS))