监控zookeeper

[4ajr@db1 scripts]$ cat zookeeper_mode.sh

#!/bin/bash

mode=`echo srvr|nc 127.0.0.1 2181|awk '/Mode/{print $2}'`

if [[ "$mode" == "follower" ]] ; then

echo 1

elif [[ "$mode" == "leader" ]] ; then

echo 2

else

echo 0

fi

[4ajr@db1 scripts]$ ./zookeeper_mode.sh

2

[4ajr@db1 scripts]$ cat zookeeper_status.sh

#!/bin/bash

zk=`echo ruok|nc 127.0.0.1 2181`

if [[ "$zk" == "imok" ]] ; then

echo 1

else

echo 0

fi

[4ajr@db1 scripts]$ echo ruok|nc 127.0.0.1 2181

imok[4ajr@db1 scripts]$ ./zookeeper_status.sh

1

上一篇:Java微信公众平台开发之获取地理位置


下一篇:js数组遍历方法总结