标签:swa style code upgrade gdi ntp 模板 zookeeper 目标
#创建集群目录 mkdir /opt/cluster/zk cd /opt/cluster/zk #清理脏数据 docker stop zk-2191 docker stop zk-2192 docker stop zk-2193 docker rm zk-2191 docker rm zk-2192 docker rm zk-2193 #创建配置文件模板【vim zoo-cluster.tmpl】 cat >zoo-cluster.tmpl <<HERE clientPort=\${PORT} dataDir=/data dataLogDir=/datalog tickTime=2000 initLimit=5 syncLimit=2 maxClientCnxns=60 server.1=zk2191:2881:3881 server.2=zk2192:2882:3882 server.3=zk2193:2883:3883 HERE #生成conf和data目标,并生成配置信息 for port in `seq 2191 2193`; do mkdir -p ./${port}/conf && PORT=${port} envsubst < ./zoo-cluster.tmpl > ./${port}/conf/zoo.cfg && mkdir -p ./${port}/data && echo $[$port-2190] >./${port}/data/myid && mkdir -p ./${port}/datalog; done #创建3个zookeeper容器 for port in `seq 2191 2193`; do docker run -d -ti -p ${port}:${port} -p $[$port+690]:$[$port+690] -p $[$port+1690]:$[$port+1690] -v /opt/cluster/zk/${port}/conf:/conf -v /opt/cluster/zk/${port}/data:/data -v /opt/cluster/zk/${port}/datalog:/datalog --restart always --name zk-${port} --net bridge -m 100M --memory-swap=100M -h zk${port} --sysctl net.core.somaxconn=1024 zookeeper zkServer.sh start; done #其他 docker start zk-2191 docker start zk-2192 docker start zk-2193 for port in `seq 2191 2193`; do echo $[$port+690] && echo $[$port+1690]; done #创建配置文件 zoo.cfg /zookeeper-3.4.12/bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
标签:swa style code upgrade gdi ntp 模板 zookeeper 目标
原文地址:https://www.cnblogs.com/fhwup/p/9126851.html