标签:
转载请注明出处: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
标签:
原文地址:http://www.cnblogs.com/blazer/p/4977217.html