Kafka集群端口无法监听及访问故障解决
出现问题的kafka版本是0.9.0.1,端口9099老是监听不起来,解决办法:
修改/usr/local/app/msg_server/kafka/0.9.0.1/config/server.properties文件的
listeners=PLAINTEXT://0.0.0.0:9099
这里的listeners也可以修换成内网IP地址,三台记得都修改,或者注释掉listeners增加advertised.listeners参数,
然后重启kafka即可
/usr/local/app/msg_server/kafka/0.9.0.1/bin/kafka-server-start.sh -daemon /usr/local/app/msg_server/kafka/0.9.0.1/config/server.properties
advertised.listeners这个配置的含义,官网有解释:
Listeners to publish to ZooKeeper for clients to use, if different than the listeners above. In IaaS environments, this may need to be different from the interface to which the broker binds. If this is not set, the value for listeners will be used.
详情:http://kafka.apache.org/documentation/#configuration
kafka就会忽略listeners配置,用一个就可以了;
附server.properties配置文件内容:
# --------------------------------------------- need update
broker.id=0
listeners=PLAINTEXT://0.0.0.0:9099
#advertised.listeners=PLAINTEXT://10.249:9099
port=9099
default.replication.factor=3
# --------------------------------------------- need update
host.name=k1
# --------------------------------------------- need update
advertised.host.name=k1
advertised.port=9099
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/usr/local/app/msg_server/kafka/0.9.0.1/data/
num.partitions=10
num.recovery.threads.per.data.dir=1
log.retention.hours=1
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
log.cleaner.enable=true
#zookeeper.connect=k1:2181
zookeeper.connect=k1:2181,k2:2181,k3:2181
zookeeper.connection.timeout.ms=6000
delete.topic.enable=true
Tag标签:「集群 端口 监听 kafka」更新时间:「2021-11-04 16:29:46」阅读次数:「971」