linux搭建zookeeper集群
-
安装jdk 看我上个文章
-
创建文件夹 mkdir zookeeper
-
用Xftp上传文件夹到zookeeper
-
在zookeeper-3.4.14文件夹创建data,logs文件夹
-
在data文件夹新增myid文件,里面维护你机器的编号
-
把conf文件夹里面的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.
#server2、server3文件夹下的这个文件 要修改这个位置
dataDir=/root/ff/zookeeper/zookeeper-3.4.14/data/1
#日志输出位置,根据个人喜好 将三个server的日志分开或者放在一个目录
dataLogDir=/root/ff/zookeeper/zookeeper-3.4.14/logs
# the port at which the clients will connect
clientPort=2182
server.1=192.168.229.128:2888:3888
server.2=192.168.229.129:2888:3888
server.3=192.168.229.130:2888:3888
# 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
- 执行/root/ff/zookeeper/zookeeper-3.4.14/bin/zkServer.sh start启动ZK
- 执行/root/ff/zookeeper/zookeeper-3.4.14/bin/zkServer.sh status 查看启动状态
如图,启动成功
ZK下载地址:链接:https://pan.baidu.com/s/1jdmsYj7w11kGI7odNUjaUQ
提取码:9vj0
报错:-bash: ./zkServer.sh: 权限不够
解决:执行chmod a+xwr zkServer.sh
报错:Error contacting service. It is probably not running.
解决:关闭防火墙(注意!!!)
systemctl status firewalld查看当前防火墙状态。
systemctl stop firewalld关闭当前防火墙。
systemctl disable firewalld开机防火墙不启动。
一个具有注脚的文本。1
如有疑问欢迎大家加我QQ:577128460 ↩︎