1,建立配置文件
进入ZooKeeper的conf文件夹
cd~/apache-zookeeper-3.7.0-bin/conf
zoo1.cfg
sudo gedit zoo1.cfg
插入内容:
initLimit=10 syncLimit=5 # zookeeper存储文件的位置 dataDir=/home/hadoop/apache-zookeeper-3.7.0-bin/1.data # zookeeper日志文件的位置 dataLogDir=/home/hadoop/apache-zookeeper-3.7.0-bin/1.logs # zookeeper供客户端连接的端口,默认是2181 clientPort=2181 # 设置三个节点 server.1=192.168.2.134:20881:30881 server.2=192.168.2.134:20882:30882 server.3=192.168.2.134:20883:30883
zoo2.cfg
sudo gedit zoo2.cfg
插入内容:
# 集群中的Follower服务器初始化连接服务器时能等待的最大心跳数(连接超时时长),默认为10 initLimit=10 syncLimit=5 # zookeeper存储文件的位置 dataDir=/home/hadoop/apache-zookeeper-3.7.0-bin/2.data # zookeeper日志文件的位置 dataLogDir=/home/hadoop/apache-zookeeper-3.7.0-bin/2.logs # zookeeper供客户端连接的端口,默认是2181 clientPort=2181 # 设置三个节点 server.1=192.168.2.134:20881:30881 server.2=192.168.2.134:20882:30882 server.3=192.168.2.134:20883:30883
zoo3.cfg
sudo gedit zoo3.cfg
输入内容:
initLimit=10 syncLimit=5 dataDir=/home/hadoop/apache-zookeeper-3.7.0-bin/2.data dataLogDir=/home/hadoop/apache-zookeeper-3.7.0-bin/2.logs clientPort=2181 server.1=192.168.2.134:20881:30881 server.2=192.168.2.134:20882:30882 server.3=192.168.2.134:20883:30883
2,建立数据和日志文件
进入安装目录
cd /home/hadoop/apache-zookeeper-3.7.0-bin
创建数据文件
mkdir 1.data 2.data 3.data
创建日志文件
mkdir 1.logs 2.logs 3.logs
3,启动服务并查看状态
先进入zookeeper安装目录的bin目录
cd cd/home/hadoop/apache-zookeeper-3.7.0-bin/bin
分别启zookeeper服务:
zkServer.sh start /home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo1.cfg zkServer.sh start /home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo2.cfg zkServer.sh start /home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo3.cfg
分别查看服务状态:
zkServer.sh status /home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo1.cfg zkServer.sh status /home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo2.cfg zkServer.sh status/home/hadoop/apache-zookeeper-3.7.0-bin/conf/zoo3.cfg
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)