Skip to content

[Issue 3851] [pulsar-broker] Support to start broker use the port initialized in cluster metadata#3853

Merged
sijie merged 2 commits intoapache:masterfrom
murong00:branch-3852
Apr 2, 2019
Merged

[Issue 3851] [pulsar-broker] Support to start broker use the port initialized in cluster metadata#3853
sijie merged 2 commits intoapache:masterfrom
murong00:branch-3852

Conversation

@murong00
Copy link
Contributor

Motivation

Fixes #3851

Modifications

Override the port of service urls in brokerConfig by the config initialized in cluster metadata.

Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a fundamental concern about this change. the port in the service url might be different from the port used in broker at some cases. for example, I have 3 broker listening on 8080. I configure a load balancer over these 3 broker and the load balancer exposes the port at 80. At this case, broker should listen on 8080 but no 80.

So I am not sure if this change is correct. Also bringing configuration store at starting up can be introduce another failure point when a pulsar deployment is over multiple data centers.

Long zkSessionTimeoutMillis = config.getZooKeeperSessionTimeoutMillis();
String clusterName = config.getClusterName();
ZooKeeperClientFactory zkfactory = new ZookeeperClientFactoryImpl();
ZooKeeper configStoreZk = zkfactory.create(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close zookeeper at the end to release resources


private static int retrievePort(String url) {
String[] uris = url.split(":");
return Integer.parseInt(uris[uris.length-1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be problematic, since the url might potentially contain multiple hosts. since we introduced multiple hosts support in service url since 2.3.0. I would suggest using ServiceURI for parsing the service url and get the list of hosts in the service url.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the help.

@murong00
Copy link
Contributor Author

murong00 commented Mar 19, 2019

@sijie Thanks for point out these. Is there any other better way to deal with this issue? Or we just need to update the doc Configuring Brokers to guide users to match the service urls that provided when initializing the cluster's metadata? Any help would be appreciated!

@sijie
Copy link
Member

sijie commented Mar 19, 2019

@murong00 I think updating the documentation is a better idea for this case.

@murong00
Copy link
Contributor Author

@sijie Thanks for the advice, please review this change.

@sijie
Copy link
Member

sijie commented Mar 20, 2019

@murong00 great contribution!

@sijie
Copy link
Member

sijie commented Mar 20, 2019

run java8 tests

@sijie sijie added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Mar 20, 2019
@sijie sijie added this to the 2.4.0 milestone Mar 20, 2019
@sijie
Copy link
Member

sijie commented Mar 20, 2019

run java8 tests

3 similar comments
@sijie
Copy link
Member

sijie commented Mar 27, 2019

run java8 tests

@murong00
Copy link
Contributor Author

murong00 commented Apr 1, 2019

run java8 tests

@murong00
Copy link
Contributor Author

murong00 commented Apr 2, 2019

run java8 tests

@sijie sijie merged commit 2e93452 into apache:master Apr 2, 2019
@murong00 murong00 deleted the branch-3852 branch March 8, 2020 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants