tar -xzvf zookeeper-3.4.11.tar.gz
/opt/zookeeper-3.4.12
配置环境变量
vim /etc/profilve
# 添加如下内容
export ZOOKEEPER_HOME = /opt/zookeeper-3.4.12
export PATH = $PATH:$ZOOKEEPER_HOME/bin
配置zookeeper集群,修改配置文件
cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg
# 5.1 在zoo.cfg 文件末尾追加(zoo1 为 服务器名称)
# 具体配置见:http://zookeeper.apache.org/doc/r3.4.11/zookeeperStarted.html#sc_RunningReplicatedZooKeeper
tickTime=2000
dataDir=/opt/data/zookeeper # 数据存放路径
clientPort=2181
initLimit=5
syncLimit=2
server.1=node2:2888:3888
server.2=node3:2888:3888
server.3=node4:2888:3888
将配置文件复制到其他节点
scp /opt/zookeeper/conf/zoo.cfg node2:/opt/zookeeper/conf/
创建节点ID,在配置的 dataDir 路径中添加myid文件
cho "1" > myid
1. 启动ZK服务: sh bin/zkServer.sh start
2. 查看ZK服务状态: sh bin/zkServer.sh status
3. 停止ZK服务: sh bin/zkServer.sh stop
4. 重启ZK服务: sh bin/zkServer.sh restart
docker run -itd --name hadoopM --privileged=true --net hadoopnetwork --ip 172.18.0.11 centos7ssh:v2 /usr/sbin/init
docker run -itd --name hadoopS --privileged=true --net hadoopnetwork --ip 172.18.0.12 centos7ssh:v2 /usr/sbin/initdocker run -itd --name hadoopL --privileged=true --net hadoopnetwork --ip 172.18.0.13 centos7ssh:v2 /usr/sbin/init
docker run -itd --name hadoopA --privileged=true --net hadoopnetwork --ip 172.18.0.14 centos7ssh:v2 /usr/sbin/init
MASTER --主
SLAVE --从
scp ~/.ssh/id_rsa.pub root@172.18.0.12:~/.ssh/id_rsa.pub
scp ~/.ssh/id_rsa.pub root@192.168.30.251:~/.ssh
scp id_rsa.pub root@172.18.0.11:~/.ssh/authorized_keys12
scp id_rsa.pub root@172.18.0.11:~/.ssh/authorized_keys13
scp id_rsa.pub root@172.18.0.11:~/.ssh/authorized_keys14
docker run -h hadoopM -v /etc/hosts:/etc/hosts -itd --name hadoopM --privileged=true --net hadoopnetwork --ip 172.18.0.11 centos7ssh:v2 /usr/sbin/init
docker run -h hadoopS -v /etc/hosts:/etc/hosts -itd --name hadoopS --privileged=true --net hadoopnetwork --ip 172.18.0.12 centos7ssh:v2 /usr/sbin/init
docker run -h hadoopL -v /etc/hosts:/etc/hosts -itd --name hadoopL --privileged=true --net hadoopnetwork --ip 172.18.0.13 centos7ssh:v2 /usr/sbin/init
docker run -h hadoopA -v /etc/hosts:/etc/hosts -itd --name hadoopA --privileged=true --net hadoopnetwork --ip 172.18.0.14 centos7ssh:v2 /usr/sbin/init
docker run -h hadoopV -v /etc/hosts:/etc/hosts -itd --name hadoopV --privileged=true --net hadoopnetwork --ip 172.18.0.15 centos7ssh:v2 /usr/sbin/init
上传文件
docker cp opt/ e0a4ee0c987c:/home/wangqing/optdocker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
下载文件
docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp ecef8319d2c8:/root/test.txt /root/