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

Support multiple advertisedListener for HTTP protocol #17063

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wangjialing218
Copy link
Contributor

Motivation

PIP 61 and PIP 95 supports multiple advertised address for binary port.
For HTTP port, currently we do not have a way to support multiple advertised address.

Consider we are deploying a broker that can be accessed through both private network (for example 192.168.0.1) and public network (for example 10.175.100.1), we could configure multiple advertised listener for binary port, Pulsar client could access broker through both private and public network with correct listener name. For HTTP address, we could only configure one advertised address through internal listener:

public String webAddress(ServiceConfiguration config) {

If we configure private address(192.168.0.1) for HTTP address, we may not execute some PulsarAdmin API from public network, since some http request (for example get topics' stats) may get 307 response code and redirect to another broker's private address.

Modifications

Configure multiple advertised http address in advertisedListeners together with binary address.

advertisedListeners=internal:pulsar://192.168.0.1:6650,internal:http://192.168.0.1:8080,external:pulsar://10.175.100.1:6650,external:http://10.175.100.1:8080

Broker:
For HTTP request, get listener name from request header X-Pulsar-ListenerName, use the listener name for topic lookup and topic owner verification, return advertised http address in case of http redirect.

Pulsar Admin:
Add listenerName to PulsarAdminBuilder, and set listener name to HTTP request header X-Pulsar-ListenerName.

Verifying this change

This change added tests and can be verified as follows:
MultiHTTPAdvertisedListenersTest

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    Need to update doc for configuration multiple HTTP address after PR accecpt.

@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Aug 11, 2022
@codelipenghui
Copy link
Contributor

@wangjialing218 I think Pulsar have this feature for now #14839.

@wangjialing218
Copy link
Contributor Author

wangjialing218 commented Aug 11, 2022

@wangjialing218 I think Pulsar have this feature for now #14839.

@codelipenghui #14839 provide the feature to configure http address in advertisedListeners, but only one http address is available for http redirect: the http address of the internal listener, or the first listener which has http address in case of internal listener does not have http address.

This PR provide feature to configure multiple http address with different listener name, and provide listenerName() interface when create PulsarAdmin.

@wangjialing218
Copy link
Contributor Author

/pulsarbot run-failure-checks

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Sep 12, 2022
@Technoboy- Technoboy- added this to the 3.2.0 milestone Jul 31, 2023
@Technoboy- Technoboy- modified the milestones: 3.2.0, 3.3.0 Dec 22, 2023
@coderzc coderzc modified the milestones: 3.3.0, 3.4.0 May 8, 2024
@lhotari lhotari modified the milestones: 4.0.0, 4.1.0 Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-required Your PR changes impact docs and you will update later. Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants