![]() |
1 year ago | |
---|---|---|
.vscode | 1 year ago | |
zook | 1 year ago | |
.gitignore | 1 year ago | |
docker-compose.yml | 1 year ago | |
readme.md | 1 year ago |
zookeeper、集群
docker-compose up
docker pull qtrj.i234.me:8084/centos
docker run -it qtrj.i234.me:8084/centos /bin/bash
docker cp /home/fy/workspaces/zookeeper/jdk-8u131-linux-x64.tar.gz 052aaa61228d:/root
tar -xvf jdk-8u131-linux-x64.tar.gz
配置java环境变量 vi /etc/profile
export JAVA_HOME=/root/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
测试
source /ect/profile
java -version
javac -version
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date
需要保证三台机器都的实践都统一
docker cp ./apache-zookeeper-3.6.2-bin.tar.gz 052aaa61228d:/root
tar -xvf apache-zookeeper-3.6.2-bin.tar.gz
复制默认配置文件,调整配置项
cp zoo_sample.cfg zoo.cfg
末尾添加:
server.1=node-1:2888:3888 #(2888是心跳端口,3888是选举端口)
server.2=node-2:2887:3887
server.3=node-3:2886:3886
设置数据目录:
mkdir /root/zkdata
设置节点编号:
echo 1 /root/zkdata/myid