Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is advertised listeners needed? #153

Closed
natashalia opened this issue Jan 18, 2017 · 5 comments
Closed

Why is advertised listeners needed? #153

natashalia opened this issue Jan 18, 2017 · 5 comments

Comments

@natashalia
Copy link

@natashalia natashalia commented Jan 18, 2017

This image works wonderfully.
Just I am a little confused with the config "ADVERTISED LISTENER". It is not a required configuration outside docker, so why is it needed in docker?
(To my understanding, it is written in doc that "Listeners to publish to ZooKeeper for clients to use", so why will clients query from zookeeper, when I have provide them kafka ips directly?)

@schmichri
Copy link

@schmichri schmichri commented Jan 18, 2017

Because the running application wants to know "who it is" on the outside (of the container) world.
understand that: https://docs.docker.com/engine/userguide/networking/default_network/container-communication/ and you will answer the question by yourself ;)

Loading

@deitch
Copy link

@deitch deitch commented Jan 28, 2017

the running application wants to know "who it is" on the outside

I think the original poster's question was why that is necessary.

Loading

@natashalia
Copy link
Author

@natashalia natashalia commented Feb 14, 2017

@schmichri Thanks for answering. Sorry I may have not state the question clearly. I'm confused why zookeeper want to know "who it(kafka) is" on the outside world. It is actually a question about behavior between zookeeper and kafka. Really a naive one though, finally got it after reading kafka doc carefully.

Loading

@natashalia
Copy link
Author

@natashalia natashalia commented Feb 14, 2017

For those who may have the same question:

When a client connect to a Kafka cluster by specifying "bootstrap.servers=...", it do not have to be a full list of all Kafka brokers, because client doesn't use it to send data to Kafka directly. Rather, client will somehow find zookeeper, and get the whole list of Kafka brokers(may be part of them that are needed for certain topic) from zookeeper. So "ADVERTISED_LISTENER" is used for client to connect to Kafka.

I used to thought that "ADVERTISED_LISTENER" is just used for zookeeper to communicate with all Kafka brokers. If so, it is really confused why the intranet address(which is the default value) do not work. Turns out a misunderstanding :P

Loading

@natashalia natashalia closed this Feb 14, 2017
@deitch
Copy link

@deitch deitch commented Feb 14, 2017

So... when any Kafka connects to zk to register itself, it wants to tell all the other Kafka nodes 2 pieces of information:

  1. How do other Kafka nodes reach me - e.g. inside the k8s cluster, on the compose network, etc.
  2. How do outside consumers reach me

Those two may be the same, but they may not. In case they are not, ADVERTISED_LISTENER answers the second.

Is that about right?

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants