kafka深度研究之路(3)-kafka與zk集群?jiǎn)⑼D_本

編寫 kafka集群 啟動(dòng) 和 停止腳本

成都創(chuàng)新互聯(lián)是專業(yè)的洛南網(wǎng)站建設(shè)公司,洛南接單;提供成都網(wǎng)站建設(shè)、網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行洛南網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!

[hadoop@kafka01-55-11 scripts]$ cat kafka_cluster_stop.sh
#!/bin/bash -x
#date 20190801
#autnor majihui

clush -g all "source /etc/profile ;jps|grep Kafka|awk '{print $1}' | xargs kill -9 "

[hadoop@kafka01-55-11 scripts]$ cat kafka_cluster_start.sh    
#!/bin/bash -x
#author majihui
#date 20190801

clush -g all "source /etc/profile ;jps|grep Kafka|awk '{print $1}' | xargs kill -9 "
sleep 3
clush -g all "source /etc/profile;/home/hadoop/kafka/bin/kafka-server-start.sh -daemon /home/hadoop/kafka/config/server.properties"

他的輸出日志 在

[hadoop@kafka01-55-11 scripts]$ ls -l ~/kafka/logs/
total 164
-rw-rw-r-- 1 hadoop hadoop   316 Aug  2 17:25 controller.log
-rw-rw-r-- 1 hadoop hadoop     0 Aug  2 17:25 kafka-authorizer.log
-rw-rw-r-- 1 hadoop hadoop     0 Aug  2 17:25 kafka-request.log
-rw-rw-r-- 1 hadoop hadoop  6123 Aug  2 17:25 kafkaServer-gc.log.0.current
-rw-rw-r-- 1 hadoop hadoop 54058 Aug  2 17:25 kafkaServer.out
-rw-rw-r-- 1 hadoop hadoop   172 Aug  2 17:25 log-cleaner.log
-rw-rw-r-- 1 hadoop hadoop 54058 Aug  2 17:25 server.log
-rw-rw-r-- 1 hadoop hadoop 33737 Aug  2 17:25 state-change.log

[hadoop@kafka01-55-11 scripts]$ cat /etc/clustershell/groups
all: kafka01-55-11 kafka02-55-12 kafka03-55-13
kafka_slave: kafka02-55-12 kafka03-55-13

zookeeper 啟動(dòng)和停止腳本

[hadoop@kafka01-55-11 scripts]$ cat zookeeper_cluster_stop.sh 
#!/bin/bash -x
#author:majihui
#date:20190801

clush -g all  "source /etc/profile; zkServer.sh stop"
[hadoop@kafka01-55-11 scripts]$ cat zookeeper_cluster_start.sh      // 這里面指定了zookeeper.out 輸出到 /data/zookeeper/data/zookeeper.out 
#!/bin/bash -x
#author:majihui
#date:20190801

clush -g all  "source /etc/profile; cd /data/zookeeper/data && zkServer.sh start|sort"
sleep 3
clush -g all  "source /etc/profile; zkServer.sh status|sort"
[hadoop@kafka03-55-13 ] pwd
/data/zookeeper/data
[hadoop@kafka03-55-13 data]$ ll
total 20
-rw-rw-r-- 1 hadoop hadoop     2 Aug  1 01:04 myid
drwxrwxr-x 2 hadoop hadoop    45 Aug  1 01:33 version-2
-rw-rw-r-- 1 hadoop hadoop 11623 Aug  1 01:33 zookeeper.out
-rw-rw-r-- 1 hadoop hadoop     5 Aug  1 01:33 zookeeper_server.pid

[hadoop@kafka01-55-11 scripts]$ cat jps_cluster_check.sh 
#!/bin/bash

clush -g all "source /etc/profile;jps|sort"

以上啟動(dòng)腳本 編寫完成
需要結(jié)合與clush

[hadoop@kafka01-55-11 scripts]$ cat /etc/clustershell/groups
all: kafka01-55-11 kafka02-55-12 kafka03-55-13
kafka_slave: kafka02-55-12 kafka03-55-13
[hadoop@kafka01-55-11 scripts]$ ll
total 28
-rw-rw-r-- 1 hadoop hadoop  57 Aug  1 15:01 jps_cluster_check.sh
-rw-rw-r-- 1 hadoop hadoop 312 Aug  1 14:51 kafka_cluster_start.sh
-rw-rw-r-- 1 hadoop hadoop 132 Aug  1 14:43 kafka_cluster_stop.sh
-rw-rw-r-- 1 hadoop hadoop 291 Aug  1 14:23 start_kafka_manager.sh
-rw-rw-r-- 1 hadoop hadoop 286 Aug  1 14:28 stop_kafka_manager.sh
-rw-rw-r-- 1 hadoop hadoop 176 Aug  1 14:57 zookeeper_cluster_start.sh
-rw-rw-r-- 1 hadoop hadoop 101 Aug  1 14:56 zookeeper_cluster_stop.sh
[hadoop@kafka01-55-11 scripts]$ chmod +x *sh
[hadoop@kafka01-55-11 scripts]$ ll
total 28
-rwxrwxr-x 1 hadoop hadoop  57 Aug  1 15:01 jps_cluster_check.sh
-rwxrwxr-x 1 hadoop hadoop 312 Aug  1 14:51 kafka_cluster_start.sh
-rwxrwxr-x 1 hadoop hadoop 132 Aug  1 14:43 kafka_cluster_stop.sh
-rwxrwxr-x 1 hadoop hadoop 291 Aug  1 14:23 start_kafka_manager.sh
-rwxrwxr-x 1 hadoop hadoop 286 Aug  1 14:28 stop_kafka_manager.sh
-rwxrwxr-x 1 hadoop hadoop 176 Aug  1 14:57 zookeeper_cluster_start.sh
-rwxrwxr-x 1 hadoop hadoop 101 Aug  1 14:56 zookeeper_cluster_stop.sh

網(wǎng)站標(biāo)題:kafka深度研究之路(3)-kafka與zk集群?jiǎn)⑼D_本
轉(zhuǎn)載源于:http://muchs.cn/article46/igeihg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管云服務(wù)器、外貿(mào)建站網(wǎng)站制作、定制網(wǎng)站、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司