centos上安装zookeeper
Posted 架构师与哈苏
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos上安装zookeeper相关的知识,希望对你有一定的参考价值。
centos上安装zookeeper
# 创建zookeeper文件夹
cd /usr/local/
mkdir zookeeper
cd zookeeper
# 下载 解压
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/current/apache-zookeeper-3.6.2-bin.tar.gz
tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz
配置zookeeper
cd /usr/local/zookeeper/apache-zookeeper-3.6.2-bin/conf
# cp 一份zoo_sample.cfg
cp zoo_sample.cfg zoo.cfg
# 修改以下配置
vim zoo.cfg
dataDir=/usr/local/zookeeper/apache-zookeeper-3.6.2-bin/dataDir
dataLogDir=/usr/local/zookeeper/apache-zookeeper-3.6.2-bin/dataLogDir
quorumListenOnAllIPs=true
zoo.cfg
# 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=/usr/local/zookeeper/apache-zookeeper-3.6.2-bin/dataDir
dataLogDir=/usr/local/zookeeper/apache-zookeeper-3.6.2-bin/dataLogDir
# 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
quorumListenOnAllIPs=true
添加到全局环境变量
vim /etc/profile
# 添加到最后zookeeper
export ZOOKEEPER_HOME=/usr/local/zookeeper/apache-zookeeper-3.6.2-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin
# 刷新配置
source /etc/profile
启动命令
服务管理命令:zkServer.sh start|stop|restart|status
客户端连接:zkCli.sh -server ${ip}:${port}
长按扫码关注
以上是关于centos上安装zookeeper的主要内容,如果未能解决你的问题,请参考以下文章
在 CentOS7 上安装 zookeeper-3.4.9 服务
CentOS7 上安装 Zookeeper-3.4.9 服务