【毕设环境】安装ZooKeeper集群伪分布式

三台机器都进行以下操作
1.下载最新安装包:https://archive.apache.org/dist/zookeeper/

2.解压到program文件夹下:tar zxvf apache-zookeeper-3.5.6-bin.tar.gz -C ./…/program

3.配置环境变量

vi /etc/profile

# ZooKeeper Enviroment
ZOOKEEPER_HOME=/root/program/apache-zookeeper-3.5.6-bin
PATH=$ZOOKEEPER_HOME/bin:$PATH
CLASSPATH=$ZOOKEEPER_HOME/lib:$CLASSPATH
export ZOOKEEPER_HOME PATH CLASSPATH

source /etc/profile

4.在/root/program/apache-zookeeper-3.5.6-bin/conf/下新建zoo.cfg文件,填入以下内容:

initLimit=10
syncLimit=5
dataDir=/root/program/apache-zookeeper-3.5.6-bin/1.data
dataLogDir=/root/program/apache-zookeeper-3.5.6-bin/1.logs
clientPort=2181
server.1=192.168.244.100:20881:30881
server.2=192.168.244.101:20881:30881
server.3=192.168.244.102:20881:30881

5.在/root/program/apache-zookeeper-3.5.6-bin/下创建文件夹1.data。在1.data下创建myid文件,内容填入1.其他两台机器依次创建2.data,3.data,填入2,3。

6.在在/root/program/apache-zookeeper-3.5.6-bin/下分别创建1.logs,2.logs,3.logs。

7.三台都启动服务:zkServer.sh start
查看状态:zkServer.sh status
停止服务:zkServer.sh stop

你可能感兴趣的:(大数据,分布式,zookeeper)