您的当前位置:首页>全部文章>文章详情
zookeeper部署
发表于:2022-02-25浏览:21次TAG: #zookeeper

下载zookeeper

cd /opt
wget https://downloads.apache.org/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz

安装zookeeper


tar zxvf apache-zookeeper-3.7.0-bin.tar.gz
cd apache-zookeeper-3.7.0-bin/

修改配置文件zoo.cfg

cp conf/zoo_sample.cfg  conf/zoo.cfg
vim conf/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/apache-zookeeper-3.7.0-bin/data
# the port at which the clients will connect
clientPort=2181
admin.serverPort=2182
# 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
server.1=0.0.0.0:2888:3888
server.2=8.141.78.165:2888:3888
server.3=8.141.71.246:2888:3888
mkdir data
touch data/myid
echo "1" >> data/myid

不同的服务器参见server. 的值写入对应的数据到data/myid


不同的服务器对应的server的ip修改为0.0.0.0

启动zookeeper


 ./bin/zkServer.sh start
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.7.0-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

看到以上消息,表示zookeeper安装成功


标签云