美文网首页
kafka数据迁移

kafka数据迁移

作者: 空格键_尘 | 来源:发表于2020-06-30 21:09 被阅读0次

    迁移前:


    image.png

    编辑json文件:vi topics-to-move.json
    {"topics": [{"topic": "test-reassign"}],"version":1}

    执行语句

    bin/kafka-reassign-partitions.sh --zookeeper node1:2181,node2:2181,node3:2181 --topics-to-move-json-file topics-to-move.json --broker-list "1,2" --generate
    
    image.png

    编辑json文件: vi expand-cluster-reassignment.json
    {"version":1,"partitions":[{"topic":"test-reassign","partition":1,"replicas":[2,1],"log_dirs":["any","any"]},{"topic":"test-reassign","partition":0,"replicas":[1,2],"log_dirs":["any","any"]},{"topic":"test-reassign","partition":2,"replicas":[1,2],"log_dirs":["any","any"]}]}

    执行成功:

    bin/kafka-reassign-partitions.sh --zookeeper node1:2181,node2:2181,node3:2181 --reassignment-json-file expand-cluster-reassignment.json --execute
    
    image.png
    bin/kafka-reassign-partitions.sh --zookeeper node1:2181,node2:2181,node3:2181 --reassignment-json-file expand-cluster-reassignment.json --verify
    
    image.png

    对比:


    image.png

    实际物理位置:
    node1 节点没有test-reassign分区和副本 node1和node2都有


    image.png
    image.png
    image.png

    相关文章

      网友评论

          本文标题:kafka数据迁移

          本文链接:https://www.haomeiwen.com/subject/gsjfqktx.html