Kafka server configuration - listeners vs. advertised.listeners

前端 未结 3 1868
渐次进展
渐次进展 2020-11-29 20:12

To get Kafka running, you need to set some properties in config/server.properties file. There are two settings I don\'t understand.

Can somebody explai

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 20:59

    From this link: https://cwiki.apache.org/confluence/display/KAFKA/KIP-103%3A+Separation+of+Internal+and+External+traffic

    During the 0.9.0.0 release cycle, support for multiple listeners per broker was introduced. Each listener is associated with a security protocol, ip/host and port. When combined with the advertised listeners mechanism, there is a fair amount of flexibility with one limitation: at most one listener per security protocol in each of the two configs (listeners and advertised.listeners).

    In some environments, one may want to differentiate between external clients, internal clients and replication traffic independently of the security protocol for cost, performance and security reasons. A few examples that illustrate this:

    • Replication traffic is assigned to a separate network interface so that it does not interfere with client traffic.
    • External traffic goes through a proxy/load-balancer (security, flexibility) while internal traffic hits the brokers directly (performance, cost).
    • Different security settings for external versus internal traffic even though the security protocol is the same (e.g. different set of enabled SASL mechanisms, authentication servers, different keystores, etc.)

    As such, we propose that Kafka brokers should be able to define multiple listeners for the same security protocol for binding (i.e. listeners) and sharing (i.e. advertised.listeners) so that internal, external and replication traffic can be separated if required.

    So,

    listeners - Comma-separated list of URIs we will listen on and their protocols. Specify hostname as 0.0.0.0 to bind to all interfaces. Leave hostname empty to bind to default interface. Examples of legal listener lists:

    • PLAINTEXT://myhost:9092,TRACE://:9091
    • PLAINTEXT://0.0.0.0:9092, TRACE://localhost:9093

    advertised.listeners - Listeners to publish to ZooKeeper for clients to use, if different than the listeners above. In IaaS environments, this may need to be different from the interface to which the broker binds. If this is not set, the value for listeners will be used.

提交回复
热议问题