Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

[FEATURE] Support multiple listeners of one protocol #574

@BewareMyPower

Description

@BewareMyPower

Is your feature request related to a problem? Please describe.

Currently for KoP we can configure kafkaListeners as what interfaces KoP binds to and kafkaAdvertisedListeners as how clients connect. However, currently KoP can only bind to one interface for each protocol.

For example, if KoP was configured with

kafkaListeners=PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093

it would work well.

But if KoP was configured with

kafkaListeners=PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093,SSL://127.0.0.1:9094

KoP would fail to start with following logs.

15:56:29.408 [main] ERROR io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler - KafkaProtocolHandler newChannelInitializers failed with 
java.lang.IllegalStateException: PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093,SSL://127.0.0.1:9094 has multiple listeners whose protocol is SSL
	at io.streamnative.pulsar.handlers.kop.EndPoint.parseListeners(EndPoint.java:77) ~[pulsar-protocol-handler-kafka-2.8.0-rc-202106091215.nar-unpacked/:?]
	at io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler.newChannelInitializers(KafkaProtocolHandler.java:313) [pulsar-protocol-handler-kafka-2.8.0-rc-202106091215.nar-unpacked/:?]
	at org.apache.pulsar.broker.protocol.ProtocolHandlerWithClassLoader.newChannelInitializers(ProtocolHandlerWithClassLoader.java:71) [io.streamnative-pulsar-broker-2.8.0-rc-202106071430.jar:2.8.0-rc-202106071430]
	at org.apache.pulsar.broker.protocol.ProtocolHandlers.newChannelInitializers(ProtocolHandlers.java:124) [io.streamnative-pulsar-broker-2.8.0-rc-202106071430.jar:2.8.0-rc-202106071430]
	at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:787) [io.streamnative-pulsar-broker-2.8.0-rc-202106071430.jar:2.8.0-rc-202106071430]
	at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:296) [io.streamnative-pulsar-broker-2.8.0-rc-202106071430.jar:2.8.0-rc-202106071430]
	at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [io.streamnative-pulsar-broker-2.8.0-rc-202106071430.jar:2.8.0-rc-202106071430]

Describe the solution you'd like
Kafka (as of KIP-103) has the listener.security.protocol.map config to map your own protocol define a set of listeners, each with a name and a security protocol (PLAINTEXT, SSL), so that a protocol like SSL could bind multiple ports or IPs.

We can also see more details in this blog. Here's an example to advertise multiple ports of PLAINTEXT protocol:

advertised.listeners=PLAINTEXT://broker:9092,CONNECTIONS_FROM_HOST://localhost:19092
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,CONNECTIONS_FROM_HOST:PLAINTEXT

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Labels

type/featureIndicates new functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions