Zookeeper rallied script fails to start and view the status appears:. Error contacting service It is probably not running

1. Problem:

Rallied after the script starts to view jps does not appear: QuorumPeerMain

Zookeeper normal start but rallied script check status appears:. Error contacting service It is probably not running error

ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.4.10/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

2. Cause:

Script does not add source / etc / profile;

3. :( proper script for reference only, please correct me)

#! /bin/bash

case $1 in
"start"){
        for i in hadoop201 hadoop202 hadoop203
        do
                ssh $i "source /etc/profile;/opt/module/zookeeper-3.4.10/bin/zkServer.sh start"
        done
};;
"stop"){
        for i in hadoop201 hadoop202 hadoop203
        do
                ssh $i "/opt/module/zookeeper-3.4.10/bin/zkServer.sh stop"
        done
};;
"status"){
        for i in hadoop201 hadoop202 hadoop203
        do
                ssh $i "source /etc/profile;/opt/module/zookeeper-3.4.10/bin/zkServer.sh status"
        done
};;
esac

 

Guess you like

Origin www.cnblogs.com/MWCloud/p/11445835.html