kafka Configure listeners
# The address the socket server listens on. It will get the value returned from # java.net.InetAddress.getCanonicalHostName() if not configured. # FORMAT: # listeners = listener_name://host_name:port # EXAMPLE: # listeners = PLAINTEXT://your.host.name:9092 #listeners=PLAINTEXT://:9092
kafka configuration advertised
# Hostname and port the broker will advertise to producers and consumers. If not set, # it uses the value for "listeners" if configured. Otherwise, it will use the value # returned from java.net.InetAddress.getCanonicalHostName(). #advertised.listeners=PLAINTEXT://your.host.name:9092
The following demonstrates the phenomenon:
The first case:
The default configuration is not
zookeeper View kafka Address:
kafka create topic
Add Host hosts normally access
192.168.11.103 xuliang-PC
The second case
Configuring listeners = PLAINTEXT: //192.168.11.103: 9092
The default advertised.listeners also 192.168.11.103:9092
At this point access through: bin / kafka-topics.sh --list --bootstrap-server 192.168.11.103:9092
The third case:
Configuration is as follows:
Fourth case:
Configuration is as follows:
Listen Address:
to sum up:
listeners
Kafka is real bind address
advertised.listeners
Is exposed to external listeners, if not set, will use listeners