Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Use shell script to view zookeeper cluster status

Shulou Source: shulou.com Published: 2022-06-03 05:55:32 11月23日 Update

Zooper cluster structure:

Hostname role

Node1 follower

Node2 leader

Node3 follower

Master observer

Content of the script:

#! / bin/bash

Function getstatus () {

# define a function

Exec 9/dev/tcp/$1/2181 2 > / dev/null

# Open the port read / write socket connection of host, and connect with the file descriptor 9

Echo stat > & 9

# send "stat" to socket connection

MODE=$ (cat

Tags: Scripts functions output clusters hosts locations contents variables data files spaces structures results roles channels status Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Technology Microsoft vpn Shulou Tech Info