Zookeeper集群安装教程
引言好久没有安装这些东西,在此处记录一下========================教程开始============================1、获取安装包[root@acs soft]# wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz2、解...
引言
好久没有安装这些东西,在此处记录一下
========================教程开始============================
1、获取安装包
[root@jack soft]# wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
2、解压
[root@jack soft]# tar -zxvf zookeeper-3.4.10.tar.gz
3、在安装路径下面创建文件夹
[root@jack soft]# mkdir zookeeper-3.4.10
4、将解压文件移动到安装目录下面
[root@jack soft]# mv zookeeper-3.4.10 /data/app/zookeeper-3.4.10/zookeeper1
5、在zk1下面创建文件夹data
mkdir /data/app/zookeeper-3.4.10/zookeeper1/data
6、创建 识别文件
在目录/data/app/zookeeper-3.4.10/zookeeper1/data下创建标识文件myid,在 myid 文件中设置标识(数字),在配置文件中要用到,集群中各个节点不能重 复
echo 1 > myid
7、修改配置文件
主要配置文件位置在:/data/app/zookeeper-3.4.10/zookeeper1/conf
复制出一个 配置文件 cp zoo_sample.cfg 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/app/zookeeper-3.4.10/zookeeper1/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=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=1.2.6.1:2881:3881
server.2=1.2.6.1:2882:3882
server.3=1.2.6.1:2883:3883
8、修改日志配置文件
日志配置文件位置在:/data/app/zookeeper-3.4.10/zookeeper1/conf 路径下log4j.properties
主要修改下面这几个配置项
zookeeper.root.logger=INFO, CONSOLE
zookeeper.console.threshold=INFO
zookeeper.log.dir=/data/logs/zookeeper
zookeeper.log.file=zookeeper.log
zookeeper.log.threshold=DEBUG
zookeeper.tracelog.dir=/data/logs/zookeeper
zookeeper.tracelog.file=zookeeper_trace.log
9、启动服务
/data/app/zookeeper-3.4.10/zookeeper1/bin/zkServer.sh start
10、配置 节点2 和 节点3
同理配置zookeeper2和zookeeper3,其中myid不同,zoo.cfg中的clientPort值不同,修改配置文件 中的端口。
至此,整个 集群的安装完成
附录:zk配置文件的主要配置项介绍
#节点数据、日志路径
dataDir=/opt/zookeeper/zk1/data
#dataLogDir=/opt/zookeeper-3.4.10/zk1/logs
# 服务器与客户端之间交互的基本时间单元(ms)
tickTime=2000
# zookeeper所能接受的客户端数量
initLimit=10
# Leader服务器与follower服务器之间信息同步允许的最大时间间隔,如果超过次间隔,默认follower服务器与leader服务器之间断开链接
syncLimit=5
#节点监听端口
clientPort=2181
#集群中各个节点地址和监听端口
server.1=zk1.jack.com:2881:3881
server.2= zk2.jack.com:2882:3882
server.3= zk3.jack.com:2883:3883
#限制连接到zookeeper服务器客户端的数量
#maxClientCnxns=60
更多推荐
所有评论(0)