In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Kafka cluster needs to log in to multiple servers every time it starts, which is troublesome. A batch management tool pssh is installed, ssh key-free login is configured, and a simple shell script is written to facilitate daily batch start-up and shutdown operations.
[root@kafka1 ~] # cat / usr/local/kafka/bin/kafka-daemons.sh #! / bin/bash # kafka start stop # date 2020.03.07 cat # [root@kafka1 ~] # cat / root/khost.txt # 192.168.180.21 "192.168.180.22" 192.168.180.2 "three hosts configure ssh key-free function zookeeper_start () {pssh-h khost.txt-I zkServer.sh startsleep 5pssh-h khost.txt-I jps} function zookeeper_stop () {pssh-h khost.txt-I zkServer.sh stopsleep 5pssh-h khost.txt-I jps} function zookeeper_status () {pssh-h khost.txt-I zkServer.sh status} function kafka_start () {pssh-h khost.txt-I kafka-server-start.sh-daemon / usr/local/kafka/config/server.propertiessleep 5pssh-h khost.txt-I jps} Function kafka_stop () {pssh-h khost.txt-I kafka-server-stop.shsleep 5pssh-h khost.txt-I jps} function kafka_status () {pssh-h khost.txt-I jps} echo-e "[1] start zookeeper [2] stop zookeeper [3] status zookeeper [4] start kafka [5] stop kafka [6] status kafka" read-p "please input install servers [1] | [2] | [3] | [5] | [6] |:" server_ Scase $server_s in 1) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) zookeeper_start ; *) exit esac;; 2) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) zookeeper_stop *) exit esac 3) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) zookeeper_status *) exit esac 4) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) kafka_start *) exit esac 5) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) kafka_stop *) exit esac 6) read-p "Please confirm your input [yes]:" confirm case $confirm in yes | YES | YEs | yEs | yeE) kafka_status *) exitesac;; *) echo-e "\ 033 [32 + 1m please input start or stop servers [1] | [2] | [3] | [4] | [5] | [6]!!\ 033 [0m" exitesac
Add execution permissions for the script
[root@kafka1 ~] # chmod 755 / usr/local/kafka/bin/kafka-daemons.sh
Start zookeeper
Start kafka
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.