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

Comments

Projects
None yet
3 participants
@natashalia
Copy link

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

This comment has been minimized.

Copy link

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 ;)

@deitch

This comment has been minimized.

Copy link

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.

@natashalia

This comment has been minimized.

Copy link
Author

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.

@natashalia

This comment has been minimized.

Copy link
Author

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

@natashalia natashalia closed this Feb 14, 2017

@deitch

This comment has been minimized.

Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.