hello

zookeeper安装

前提:必须安装jdk8
1、下载安装包
各个版本安装包:http://archive.apache.org/dist/zookeeper/

cd /home/fch/module
wget http://archive.apache.org/dist/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz

2、解压
tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz

3、改个名字
mv apache-zookeeper-3.5.7-bin zookeeper

4、修改配置
cd conf
把 conf 目录下的 zoo_sample.cfg 重命名为 zoo.cfg,然后修改配置。
dataDir:数据存储位置
server.1=zknode:2888:3888 //必须在 dataDir目录下新增一个myid文件,这里文件内容就是1,唯一id
server.2=zknode:2888:3888 //必须在 dataDir目录下新增一个myid文件,这里文件内容就是2,唯一id

点击查看代码
# 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/fch/module/zookeeper/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=zknode:2888:3888

5、配置环境变量
vim ~/.bash_profile
添加内容:
JAVA_HOME=/home/fch/jdk1.8.0_291
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export ZOOKEEPER_HOME=/home/fch/module/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf

立即生效:
source ~/.bash_profile

6、启动zk
./zkServer.sh start

通过客户端链接是否正常
./zkCli.sh --localhost:2181

posted @   八股文研究生  阅读(44)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
my name is zhangsan
点击右上角即可分享
微信分享提示