配置Kafka内外网访问后,Kafka manager不能使用了,如下为配置
listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
listeners=EXTERNAL://192.168.0.213:19092,INTERNAL://192.168.0.213:9092
advertised.listeners=EXTERNAL://101.89.163.9:19092,INTERNAL://192.168.0.213:9092
inter.broker.listener.name=INTERNAL
zookeeper中存储的信息
[zk: localhost:2181(CONNECTED) 1] get /brokers/ids/10
{"listener_security_protocol_map":{"EXTERNAL":"PLAINTEXT","INTERNAL":"PLAINTEXT"},"endpoints":["EXTERNAL://101.89.163.9:19092","INTERNAL://192.168.0.213:9093"],"jmx_port":9999,"host":"101.89.163.9","timestamp":"1639470932314","port":9094,"version":4}
jmxtrans获取的外网地址,而外网地址是不通的,想要走内网获取jmxtrans地址
Kafka manager中的报错信息
[error] k.m.a.c.BrokerViewCacheActor - Failed to get broker metrics for BrokerIdentity(30,101.89.163.9,9999,false,true,Map(PLAINTEXT -> 9096))
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 101.89.163.9; nes
ted exception is:
java.net.ConnectException: Connection timed out (Connection timed out)]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369) ~[na:1.8.0_151]
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270) ~[na:1.8.0_151]
at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:57) ~[kafka-manager.kafka-manager-
at
配置信息:
- 外网地址:
EXTERNAL://101.89.163.9:19092
- 内网地址:
INTERNAL://192.168.0.213:9092
这边由于权限配置,在部署kafka manager机器上受到限制访问不了外网。
kafka manager的连接配置:
kafka-manager.zkhosts="192.168.0.213:2181,192.168.0.214:2181,192.168.0.215:2181"
kafka-manager.zkhosts=${?ZK_HOSTS}
连接zookeeper获取的是外网的jmxtrans信息,如何能够走内网通信?
或者推荐下别的监控运维工具
kafka-manager好像只有配置zk的方式,没有指定bootstrap引到的方式。所以实现不了。
你可以考虑一下使用域名映射的方式来解决这个问题,参考:kafka外网转发
你的答案