kafka基本操作(二) linux环境下多个broker

kafka基本操作(二) linux环境下多个broker

1.设置配置文件:
为每个broker设置单独的配置文件

//cd进入kafka解压目录,输入
[root@localhost kafka_2.11-1.1.0]# cd config/
//进入config后输入
[root@localhost config]# cp server.properties server-1.properties 
[root@localhost config]# cp server.properties server-2.properties 

2.修改配置文件:

//修改server-1.properties 
broker.id=1
port=9093
log.dirs=/tmp/kafka-logs-1
//修改server-2.properties 
broker.id=2
port=9094
log.dirs=/tmp/kafka-logs-2

3.启动服务:

//cd进入kafka解压目录,输入
[root@localhost kafka_2.11-1.1.0]# ./bin/kafka-server-start.sh config/server-1.properties 
[root@localhost kafka_2.11-1.1.0]# ./bin/kafka-server-start.sh config/server-2.properties 

4.新建一个topic:

//cd进入kafka解压目录,输入
[root@localhost kafka_2.11-1.1.0]# ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic test02

5.查看新建的topic:

//cd进入kafka解压目录,输入
[root@localhost kafka_2.11-1.1.0]# ./bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test02

效果图
对比一下开始新建的topic:
效果图

猜你喜欢

转载自blog.csdn.net/csdn565973850/article/details/79995115