Linux Zookeeper 下载安装教程
zookeeper 官网:https://zookeeper.apache.org/
zookeeper 下载地址:https://downloads.apache.org/zookeeper/
1、下载最新的安装包
2、上传下载好的安装包到 /home/zookeeper/ 目录下
3、执行 tar -zxvf /home/zookeeper/apache-zookeeper-3.7.0-bin.tar.gz
解压安装包
4、进入到解压好的目录中创建 data 和 logs 文件夹
cd /home/zookeeper/apache-zookeeper-3.7.0-bin/
mkdir data
mkdir logs
5、进入 conf
文件夹,拷贝一份配置文件并进行修改
cd conf/
cp zoo_sample.cfg zoo.cfg
vim 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/zookeeper/apache-zookeeper-3.7.0-bin/data/
dataLogDir=/home/zookeeper/apache-zookeeper-3.7.0-bin/logs
# 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
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
6、配置环境变量
vim /etc/profile
export ZOOKEEPER_HOME=/home/zookeeper/apache-zookeeper-3.7.0/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
执行命令使 profile 文件生效
source /etc/profile
7、防火墙添加 zookeeper 访问端口
firewall-cmd --zone=public --add-port=2181/tcp --permanent
重启防火墙
systemctl restart friewalld.service
8、启动 zookeeper 服务并测试是否正常启动
cd /home/zookeeper/apache-zookeeper-3.7.0-bin/bin/
./zkServer.sh start
关闭 zookeeper
./zkServer.sh stop
如果 8080 端口被占用可能启动不成功,改变端口在配置文件中加入下面的配置
admin.serverPort=端口号