码迷,mamicode.com
首页 > 其他好文 > 详细

Zookeeper安装

时间:2015-11-19 13:15:36      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:

转载请注明出处:http://www.cnblogs.com/blazer/p/4977217.html

 

CentOs6.4 Zookeeper-3.4.6

下载解压如图:

技术分享

先创建个data和logs目录,你也可以创建到其他地方

mkdir data
mkdir logs

 

修改配置文件zoo.cfg

vi conf/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=/home/BlazerHe/zookeeper/zookeeper-3.4.6/data
dataLogDir=/home/BlazerHe/zookeeper/zookeeper-3.4.6/logs
# the port at which the clients will connect
clientPort=2181
server.1=test1:2888:3888
#server.2=test1:2888:3888
#server.3=test1:2889:3889
# 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

 配置了dataDir和dataLogDir为之前创建的目录

 配置了server.x

 这个是配置zookeeper集群使用,多个机器就以此类推。集群的数量最好为单数。

 然后需要在配置的dataDir目录下创建一个myid文件,内容为server.x中x的值

echo 1 > /home/BlazerHe/zookeeper/zookeeper-3.4.6/data/myid

 

最后可以启动了。

sh bin/zkServer.sh start

技术分享

 

 连接上去试试命令

 

sh bin/zkCli.sh -server 127.0.0.1

技术分享

 

ls /

技术分享

 

get /my_data

技术分享

 

set /my_data oknon.com

技术分享

 

get /my_data

技术分享

 

Zookeeper安装

标签:

原文地址:http://www.cnblogs.com/blazer/p/4977217.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!