91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

kafka怎樣實現批量啟動和關閉腳本?

發布時間:2020-05-23 16:31:55 來源:億速云 閱讀:190 作者:鴿子 欄目:系統運維

kafka集群每次啟動都需要登錄多臺服務器操作,比較麻煩,安裝了一個批量管理工具pssh,配置了ssh免秘鑰登錄,寫了一個簡單的shell腳本方便日常的批量啟動、關閉操作。

[root@kafka1 ~]# cat /usr/local/kafka/bin/kafka-daemons.sh 
#!/bin/bash 
#kafka start stop 
#date 2020.03.07



###########################
#[root@kafka1 ~]# cat /root/khost.txt 
#192.168.180.21
#192.168.180.22
#192.168.180.23
#三臺主機配置ssh免秘鑰



function zookeeper_start(){
pssh -h khost.txt -i zkServer.sh start
sleep 5
pssh -h khost.txt -i jps
}

function zookeeper_stop(){
pssh -h khost.txt -i zkServer.sh stop
sleep 5
pssh -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.properties
sleep 5
pssh -h khost.txt -i jps
}

function kafka_stop(){
pssh -h khost.txt -i kafka-server-stop.sh
sleep 5
pssh -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]|[4]|[5]|[6]|:" server_s
case $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
                                        ;;
                                        *)
                                        exit
        esac
    ;;
    *)
    echo -e "\033[32;1m please input start or stop servers[1]|[2]|[3]|[4]|[5]|[6]!!!\033[0m"
    exit
esac


添加腳本的執行權限

[root@kafka1 ~]# chmod 755 /usr/local/kafka/bin/kafka-daemons.sh

啟動zookeeper

kafka怎樣實現批量啟動和關閉腳本?

啟動kafka

kafka怎樣實現批量啟動和關閉腳本?

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

漳平市| 庄浪县| 二连浩特市| 扬中市| 阜平县| 共和县| 达孜县| 正安县| 营口市| 永吉县| 阿城市| 独山县| 高邮市| 蓬溪县| 星座| 肥城市| 阿克陶县| 额济纳旗| 临泉县| 凤凰县| 小金县| 中超| 手机| 吴忠市| 玛曲县| 乌鲁木齐市| 都昌县| 盐边县| 黄梅县| 阳山县| 宁都县| 新巴尔虎右旗| 盘山县| 桃园县| 余庆县| 天等县| 绍兴市| 玛沁县| 东至县| 五峰| 衡山县|