zookeeper安装部署(单节点)
环境:
OS:Centos 7
zookeeper:3.8.4
1.获取安装介质
https://zookeeper.apache.org/releases.html#download
下载稳定版本
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
2.安装
[root@node1 /]# cd /soft
[root@node1 soft]# tar -xvf apache-zookeeper-3.8.4-bin.tar.gz
[root@node1 soft]# mv apache-zookeeper-3.8.4-bin /opt/zookeeper-3.8.4
3.创建数据目录
[root@node1 zookeeper-3.8.4]# cd /opt/zookeeper-3.8.4
[root@node1 zookeeper-3.8.4]# mkdir data
4.准备配置文件zoo.cfg
进入zookeeper的conf目录,拷贝zoo_sample.cfg为zoo.cfg,cp zoo_sample.cfg zoo.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=/opt/zookeeper-3.8.4/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.
#
# 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
只修改红色的地方,其他地方保持不变
5.启动zookeeper
进入zookeeper的bin目录,启动zookeeper服务,每个节点都需要启动
[root@localhost bin]# cd /opt/zookeeper-3.8.4/bin
[root@node1 bin]# ./zkServer.sh start
/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.8.4/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
6.查看端口
[root@node1 conf]# ss -nlp|grep 2181
tcp LISTEN 0 50 [::]:2181 [::]:* users:(("java",pid=28312,fd=59))
7.查看状态
[root@node1 bin]# ./zkServer.sh status
/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.8.4/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone
8.连接zookeeper
[root@localhost bin]# ./zkCli.sh -server localhost:2181
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-01-21 clickhouse通过uuid创建表
2019-01-21 kvm日常维护