kafka的常规操作命令
作者:互联网
kafka修改保留时间
kafka-configs --zookeeper dbos-bigdata-tools001:2181,dbos-bigdata-tools002:2181,dbos-bigdata-tools003:2181 --entity-type topics --entity-name test_sony_boot_play --alter --add-config retention.ms=86400000
查看topic
kafka-topics --zookeeper dbos-bigdata-tools001:2181,dbos-bigdata-tools002:2181,dbos-bigdata-tools003:2181 --describe --topic test_dbyy_init
查看offsets
kafka-topics --describe --zookeeper dbos-bigdata-tools001:2181,dbos-bigdata-tools002:2181,dbos-bigdata-tools003:2181 | grep consumer_offsets
创建topic
kafka-topics --zookeeper dbos-bigdata-tools001:2181,dbos-bigdata-tools002:2181,dbos-bigdata-tools003:2181 --create --partitions 4 --replication-factor 1 --topic steven
新增加分区
kafka-topics --zookeeper dbos-bigdata-test003:2181,dbos-bigdata-test004:2181,dbos-bigdata-test005:2181/kafka --alter --partitions 6 --topic steven
新增副本
kafka-reassign-partitions --zookeeper dbos-bigdata-test003:2181,dbos-bigdata-test004:2181,dbos-bigdata-test005:2181/kafka --reassignment-json-file increase-replication-factor.json --execute
先创建以下json文件在执行
{"version":1,
"partitions":[
{"topic":"steven","partition":0,"replicas":[172,173,174]},
{"topic":"steven","partition":1,"replicas":[173,174,172]},
{"topic":"steven","partition":2,"replicas":[174,172,173]},
{"topic":"steven","partition":3,"replicas":[172,173,174]},
{"topic":"steven","partition":4,"replicas":[173,174,172]},
{"topic":"steven","partition":5,"replicas":[174,172,173]}
]
}
了解更多大数据培训课程相关技术知识欢迎关注小编!
标签:操作命令,--,bigdata,常规,kafka,topic,2181,steven,dbos 来源: https://www.cnblogs.com/majhw/p/15503006.html