forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support advertisedListeners for standalone (apache#10297)
### Motivation Now `advertisedListeners` and `advertisedAddress` can not appear together. In MultipleListenerValidator#validateAndAnalysisAdvertisedListener : ``` if (StringUtils.isNotBlank(config.getAdvertisedListeners()) && StringUtils.isNotBlank(config.getAdvertisedAddress())) { throw new IllegalArgumentException("`advertisedListeners` and `advertisedAddress` must not appear together"); } ``` ### Modifications Only set the default localhost when both `AdvertisedAddress` and `advertisedListeners` are not set ### Verifying this change
- Loading branch information
Showing
3 changed files
with
148 additions
and
2 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/StandaloneTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.broker.service; | ||
|
||
import org.apache.pulsar.PulsarStandaloneStarter; | ||
import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.AssertJUnit.assertEquals; | ||
import static org.testng.AssertJUnit.assertNull; | ||
|
||
@Test(groups = "broker") | ||
public class StandaloneTest extends MockedPulsarServiceBaseTest { | ||
|
||
@Override | ||
protected void setup() throws Exception { | ||
|
||
} | ||
|
||
@Override | ||
protected void cleanup() throws Exception { | ||
|
||
} | ||
|
||
@Test | ||
public void testAdvertised() throws Exception { | ||
String args[] = new String[]{"--config", | ||
"./src/test/resources/configurations/pulsar_broker_test_standalone.conf"}; | ||
PulsarStandaloneStarter standalone = new PulsarStandaloneStarter(args); | ||
assertNull(standalone.getConfig().getAdvertisedAddress()); | ||
assertEquals(standalone.getConfig().getAdvertisedListeners(), | ||
"internal:pulsar://192.168.1.11:6660,internal:pulsar+ssl://192.168.1.11:6651"); | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
pulsar-broker/src/test/resources/configurations/pulsar_broker_test_standalone.conf
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
applicationName="pulsar_broker" | ||
zookeeperServers= | ||
configurationStoreServers="localhost" | ||
brokerServicePort=6650 | ||
brokerServicePortTls=6651 | ||
webServicePort=8080 | ||
webServicePortTls=4443 | ||
bindAddress=0.0.0.0 | ||
advertisedAddress= | ||
advertisedListeners=internal:pulsar://192.168.1.11:6660,internal:pulsar+ssl://192.168.1.11:6651 | ||
internalListenerName=internal | ||
clusterName="test_cluster" | ||
brokerShutdownTimeoutMs=3000 | ||
backlogQuotaCheckEnabled=true | ||
backlogQuotaCheckIntervalInSeconds=60 | ||
backlogQuotaDefaultLimitGB=50 | ||
brokerDeleteInactiveTopicsEnabled=true | ||
brokerDeleteInactiveTopicsFrequencySeconds=60 | ||
allowAutoTopicCreation=true | ||
allowAutoTopicCreationType=non-partitioned | ||
defaultNumPartitions=1 | ||
messageExpiryCheckIntervalInMinutes=5 | ||
clientLibraryVersionCheckEnabled=false | ||
clientLibraryVersionCheckAllowUnversioned=true | ||
statusFilePath=/tmp/status.html | ||
tlsEnabled=false | ||
tlsCertificateFilePath=/usr/local/conf/pulsar/server.crt | ||
tlsKeyFilePath=/home/local/conf/pulsar/server.key | ||
tlsTrustCertsFilePath= | ||
tlsAllowInsecureConnection=false | ||
authenticationEnabled=false | ||
authorizationEnabled=false | ||
superUserRoles="test_user" | ||
brokerClientAuthenticationPlugin="org.apache.pulsar.client.impl.auth.AuthenticationDisabled" | ||
brokerClientAuthenticationParameters= | ||
bookkeeperClientAuthenticationPlugin="test_auth_plugin" | ||
bookkeeperClientAuthenticationAppId="test_auth_id" | ||
bookkeeperClientTimeoutInSeconds=30 | ||
bookkeeperClientSpeculativeReadTimeoutInMillis=0 | ||
bookkeeperClientHealthCheckEnabled=true | ||
bookkeeperClientHealthCheckIntervalSeconds=60 | ||
bookkeeperClientHealthCheckErrorThresholdPerInterval=5 | ||
bookkeeperClientHealthCheckQuarantineTimeInSeconds=1800 | ||
bookkeeperClientRackawarePolicyEnabled=true | ||
bookkeeperClientRegionawarePolicyEnabled=false | ||
bookkeeperClientMinNumRacksPerWriteQuorum=2 | ||
bookkeeperClientEnforceMinNumRacksPerWriteQuorum=false | ||
bookkeeperClientReorderReadSequenceEnabled=false | ||
bookkeeperClientIsolationGroups="test_group" | ||
managedLedgerDefaultEnsembleSize=3 | ||
managedLedgerDefaultWriteQuorum=2 | ||
managedLedgerDefaultAckQuorum=2 | ||
managedLedgerCacheSizeMB=1024 | ||
managedLedgerCacheEvictionWatermark=10 | ||
managedLedgerDefaultMarkDeleteRateLimit=0.1 | ||
managedLedgerMaxEntriesPerLedger=50000 | ||
managedLedgerMinLedgerRolloverTimeMinutes=10 | ||
managedLedgerMaxLedgerRolloverTimeMinutes=240 | ||
managedLedgerCursorMaxEntriesPerLedger=50000 | ||
managedLedgerCursorRolloverTimeInSeconds = 14400 | ||
managedLedgerDataReadPriority = bookkeeper-first | ||
loadBalancerEnabled = false | ||
loadBalancerReportUpdateThresholdPercentage=10 | ||
loadBalancerReportUpdateMaxIntervalMinutes=15 | ||
loadBalancerHostUsageCheckIntervalMinutes=1 | ||
loadBalancerSheddingIntervalMinutes=30 | ||
loadBalancerSheddingGracePeriodMinutes=30 | ||
loadBalancerBrokerUnderloadedThresholdPercentage=50 | ||
loadBalancerBrokerOverloadedThresholdPercentage=85 | ||
replicationMetricsEnabled=true | ||
replicationConnectionsPerBroker=16 | ||
replicationProducerQueueSize=1000 | ||
replicatorPrefix=pulsar.repl | ||
brokerDeleteInactiveTopicsMode=delete_when_subscriptions_caught_up | ||
supportedNamespaceBundleSplitAlgorithms=[range_equally_divide] | ||
defaultNamespaceBundleSplitAlgorithm=topic_count_equally_divide | ||
maxMessagePublishBufferSizeInMB=-1 |