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

溫馨提示×

溫馨提示×

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

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

kafka集群安裝及管理(二)

發布時間:2020-07-08 09:59:07 來源:網絡 閱讀:884 作者:一語成讖灬 欄目:大數據

一、broker的遷移

1.查看zookeeper和kafka啟動情況

[root@slave1 ~]# pssh -h hostlist -i 'jps'
[1] 22:08:11 [SUCCESS] 20.0.5.12
3492 QuorumPeerMain
8140 Jps
6414 Kafka
[2] 22:08:11 [SUCCESS] 20.0.5.13
3490 QuorumPeerMain
4972 Kafka
22972 Jps
[3] 22:08:11 [SUCCESS] 20.0.5.11
7369 QuorumPeerMain
23754 Jps
11534 Kafka
[4] 22:08:11 [SUCCESS] 20.0.5.14
21263 Jps
[5] 22:08:11 [SUCCESS] 20.0.5.15
20818 Jps

2.創建一個topic

[root@slave1 ~]# /opt/kafka/bin/kafka-topics.sh --create --zookeeper 20.0.5.11:2181 --replication-factor 3 --partitions 3 --topic topic1
Created topic "topic1".
[root@slave1 ~]# /opt/kafka/bin/kafka-topics.sh --describe --zookeeper 20.0.5.11:2181 --topic topic1
Topic:topic1	PartitionCount:3	ReplicationFactor:3	Configs:
	Topic: topic1	Partition: 0	Leader: 1	Replicas: 1,3,2	Isr: 1,3,2
	Topic: topic1	Partition: 1	Leader: 2	Replicas: 2,1,3	Isr: 2,1,3
	Topic: topic1	Partition: 2	Leader: 3	Replicas: 3,2,1	Isr: 3,2,1

3.在要遷移的節點上啟動kafka進程

[root@slave1 ~]# pssh -h hostlist '/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties > /root/kafka.log 2>1&'
[1] 22:17:21 [SUCCESS] 20.0.5.12
[2] 22:17:21 [SUCCESS] 20.0.5.11
[3] 22:17:21 [SUCCESS] 20.0.5.13
[4] 22:17:21 [SUCCESS] 20.0.5.14
[5] 22:17:21 [SUCCESS] 20.0.5.15
[root@slave1 ~]# pssh -h hostlist -i 'jps'
[1] 22:17:29 [SUCCESS] 20.0.5.12
3492 QuorumPeerMain
8461 Jps
6414 Kafka
[2] 22:17:29 [SUCCESS] 20.0.5.14
21298 Kafka
21609 Jps
[3] 22:17:29 [SUCCESS] 20.0.5.11
7369 QuorumPeerMain
24844 Jps
11534 Kafka
[4] 22:17:29 [SUCCESS] 20.0.5.13
3490 QuorumPeerMain
4972 Kafka
23292 Jps
[5] 22:17:29 [SUCCESS] 20.0.5.15
20854 Kafka
21165 Jps

4.創建需要遷移的topic的json文件

[root@slave1 ~]# cat topic_move.json
{"topics": [{"topic": "topic1"}],
"version":1
}

5.生成遷移規則

[root@slave1 ~]# /opt/kafka/bin/kafka-reassign-partitions.sh --zookeeper 20.0.5.11:2181 --topics-to-move-json-file topic_move.json --broker-list "3,4,5" --generate
Current partition replica assignment
{"version":1,"partitions":[{"topic":"topic1","partition":1,"replicas":[2,1,3],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":0,"replicas":[1,3,2],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":2,"replicas":[3,2,1],"log_dirs":["any","any","any"]}]}

Proposed partition reassignment configuration
{"version":1,"partitions":[{"topic":"topic1","partition":1,"replicas":[5,3,4],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":0,"replicas":[4,5,3],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":2,"replicas":[3,4,5],"log_dirs":["any","any","any"]}]}

6.將生成的數據寫入新的json文件

[root@slave1 ~]# cat re_node.json
{"version":1,"partitions":[
{"topic":"topic1","partition":1,"replicas":[5,3,4],"log_dirs":["any","any","any"]},
{"topic":"topic1","partition":0,"replicas":[4,5,3],"log_dirs":["any","any","any"]},
{"topic":"topic1","partition":2,"replicas":[3,4,5],"log_dirs":["any","any","any"]}]
}

7.開始遷移

[root@slave1 ~]# /opt/kafka/bin/kafka-reassign-partitions.sh --zookeeper 20.0.5.11:2181 --reassignment-json-file re_node.json --execute
Current partition replica assignment

{"version":1,"partitions":[{"topic":"topic1","partition":1,"replicas":[2,1,3],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":0,"replicas":[1,3,2],"log_dirs":["any","any","any"]},{"topic":"topic1","partition":2,"replicas":[3,2,1],"log_dirs":["any","any","any"]}]}

Save this to use as the --reassignment-json-file option during rollback
Successfully started reassignment of partitions.
[root@slave1 ~]# /opt/kafka/bin/kafka-reassign-partitions.sh --zookeeper 20.0.5.11:2181 --reassignment-json-file re_node.json --verify
Status of partition reassignment:
Reassignment of partition topic1-1 completed successfully
Reassignment of partition topic1-0 completed successfully
Reassignment of partition topic1-2 completed successfully

8.查看新的分區

[root@slave1 ~]# /opt/kafka/bin/kafka-topics.sh --describe --zookeeper 20.0.5.11:2181 --topic topic1
Topic:topic1	PartitionCount:3	ReplicationFactor:3	Configs:
	Topic: topic1	Partition: 0	Leader: 4	Replicas: 4,5,3	Isr: 5,3,4
	Topic: topic1	Partition: 1	Leader: 5	Replicas: 5,3,4	Isr: 5,3,4
	Topic: topic1	Partition: 2	Leader: 3	Replicas: 3,4,5	Isr: 5,3,4

#遷移完后修改好producer和consumer指向新的連接后再停止舊的服務


向AI問一下細節

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

AI

柘城县| 兴国县| 宿州市| 冷水江市| 黔江区| 四会市| 乌海市| 墨玉县| 济阳县| 延川县| 慈利县| 布尔津县| 赤峰市| 乐昌市| 班戈县| 英吉沙县| 浮梁县| 澄迈县| 南京市| 靖安县| 嵊州市| 蓬莱市| 常山县| 冷水江市| 南丹县| 如皋市| 稷山县| 西宁市| 裕民县| 黔西县| 莆田市| 唐山市| 西平县| 宜兰市| 东莞市| 榆社县| 项城市| 格尔木市| 德化县| 遂宁市| 香港|