ZooKeeper---安装配置

Zookeeper:

1、可以作为集群的管理工具使用。

2、可以集中管理配置文件。

1.1.1. Zookeeper的安装

安装环境:

Linux:centos6.4

Jdk:1.7以上版本

Zookeeper是java开发的可以运行在windows、linux环境。需要先安装jdk。

安装步骤:

第一步:安装jdk

第二步:把zookeeper的压缩包上传到linux系统。

第三步:解压缩压缩包

tar -zxvf zookeeper-3.4.6.tar.gz

第四步:进入zookeeper-3.4.6目录,创建data文件夹。

cd zookeeper-3.4.6/conf/

第五步:把zoo_sample.cfg改名为zoo.cfg

[root@localhost conf]# mv zoo_sample.cfg zoo.cfg

第六步:编辑zoo.cfg,修改data属性:

# 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
# 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=/home/hao/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.
#

第七步:启动zookeeper

[root@localhost bin]# ./zkServer.sh start

关闭:

[root@localhost bin]# ./zkServer.sh stop

查看状态:

[root@localhost bin]# ./zkServer.sh status

注意:需要关闭防火墙。

service iptables stop

永久关闭修改配置开机不启动防火墙:

chkconfig iptables off

如果不能成功启动zookeeper,需要删除data目录下的zookeeper_server.pid文件。

猜你喜欢

转载自my.oschina.net/u/3042999/blog/1631356