This article is adapted to suit itself according to [1], and the final code is as follows:
test.sh
#!/bin/sh
echo "zookeeper start 128,129,130"
ssh Desktop "source /home/appleyuchi/.bashrc;$ZOOKEEPER/bin/zkServer.sh start $ZOOKEEPER/conf/zoo_leader.cfg"
ssh Laptop "source /home/appleyuchi/.bashrc;$ZOOKEEPER/bin/zkServer.sh start $ZOOKEEPER/conf/zoo_follower2.cfg"
ssh Laptop "source /home/appleyuchi/.bashrc;$ZOOKEEPER/bin/zkServer.sh start $ZOOKEEPER/conf/zoo_follower3.cfg"
chmod u+x test.sh
./test.sh
Then jps goes to each node to see if there is
QuorumPeerMain process can be.
--------------------supplement----------------------------
Similar operations can also be performed for starting a Kafka cluster
Reference:
[1] Write a shell script to start the zookeeper cluster with one click!!