《kafka》linux kafka配置外网访问;listeners

1、Kafka 服务器 host 查看hostname

cat /etc/hostname
iZ2zecx60yof3y5gnh44w1Z

2、修改 kafka目录下的config/server.properties 配置文件。

vim /opt/kafka-2.12/config/server.properties
2.1修改advertised.listeners
advertised.listeners=PLAINTEXT://iZ2zecx60yof3y5gnh44w1Z:9092
2.2修改zookeeper.connect
zookeeper.connect=iZ2zecx60yof3y5gnh44w1Z:2181

3、重启kafka服务(我在Kafka目录下)

 nohup ./bin/kafka-server-start.sh config/server.properties > kafka.out &

4、客户端 host 配置

sudo vim /etc/hosts
# 在文件最后加入
#123服务器
 123.**.**.158 iZ2zecx60yof3y5gnh44w1Z

5、使用offset(kafka可视化工具)连接

连接成功!over
5.1如果连接不上,去阿里云在安全组开放对应端口即可

你可能感兴趣的:(《kafka》linux kafka配置外网访问;listeners)