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

生产环境Zookeeper集群搭建

时间:2015-10-19 23:54:56      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:

三个主机就不提了,直接点

#####安装jdk######

[root@Zk-1 ~]# rpm -ivh jdk-7u76-linux-x64.rpm
[root@Zk-1 ~]# vi /etc/profile
...
export ZOO_HOME=/usr/local/zookeeper
export PATH=$PATH:$ZOO_HOME/bin
export JAVA_HOME=/usr/java/jdk1.7.0_76
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
...


####安装zookeeper####

[root@Zk-1 ~]# cd /usr/local
[root@Zk-1 ~]# tar -zxf zookeeper-3.4.6-product.tar.gz
[root@Zk-1 ~]# rm -f zookeeper-3.4.6-prod
uct.tar.gz
[root@Zk-1 ~]# mv zookeeper-3.4.6 zookeeper
[root@Zk-1 ~]# mkdir /data
[root@Zk-1 ~]# source /etc/profile

######配置zookeeper环境####

[root@Zk-1 ~]# vim /usr/local/zookeeper/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=/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=500
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=168

server.1=10.0.76.108:2888:3888
server.2=10.0.76.109:2888:3888
server.3=10.0.76.110:2888:3888
...

[root@Zk-1 ~]# vim /data/myid
...
1     #看主机而改
...

 

#########启动zookeeper########

[root@Zk-1 ~]# zkServer.sh start
[root@Zk-1 ~]# zkServer.sh status
...
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower         #或者leader
[root@Zk-1 ~]# jps
6213 Jps
1932 QuorumPeerMain

 

生产环境Zookeeper集群搭建

标签:

原文地址:http://www.cnblogs.com/lens/p/4893388.html

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