系统部署安装-Centos7-PostgreSQL

文章目录

  • 安装
    • 离线安装
    • 常用命令
    • 注册服务

安装

离线安装

1.创建一个文件夹,如

mkdir -p /opt/zookeeper

2.将zookeeper的包上传到服务器上该文件夹下,并进行解压

tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz

3.进入conf文件夹,复制zoo_sample.cfg,命名为zoo.cfg

cd ./apache-zookeeper-3.8.3-bin/conf  
cp zoo_sample.cfg zoo.cfg  

4.修改zoo.cfg

# 数据存放位置
dataDir=/data/zookeeper
# 日志存放位置
dataLogDir=/data/log/zookeeper

5.vim /etc/profile配置环境变量

#zookeeper-3.8.3 config start  
export ZOOKEEPER_HOME=/opt/zookeeper/apache-zookeeper-3.5.9-bin
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH 
#zookeeper-3.8.3 config end  

然后运行加载环境配置

source /etc/profile

6.配置启动的JAVA(如果你系统环境的JAVA符合,则跳过此步骤),编辑bin目录下的zkEvn.sh

JAVA=/opt/jdk8/bin/java
JAVA_HOME=/opt/jdk8

常用命令

cd /opt/zookeeper/apache-zookeeper-3.8.3-bin/bin  
# 启动zookeeper  
./zkServer.sh start    
# 查看zookeeper状态  
./zkServer.sh status    
# 关闭zookeeper服务  
./zkServer.sh stop    
# 重启zookeeper服务  
./zkServer.sh restart  

注册服务

1.编辑vim /etc/systemd/system/zookeeper.service,添加如下内容

[Unit]
Description=zookeeper-3.8.3
After=syslog.target network.target
[Service]
Restart=alwaysRestartSec=1
Type=forking
TimeoutSec=120
User=root
ExecStart=/opt/zookeeper/apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
ExecStop=/op/zookeeper/apache-zookeeper-3.8.3-bin/bin/zkServer.sh stop
ExecReload=/opt/zookeeper/apache-zookeeper-3.8.3-bin/bin/zkServer.sh restart  
Restart=always    
[Install]  
WantedBy=multi-user.target  

2.然后服务注册加载,添加启动,启动

systemctl daemon-reload
systemctl enable zookeeper
systemctl start zookeeper

----------------------------------END----------------------------------

天行健,君子以自强不息;地势坤,君子以厚德载物

你可能感兴趣的:(中间件相关,服务器相关,postgresql,数据库)