笔记篇---集群启动shell脚本编写

编写shell脚本启动zk集群or redis集群

先去到伪zk集群的文件夹付所在目录

1
2
3
touch zkStartAll.sh

vi ./zkStartAll.sh

编写内容,其实就是依次进入文件夹启动单机实例

1
2
3
4
5
6
cd /usr/local/zookeeper1/bin
./zkServer.sh start
cd /usr/local/zookeeper2/bin
./zkServer.sh start
cd /usr/local/zookeeper3/bin
./zkServer.sh start

给文件授权,运行文件

1
2
3
chmod u+wxr startAllZk.sh

./startAllZk.sh

结果就是集群成功启动

1
2
3
4
5
6
7
8
9
10
[root@nginxslaver local]# ./startAllZk.sh
JMX enabled by default
Using config: /usr/local/zookeeper1/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
JMX enabled by default
Using config: /usr/local/zookeeper2/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
JMX enabled by default
Using config: /usr/local/zookeeper3/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

redis伪集群启动方式类似

用来记录项目中需要配置但是容易忘记的一些记录

Slogan:学过几年技术,尘世间一枚不起眼的迷途小书童