zoukankan      html  css  js  c++  java
  • kafka集群下线broker节点实践方法(broker topic 迁移)

    [root@es03 ~]# cd /usr/hdp/2.6.4.0-91/kafka/bin
    [root@es03 kafka]# cd bi
    -bash: cd: bi: No such file or directory
    [root@es03 kafka]# cd bin
    [root@es03 bin]# ./kafka-topics.sh --describe --zookeeper 192.168.50.101:2181 --topic XcyEntity
    Topic:testXcyTopic      PartitionCount:2        ReplicationFactor:1     Configs:Topic:testXcyTopic      PartitionCount:2ReplicationFactor:1      Configs:
            Topic: testXcyTopic     Partition: 0    Leader: 1001    Replicas: 1001  Isr: 1001
            Topic: testXcyTopic     Partition: 1    Leader: 1003    Replicas: 1003  Isr: 1003
    [root@es03 bin]# ./kafka-reassign-partitions.sh --zookeeper 192.168.50.101:2181 --topics-to-move-json-file /root/topics-to-move.json --broker-list "1003,1004" --generate
    Current partition replica assignment
    
    {"version":1,"partitions":[{"topic":"testXcyTopic","partition":1,"replicas":[1003]},{"topic":"testXcyTopic","partition":0,"replicas":[1001]}]}
    Proposed partition reassignment configuration
    
    {"version":1,"partitions":[{"topic":"testXcyTopic","partition":1,"replicas":[1003]},{"topic":"testXcyTopic","partition":0,"replicas":[1004]}]}
    [root@es03 bin]# vi /root/reassignment-node.json 
    {"version":1,"partitions":[{"topic":"testXcyTopic","partition":1,"replicas":[1003]},{"topic":"testXcyTopic","partition":0,"replicas":[1004]}]}
    ~
    
    
    
    [root@es03 bin]# ./kafka-reassign-partitions.sh --zookeeper 192.168.50.101:2181 --reassignment-json-file /root/reassignment-node.json  --execute
    Current partition replica assignment
    
    {"version":1,"partitions":[{"topic":"testXcyTopic","partition":1,"replicas":[1003]},{"topic":"testXcyTopic","partition":0,"replicas":[1001]}]}
    
    Save this to use as the --reassignment-json-file option during rollback
    Successfully started reassignment of partitions.
    [root@es03 bin]# ./kafka-reassign-partitions.sh --zookeeper 192.168.50.101:2181 --reassignment-json-file /root/reassignment-node.json  --verify
    Status of partition reassignment: 
    Reassignment of partition [testXcyTopic,1] completed successfully
    Reassignment of partition [testXcyTopic,0] completed successfully
    [root@es03 bin]# ./kafka-topics.sh --describe --zookeeper 192.168.50.101:2181 --topic XcyEntity
    Topic:testXcyTopic      PartitionCount:2        ReplicationFactor:1     Configs:
            Topic: testXcyTopic     Partition: 0    Leader: 1004    Replicas: 1004  Isr: 1004
            Topic: testXcyTopic     Partition: 1    Leader: 1003    Replicas: 1003  Isr: 1003
    [root@es03 bin]# timed out waiting for input: auto-logout
  • 相关阅读:
    第六天学习:Python数据类型(二)
    第五天学习:python数据类型(一)
    第四天学习:运算符
    第一天学习:python的安装及helloworld
    第二十五天学习:mysql(二)
    第二十四天学习:mysql(一)
    第二十三天学习:正则(2)
    第二十二天学习:正则
    第二十一天学习:模块(三)json
    第二十天学习:模块(二)
  • 原文地址:https://www.cnblogs.com/shanhua-fu/p/10416424.html
Copyright © 2011-2022 走看看