linuxcentos7安装zookeeper
linux 系统下 zookeeper 安装教程
1.下载安装包
1)进⼊安装⽬录
cd /home/install/
2)下载
wget mirror.bit.edu/apache/zookeeper/stable/zookeeper-3.4.
2.安装
1)创建和解压⾄安装⽬录
mkdir /usr/local/zookeeper
tar -zxcf /home/install/zookeeper-3.4. -C /usr/local/zookeeper/
2)拷贝样本配置为主配置
进⼊配置⽬录,赋值拷贝样本⽂件
cd /usr/local/zookeeper/zookeeper-3.4.12/conf/
cp zoo_sample.cfg zoo.cfg
linux安装jdk教程 3)简单修改配置
创建数据存储⽬录与⽇志⽬录
mkdir /usr/local/zookeeper/zookeeper-3.4.12/dataDir
mkdir /usr/local/zookeeper/zookeeper-3.4.12/dataLogDir
修改数据存储和⽇志⽬录
vim /usr/local/zookeeper/zookeeper-3.4.12/conf/zoo.cfg
3.配置zookeeper环境变量
1)依赖JVM环境,所以JVM与zookeeper环境变量都要配置
vim /etc/profile
在尾部加⼊或修改以下
JAVA_HOME=/usr/local/java/jdk1.8.0_181
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME PATH
ZOOKEEPER_HOME=/usr/local/zookeeper/zookeeper-3.4.12
PATH=$PATH:$ZOOKEEPER_HOME/bin
export PATH ZOOKEEPER_HOME PATH
2)⽣效
source /etc/profile
3.测试
1)启动
/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh start
2)连接
/usr/local/zookeeper/zookeeper-3.4.12/bin/zkCli.sh 3)增删改查
4)其他
help查看指令帮助
4.开机启动
(1)编辑zookeeper.service⽂件
vim /usr/lib/systemd/system/zookeeper.service
加⼊如下内容
[Unit]
Description=zookeeper
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh start ExecReload=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh restart ExecStop=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh stop [Install]
WantedBy=multi-user.target
(2)⽣效
systemctl daemon-reload
(3)改变⽂件权限
chmod 777 /usr/lib/systemd/system/zookeeper.service
(4)systemctl开机启动zookeeper
systemctl enable /usr/lib/systemd/system/zookeeper.service
或
systemctl enable /usr/lib/systemd/system/zookeeper
(5)查看是否开机启动
systemctl is-enabled zookeeper.service
(6)systemctl取消开机启动redis
systemctl disable zookeeper.service
本章只讲安装,关于配置属性与操作指令,先参考度娘
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论