启动
kafka-server-start.sh -daemon ../config/server.properties
创建主题
kafka-topics.sh –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic study
启动消费者
kafka-console-consumer.sh –bootstrap-server localhost:9092 –topic study –from-beginning
启动生产者
kafka-console-producer.sh –broker-list localhost:9092 –topic study
查看描述 topics 信息
kafka-topics.sh –describe –zookeeper localhost:2181 –topic study
集群配置
单机多实例配置
- 复制config/server.properties
- 修改配置 broker.id=2
listeners = PLAINTEXT://your.host.name:9093
log.dir=/data/kafka/logs-2 3. 启动不同的配置文件的实例
多机实例配置
修改配置文件:
zookeeper.connect=192.168.153.135:2181,192.168.153.136:2181,192.168.153.137:2181