CentOS下单机安装配置ZooKeeper
下载安装ZooKeeper
官方网站:http://zookeeper.apache.org/
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper
# wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.5.6/apache-zookeeper-3.5.6-bin.tar.gz
# tar -xf apache-zookeeper-3.5.6-bin.tar.gz -C /usr/local/ //解压
# mv /usr/local/apache-zookeeper-3.5.6-bin /usr/local/zookeeper
# mkdir /data/zookeeper //创建数据存储路径
修改配置文件
# cd /usr/local/zookeeper/conf/
# cp zoo_sample.cfg zoo.cfg
# vim zoo.cfg
dataDir=/data/zookeeper
clientPort=2188
添加环境配置
# vim /etc/profile
export ZOOKEEPER_HOME=/usr/local/zookeeper
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
# source /etc/profile
ZooKeeper启动常用命令
1、启动 zookeeper 服务:
# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
2、查询 zookeeper 状态:
# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: standalone
3、关闭 zookeeper 服务:
zkServer.sh stop
4、重启 zookeeper 服务:
# zkServer.sh restart
5、开机启动配置
开机启动使用zookeeper的用户启动命令(正式环境不建议使用root,这里使用的是一个zookeeper的用户启动)
su - zookeeper -c '/usr/local/zookeeper/bin/zkServer.sh start'
Dubbo配置
<dubbo:registry address="zookeeper://xxx.xxx.xxx.xxx:2188?backup=aaa.aaa.aaa.aaa:2188,bbb.bbb.bbb.bbb:2188"/>
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/18/install-and-config-zookeeper-for-standalone-under-centos/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
CentOS下单机安装配置ZooKeeper
下载安装ZooKeeper
官方网站:http://zookeeper.apache.org/
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper
# wget https://mirrors.tun……
文章目录
关闭
共有 0 条评论