1.安装kafka
下载地址 : https://www.apache.org/dyn/closer.cgi?path=/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz
rz tar zxf kafka_2.11-0.9.0.0.tgz mv kafka_2.11-0.9.0.0 /usr/local/kafka
2.启停
/usr/local/kafka/bin/kafka-server-stop.sh /usr/local/kafka/config/server.properties /usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties & jps 2695 QuorumPeerMain # ZooKeeper 守护进程 6268 Kafka # Kafka 守护进程 6553 Jps
3.以上是"单节点 & 单代理"配置
4.简单修改配置
cd /usr/local/kafka vim config/server.properties ------------- advertised.host.name=10.1.44.187 -------------
5.创建和删除topic
# 创建topic bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic HelloWorld # 删除 bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic HelloWorld # 查看已有topic bin/kafka-topics.sh --list --zookeeper localhost:2181
6.开启2个窗口进行生产和消费测试
# 生产 /usr/local/kafka/bin/kafka-console-producer.sh --broker-list 10.1.44.187:9092 --topic HelloWorld # 消费 /usr/local/kafka/bin/kafka-console-consumer.sh --zookeeper 10.1.44.187:2181 --topic HelloWorld --from-beginning
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。