Linux centos7 安装zookeeper
作者:互联网
一:下载zookeeper安装包
从官网下载:https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.5.10/apache-zookeeper-3.5.10.tar.gz
二:上传并配置zookeeper
1.放在/usr/local目录下并解压。
tar -zxvf apache-zookeeper-3.5.10.tar.gz
2.进入/usr/local/apache-zookeeper-3.5.10/conf目录下
将zoo_sample.cfg复制一份取名为zoo.cfg
cp zoo_sample.cfg zoo.cfg
编辑zoo.cfg文件
vi zoo.cfg
内容为:
dataDir=/usr/local/apache-zookeeper-3.5.10/data
clientPort=2181
注:如果没有data文件请创建一个。
3.启动zookeeper
进入zookeeper的bin目录下
cd /usr/local/apache-zookeeper-3.5.10/bin
修改zkServer.sh权限
chmod 777 zkServer.sh
./zkServer.sh start
4.查看zookeeper启动状态
./zkServer.sh status
三:将zookeeper修改为开机启动
1.进入到/etc/rc.d/init.d目录下
cd /etc/rc.d/init.d
2.创建一个zookeeper的文件,并编辑
touch zookeeper
vi zookeeper
内容:
#!/bin/bash
#chkconfig: 2345 10 90
#description: service zookeeper
export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export ZOO_LOG_DIR=/usr/local/zookeeper-3.5.10/logs
ZOOKEEPER_HOME=/usr/local/zookeeper-3.5.10
su root ${ZOOKEEPER_HOME}/bin/zkServer.sh "$1"
然后保存退出。
3.给zookeeper文件添加可执行权限
chmod +x /etc/rc.d/init.d/zookeeper
4.把zookeeper这个脚本添加到开机启动项里面
chkconfig --add zookeeper
5.重启linux
reboot
6.查看zookeeper是否启动
service zookeeper status
我这边的测试环境是3A网络的centos7.9云服务器,大家也可以一起试一下!
标签:10,cfg,zookeeper,centos7,3.5,usr,Linux,local 来源: https://www.cnblogs.com/pangdahaiaaa/p/16624845.html