CentOS7安装Zookeeper(单机版)

下载Zookeeper安装包

       wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

解压安装Zookeeper

  1. 创建安装目录:mkdir -p /usr/local/zookeeper
  2. 解压安装包到安装目录:tar -zxvf zookeeper-3.4.13.tar.gz -C /usr/local/zookeeper
  3. 进入conf文件夹下将zoo_simple.cfg改名为zoo.cfg:mv zoo_simple.cfg zoo.cfg
  4. 编辑zoo.cfg修改配置:
    1. 编辑zoo.cfg:vi zoo.cfg
    2. 修改dataDir值为:/usr/local/zookeeper/zookeeper-3.4.13/data
    3. 添加:dataLogDir=/usr/local/zookeeper/zookeeper-3.4.13/log
  5. 创建dataDir目录:mkdir -p /usr/local/zookeeper/zookeeper-3.4.13/data
  6. 创建dataLogDir目录:mkdir -p /usr/local/zookeeper/zookeeper-3.4.13/log

启动Zookeeper

  1. 启动Zookeeper:/usr/local/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start
  2. 查看状态:/usr/local/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status

防火墙开放端口

  1. 查看开放端口:firewall-cmd --list-ports
  2. 开放端口:firewall-cmd --zone=public --add-port=2181/tcp –permanent
  3. 重启防火墙:firewall-cmd --reload

你可能感兴趣的:(CentOS)