安装 ifconfig 这样的命令
yum -y install net-tools
在外部访问CentOS中部署应用时,需要关闭防火墙。
关闭防火墙命令:systemctl stop firewalld.service
开启防火墙:systemctl start firewalld.service
关闭开机自启动:systemctl disable firewalld.service
开启开机启动:systemctl enable firewalld.service
从下边正式开始
yum -y install wget
安装 kafka
1,wget 路径
wget http://mirror.bit.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz
2,解压
3,启动zookeeper
./bin/zookeeper-server-start.sh ./config/zookeeper.properties
4 启动kafka
./bin/kafka-server-start.sh ./config/server.properties
5.创建topic
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
通过list 查看刚才创建的topic
./bin/kafka-topics.sh -list -zookeeper localhost:2181
6.启动producer 发送消息
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
主要的测试
创建topic
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
消费者列表查询
./bin/kafka-topics.sh -list -zookeeper localhost:2181
给这个topic下发送消息
./bin/kafka-console-producer.sh --broker-list 192.168.111.137:9092 --topic liuda
查看消息
./bin/kafka-console-consumer.sh --bootstrap-server 192.168.111.137:9092 --topic li --from-beginning
重启kafka
来源:oschina
链接:https://my.oschina.net/liudandan/blog/3211973