这是系列搭建springcloud基础框架的文章,内容包括集成shiro、Mysql主从、seata、activiti、drools、hadoop大数据常用组件、keepalive+nginx https配置等;
参考:https://blog.csdn.net/fanxin1000/article/details/129327335
master:
cd /root/bigdatas/softs
tar -xzvf apache-zookeeper-3.6.1-bin.tar.gz -C /usr/local/
mv apache-zookeeper-3.6.1 zookeeper
vi ~/.bashrc
export ZK_HOME=/usr/local/zookeeper
export PATH=$ZK_HOME/bin:$PATH
cp /conf/zoo_sample.cfg zoo.cfg
vi zoo.cfg
dataDir=/tmp/zookeeper/zkdata
dataLogDir=/tmp/zookeeper/zkdatalog
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
mkdir -p /tmp/zookeeper/{zkdata,zkdatalog}
拷贝/usr/local/zookeeper 到 slavex
scp zookeeper/ slave1:/usr/local/
scp zookeeper/ slave1:/usr/local/
设置 myid
echo “1” > /tmp/zookeeper/zkdata/myid
===========
转到 slavex, 同样配置 zookeeper 环境变量 .bashrc
设置 myid:
slave1: echo “2” > /tmp/zookeeper/zkdata/myid
slave2: echo “3” > /tmp/zookeeper/zkdata/myid
==========
master,slave1, slave2 分别执行 zkServer.sh start
再依资看下状态 , zkServer.sh status
关闭为:zkServer.sh stop
问题:Starting zookeeper … already running as process 856.
用命令rm zookeeper-server.pid 删除zookeeper-server.pid文件,然后启动zookeeper服务(zkServer.sh start)就好了。这个问题是由于 服务器异常关闭所致。