This repository was archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 140
support multiple listeners with multiple endpoints #742
Merged
BewareMyPower
merged 4 commits into
streamnative:master
from
wangjialing218:branch_multi_listener
Sep 26, 2021
Merged
support multiple listeners with multiple endpoints #742
BewareMyPower
merged 4 commits into
streamnative:master
from
wangjialing218:branch_multi_listener
Sep 26, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b6f65a6
to
437bc01
Compare
@BewareMyPower please have a look. |
Could you solve the conflicts? |
437bc01
to
a71bcf4
Compare
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/EndPoint.java
Outdated
Show resolved
Hide resolved
BewareMyPower
suggested changes
Sep 26, 2021
tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaListenerNameTest.java
Outdated
Show resolved
Hide resolved
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/KafkaProtocolHandler.java
Outdated
Show resolved
Hide resolved
Regarding to this question, I think we can ignore the transaction part in this PR. |
BewareMyPower
approved these changes
Sep 26, 2021
This was referenced Sep 26, 2021
BewareMyPower
added a commit
that referenced
this pull request
Sep 30, 2021
…760) ### Motivation #690 supports non-partitioned topics and #742 supports multiple listeners and marks some configs as deprecated, so the current documents are outdated. ### Modification Even if KoP supports non-partitioned topics now, it's still better to configure `allowAutoTopicCreationType` with `partitioned` by default. This PR modified the explanation for the reason. This PR also adds docs for how to enable multiple listeners and updates the related configuration docs. In addition, #742 marks `kafkaListenerName` as deprecated, but it also makes this config not work anymore. So this PR removes the config and related tests.
BewareMyPower
pushed a commit
that referenced
this pull request
Sep 30, 2021
Fixes #669 Fixes #574 To support multiple listeners with multiple protocols, we need to set follow configration, and deprecated `kafkaAdvertisedListeners` and `kafkaListenerName`. > kafkaListeners=internal://0.0.0.0:9092,internal_ssl://0.0.0.0:9093,external://0.0.0.0:19002,external_ssl:0.0.0.0:19003 > kafkaProtocalMap=internal:PLAINTEXT,internal_ssl:SSL,external:PLAINTEXT,external_ssl:SSL > advertisedListeners={pulsar's listeners},internal:pulsar//192.168.1.10:9092,internal_ssl:pulsar//192.168.1.10:9093,external:pulsar//172.16.1.10:19002,external_ssl:pulsar://172.16.1.10:19003 1. Define the listenerNames and port of each listenerName in `kafkaListeners` 2. Define the listenerNames and protocol of each listenerName in `kafkaProtocalMap` 3. Add listenerNames and advertised address of each listenerName into `advertisedListeners` Kafka client should connect to the port of the listenerName according to KIP-103. Co-authored-by: wangjialing <wangjialing@cmss.chinamobile.com>
BewareMyPower
added a commit
that referenced
this pull request
Sep 30, 2021
…760) ### Motivation #690 supports non-partitioned topics and #742 supports multiple listeners and marks some configs as deprecated, so the current documents are outdated. ### Modification Even if KoP supports non-partitioned topics now, it's still better to configure `allowAutoTopicCreationType` with `partitioned` by default. This PR modified the explanation for the reason. This PR also adds docs for how to enable multiple listeners and updates the related configuration docs. In addition, #742 marks `kafkaListenerName` as deprecated, but it also makes this config not work anymore. So this PR removes the config and related tests.
BewareMyPower
added a commit
that referenced
this pull request
Oct 29, 2021
…teners (#864) Fixes #818 ### Motivation #742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws. First, the KoP advertised listeners must be added to `advertisedListeners` config. This config should be treated as the advertised listeners for broker, not protocol handlers. What `KafkaProtocolHandler#getProtocolDataToAdvertise` returns is not used though it has been written to ZK. It also makes `kafkaAdvertisedListeners` meaningless and it was marked as deprecated. ### Modification Benefit by [PIP 95](apache/pulsar#12040), Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of `LookupClient` by using a shared `PulsarClient` without configuring listener name. Then this PR uses the `MetadataStoreCacheLoader` introduced from #820 to get the `kafkaAdvertisedListeners` from ZK. Since it has already been cached, this PR removes the `KOP_ADDRESS_CACHE`. To verify the feature, this PR adds a test `testMetadataRequestForMultiListeners`. The KoP config is like ```properties kafkaListeners=PLAINTEXT://0.0.0.0:<port1>,GW://0.0.0.0:<port2> kafkaProtocolMap=PLAINTEXT:PLAINTEXT,GW:PLAINTEXT kafkaAdvertisedListeners=PLAINTEXT://192.168.0.1:<port3>,GW://192.168.0.1:<port4> ``` And verify that each `KafkaRequestHandler` can handle the METADATA requests well.
BewareMyPower
added a commit
that referenced
this pull request
Oct 29, 2021
…teners (#864) Fixes #818 ### Motivation #742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws. First, the KoP advertised listeners must be added to `advertisedListeners` config. This config should be treated as the advertised listeners for broker, not protocol handlers. What `KafkaProtocolHandler#getProtocolDataToAdvertise` returns is not used though it has been written to ZK. It also makes `kafkaAdvertisedListeners` meaningless and it was marked as deprecated. ### Modification Benefit by [PIP 95](apache/pulsar#12040), Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of `LookupClient` by using a shared `PulsarClient` without configuring listener name. Then this PR uses the `MetadataStoreCacheLoader` introduced from #820 to get the `kafkaAdvertisedListeners` from ZK. Since it has already been cached, this PR removes the `KOP_ADDRESS_CACHE`. To verify the feature, this PR adds a test `testMetadataRequestForMultiListeners`. The KoP config is like ```properties kafkaListeners=PLAINTEXT://0.0.0.0:<port1>,GW://0.0.0.0:<port2> kafkaProtocolMap=PLAINTEXT:PLAINTEXT,GW:PLAINTEXT kafkaAdvertisedListeners=PLAINTEXT://192.168.0.1:<port3>,GW://192.168.0.1:<port4> ``` And verify that each `KafkaRequestHandler` can handle the METADATA requests well.
gaozhangmin
pushed a commit
to gaozhangmin/kop
that referenced
this pull request
Nov 29, 2021
…teners (streamnative#864) Fixes streamnative#818 ### Motivation streamnative#742 adds the multiple listeners support for KoP 2.8.x. However, there're some flaws. First, the KoP advertised listeners must be added to `advertisedListeners` config. This config should be treated as the advertised listeners for broker, not protocol handlers. What `KafkaProtocolHandler#getProtocolDataToAdvertise` returns is not used though it has been written to ZK. It also makes `kafkaAdvertisedListeners` meaningless and it was marked as deprecated. ### Modification Benefit by [PIP 95](apache/pulsar#12040), Pulsar client doesn't need to configure listener name for topic lookup. So this PR simplifies the implementation of `LookupClient` by using a shared `PulsarClient` without configuring listener name. Then this PR uses the `MetadataStoreCacheLoader` introduced from streamnative#820 to get the `kafkaAdvertisedListeners` from ZK. Since it has already been cached, this PR removes the `KOP_ADDRESS_CACHE`. To verify the feature, this PR adds a test `testMetadataRequestForMultiListeners`. The KoP config is like ```properties kafkaListeners=PLAINTEXT://0.0.0.0:<port1>,GW://0.0.0.0:<port2> kafkaProtocolMap=PLAINTEXT:PLAINTEXT,GW:PLAINTEXT kafkaAdvertisedListeners=PLAINTEXT://192.168.0.1:<port3>,GW://192.168.0.1:<port4> ``` And verify that each `KafkaRequestHandler` can handle the METADATA requests well. (cherry picked from commit 50699b3)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #669
Fixes #574
To support multiple listeners with multiple protocols, we need to set follow configration, and deprecated
kafkaAdvertisedListeners
andkafkaListenerName
.kafkaListeners
kafkaProtocalMap
advertisedListeners
Kafka client should connect to the port of the listenerName according to KIP-103.