libkafka 由于目标计算机积极拒绝,无法连接

在配置kafka服务器后,使用libkafka去连接远程(i.e. not localhost)的broker,总是失败,报错如下

rdkafka_example -P -b 192.168.150.229:9092,192.168.150.229:9093 -t test
% Created producer rdkafka#producer-1
LOG-3-FAIL: 192.168.150.229:9092/bootstrap: Connect to ipv4#192.168.150.229:9092
 failed: 由于目标计算机积极拒绝,无法连接。


原因如下:

你的config/server.properties需要明确写出listeners的ip地址,而不能用localhost或者127.0.0.1代替

listeners=PLAINTEXT://192.168.150.229:9092


# The port the socket server listens on
#port=9092


# Hostname the broker will bind to. If not set, the server will bind to all interfaces
#host.name=localhost

你要么设置listteners要么设置port、host.name,二选一。

如果你只是本机使用,没有准备让其他机器的客户端连接过来,你可以用localhost或者127.0.0.1代替

如果你在搭建集群,一定要设置listteners或host.name为明确的ip

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值