写了shell脚本想一键启动三台虚拟机的Zookeeper,却不知道为啥总是启动不了
首先,一键启动的shell脚本是这样的
#! /bin/bash case $1 in "start"){ for i in node01 node02 node03 do ssh $i "/opt/module/zookeeper-3.4.5-cdh5.14.0/bin/zkServer.sh start" done };; "stop"){ for i in node01 node02 node03 do ssh $i "/opt/module/zookeeper-3.4.5-cdh5.14.0/bin/zkServer.sh stop" done };; esac
然后,zk.sh start
启动,发现只有
[root@node01 ~]# zk.sh start JMX enabled by default Using config: /opt/module/zookeeper-3.4.5-cdh5.14.0/bin/…/conf/zoo.cfg Starting zookeeper … STARTED JMX enabled by default Using config: /opt/module/zookeeper-3.4.5-cdh5.14.0/bin/…/conf/zoo.cfg Starting zookeeper … STARTED JMX enabled by default Using config: /opt/module/zookeeper-3.4.5-cdh5.14.0/bin/…/conf/zoo.cfg Starting zookeeper … STARTED
是显示启动了,但是jps一查看啥也没有,最骚的是,它stop的命令可以执行…
经过一天的各种谷歌…首先,我找到三篇宝藏
https://scottlinux.com/2012/03/07/troubleshooting-ssh-server-logs-and-error-messages/
https://www.centos.bz/2017/08/ssh-connect-failed-solve-experience/
https://note.t4x.org/other/didnot-receive-identification-string-from/
但是对我完成并没啥用,最后阴差阳错拿到了一个办法…竟然有用
三台虚拟机都执行以下
cat /etc/profile >> ~/.bashrc
记得看一下有没有把配置环境变量的加到里面
vim ~./bashrc