ubuntu上kafka的配置与使用(一)--单机kafka的配置

0.安装java环境html

能够参考另外一篇文章:https://www.cnblogs.com/codedoge/p/10101580.htmljava

1.下载kafka(我下载的是2.11-2.1.0版本)apache

wget https://mirrors.cnnic.cn/apache/kafka/2.1.0/kafka_2.11-2.1.0.tgz

2.解压bootstrap

tar -xzvf kafka_2.11-2.1.0.tgz

3.进入kafka的conf目录,修改相关配置文件spa

修改server.propertiescode

4.启动zookeeperserver

./bin/zookeeper-server-start.sh ./config/zookeeper.properties

5.新开一个控制台,启动kafkahtm

./bin/kafka-server-start.sh ./config/server.properties

6.新开一个控制台,建立topicblog

./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

7.查看topic列表get

./bin/kafka-topics.sh --list --zookeeper localhost:2181

8.建立生产者

./bin/kafka-console-producer.sh --broker-list 10.1.3.xxx:9092 --topic test

9.新建窗口,建立消费者

#0.9版本以前:
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
#0.9版本以后:
./bin/kafka-console-consumer.sh --bootstrap-server 10.1.3.xxx:9092 --topic test --from-beginning
相关文章
相关标签/搜索