该脚本zk.sh为
#!/bin/bash case $1 in "start"){ for i in node1 node2 node3 do echo ---------------------- zookeeper $i 启动 --------- ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh start" done } ;; "stop"){ for i in node1 node2 node3 do echo ---------------------- zookeeper $i 停止 --------- ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh stop" done } ;; "status"){ for i in node1 node2 node3 do echo ---------------------- zookeeper $i 状态 --------- ssh $i "/export/server/zookeeper-3.5.7/bin/zkServer.sh status" done } ;; esac
然后启动的时候出现了问题
经排查发现了问题
一开始Linux安装完jdk,配置环境变量配置在了/etc/profile中,但这样会在免密远程操控出现问题,导致发现不了Java路径
解决办法是在/etc/profile.d/my_env.sh中配置一边Java环境变量
标签:bin,zookeeper,一键,echo,export,sh,3.5,编写 From: https://www.cnblogs.com/nian-nian/p/16712738.html