centos7安装kafka
参考自: https://www.mtyun.com/library/how-to-install-kafka-on-centos7(含单机多broker集群配置)环境:jdk1.8kafka2.11centos7启动前请确保装好了jdk1.8和zookeeper。安装教程分别如下:jdk安装教程:https://blog.csdn.net/...
·
参考自: https://www.mtyun.com/library/how-to-install-kafka-on-centos7(含单机多broker集群配置)
环境:
-
jdk1.8
-
kafka2.11
-
centos7
启动前请确保装好了jdk1.8和zookeeper。安装教程分别如下:
jdk安装教程:https://blog.csdn.net/qq_28666081/article/details/81629764
zookeeper安装教程:https://blog.csdn.net/qq_28666081/article/details/83099645
执行如下指令:
# wget http://mirror.bit.edu.cn/apache/kafka/2.2.1/kafka_2.11-2.2.1.tgz
# tar zxvf kafka_2.11-2.2.1.tgz
# mv kafka_2.11-2.2.1 kafka
# cd kafka
启动kafka服务
# nohup bin/kafka-server-start.sh config/server.properties &
创建topic
# bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看topic
# bin/kafka-topics.sh --list --zookeeper localhost:2181
以上就装好了kafka,接下来用它自带的脚本来进行测试:
使用kafka-console-producer.sh 发送消息
# bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
使用kafka-console-consumer.sh消费消息
# bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
更多推荐
已为社区贡献1条内容
所有评论(0)