saotolls 发表于 2024-8-29 22:55:45

Zookeeper的部署

服务文件的下载

服务文件下载地址:https://zookeeper.apache.org/releases.html
依赖环境的安装配置Zookeeper的运行依赖于JDK11+JDK11的下载地址:https://www.oracle.com/cn/java/technologies/javase/jdk11-archive-downloads.html
1. 将下载好的JDK文件上传至服务器;2. 使用 tar 命令对下载的 tar.gz 格式的文件进行解压缩操作;3. 将解压后的文件目录移动至一个自定义的路径中(/opt);4. 修改 /etc/profile 文件,在文件中加入如下信息(加入Java的环境变量配置信息)export JAVA_HOME=/opt/jdk-11.0.23
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH5. 是修改后的环境变量配置生效source /etc/profile
服务的安装1. 将下载好的Zookeeper安装bin文件上传至服务器

2. 使用 tar 指令对下载的压缩文件解压tar -zxf apache-zookeeper-3.8.4-bin.tar.gz
3. 配置conf配置文件# 将conf目录下的zoo_sample.cfg复制一份, 命名为zoo.cfg;
cp zoo_sample.cfg zoo.cfg
4. 启动服务# 运行bin目录下的zkServer.sh
sh zkServer.sh start
5. 放行防火墙端口firewall-cmd --zone=public --add-port=2181/tcp --permanent
6. 重新加载防火墙配置firewall-cmd --reload

服务的常用操作# 启动服务
sh zkServer.sh start

# 停止服务
sh zkServer.sh stop

# 重启服务
sh zkServer.sh restart

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=/tmp/zookeeper
# 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.
#
# https://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.httpHost=0.0.0.0
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true



页: [1]
查看完整版本: Zookeeper的部署