Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Host property in Zookeeper is null #157

Open
kouzant opened this issue Mar 27, 2018 · 2 comments
Open

Host property in Zookeeper is null #157

kouzant opened this issue Mar 27, 2018 · 2 comments

Comments

@kouzant
Copy link

kouzant commented Mar 27, 2018

I am testing kafka-utils with our Kafka cluster and the "host" property in Zookeeper brokers/ids/BROKER_ID is null

In our Kafka configuration we use the listener configuration parameters which over-write the host.name parameter, actually it is deprecated since version 0.10.0 of Kafka.
In our testing environment Zookeeper looks like this:

[zk: localhost:2181(CONNECTED) 16] get /brokers/ids/1 {"listener_security_protocol_map":{"INTERNAL":"SSL","EXTERNAL":"SSL"},"endpoints":["INTERNAL://MY_ENDPOINT:9091","EXTERNAL://MY_ENDPOINT:9092"],"rack":"MY_RACK","jmx_port":19999,"host":null,"timestamp":"1522162718367","port":-1,"version":4} cZxid = 0x100000641 ctime = Tue Mar 27 14:58:38 UTC 2018 mZxid = 0x100000641 mtime = Tue Mar 27 14:58:38 UTC 2018 pZxid = 0x100000641 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x162669c09dc0303 dataLength = 235 numChildren = 0 [zk: localhost:2181(CONNECTED) 17]

When I remove the listener parameters and set the host.name it works as expected.
Are you planning to fix this, by probably reading the "endpoints" instead of the "host"? Is there any misconfiguration on my side that I'm not aware of?

Thanks in advance

@fede1024
Copy link
Contributor

fede1024 commented Apr 4, 2018

Thanks for the bug report. Kafka-utils is not officially compatible with Kafka >= 0.11 yet, but it will be soon (hopefully within the next few months). However I can't guarantee that it will be immediately made compatible with the new ZK format.

I don't think there is any parameter to read from "endpoints", however we could add some logic to parse that field in case "host" is null. It's not currently one of our priorities, but if you open a PR I'm happy to help reviewing it.

@iMajna
Copy link

iMajna commented Aug 13, 2019

@kouzant this is a well known issue in Kafka. When you are running Kafka in any other protocol than PLAINTEXT like for instance when you kerberize your cluster host becomes null and port -1.
Only thing you can do about it is actually maintain it inside of Zookeeper for every broker individually.
First you want to
[zk: hostname:2181(CONNECTED) 2] get /brokers/ids/11

OUTPUT: {"listener_security_protocol_map":{"SASL_PLAINTEXT":"SASL_PLAINTEXT"},"jmx_port":-1,"timestamp":"1481503998915","endpoints":["SASL_PLAINTEXT://hostname:9992"],"host":null,"version":4,"port":-1}

and then:
[zk: hostname:2181(CONNECTED) 2] set /brokers/ids/11 {"listener_security_protocol_map":{"SASL_PLAINTEXT":"SASL_PLAINTEXT"},"jmx_port":-1,"timestamp":"1481503998915","endpoints":["SASL_PLAINTEXT://hostname:9992"],"host":"hostname","version":4,"port":9992}

You should have one thing on your mind while doing this. Every time you restart your broker hostand port will be changed to null and -1 again and therefore you have to change it again in zookeeper. You can create a some kind zookeeper watcher app which will take care of it whenever it changes or anything like it but yes it can drive you bananas. Hope I helped at least a little bit since I lost some time figuring out this out as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants