[Broker] Allow configuring configurationMetadataStore when initialize cluster metadata
Motivation
As per `configurationStoreServers` need to be renamed to `configurationMetadataStoreUrl`.
Modification
* Add `configurationMetadataStore` to PulsarClusterMetadataSetup.
@@ -103,9 +103,14 @@ public class PulsarClusterMetadataSetup {
private String globalZookeeper;
@Parameter(names = {"-cs",
- "--configuration-store" }, description = "Configuration Store connection string", required = true)
+ "--configuration-store"}, description = "Configuration Store connection string", hidden = true)
private String configurationStore;
+ @Parameter(names = {"-cms",
+ "--configuration-metadata-store"}, description = "Configuration Metadata Store connection string",
+ hidden = false)
+ private String configurationMetadataStore;
+
@Parameter(names = {
"--initial-num-stream-storage-containers"
}, description = "Num storage containers of BookKeeper stream storage")
@@ -194,21 +199,25 @@ public class PulsarClusterMetadataSetup {
System.exit(1);
}
- if (arguments.configurationStore == null && arguments.globalZookeeper == null) {
- System.err.println("Configuration store address argument is required (--configuration-store)");
+ if (arguments.configurationMetadataStore == null && arguments.configurationStore == null
+ && arguments.globalZookeeper == null) {
+ System.err.println(
+ "Configuration metadata store address argument is required (--configuration-metadata-store)");
jcommander.usage();
System.exit(1);
}
- if (arguments.configurationStore != null && arguments.globalZookeeper != null) {
- System.err.println("Configuration store argument (--configuration-store) "
- + "supersedes the deprecated (--global-zookeeper) argument");
+ if (arguments.configurationMetadataStore != null && (arguments.configurationStore != null
+ || arguments.globalZookeeper != null)) {
+ System.err.println("Configuration metadata store argument (--configuration-metadata-store) "
+ + "supersedes the deprecated (--global-zookeeper and --configuration-store) argument");
jcommander.usage();
System.exit(1);
}
- if (arguments.configurationStore == null) {
- arguments.configurationStore = arguments.globalZookeeper;
+ if (arguments.configurationMetadataStore == null) {
+ arguments.configurationMetadataStore = arguments.configurationStore == null ? arguments.globalZookeeper :
+ arguments.configurationStore;
}
if (arguments.metadataStoreUrl == null) {
@@ -220,12 +229,12 @@ public class PulsarClusterMetadataSetup {
System.exit(1);
}
- log.info("Setting up cluster {} with metadata-store={} configuration-store={}", arguments.cluster,
- arguments.metadataStoreUrl, arguments.configurationStore);
+ log.info("Setting up cluster {} with metadata-store={} configuration-metadata-store={}", arguments.cluster,
+ arguments.metadataStoreUrl, arguments.configurationMetadataStore);
MetadataStoreExtended localStore =
initMetadataStore(arguments.metadataStoreUrl, arguments.zkSessionTimeoutMillis);
- MetadataStoreExtended configStore = initMetadataStore(arguments.configurationStore,
+ MetadataStoreExtended configStore = initMetadataStore(arguments.configurationMetadataStore,
arguments.zkSessionTimeoutMillis);
// Format BookKeeper ledger storage metadata
@@ -251,7 +260,7 @@ public class PulsarClusterMetadataSetup {
ServiceURI bkMetadataServiceUri = ServiceURI.create(uriStr);
// initial distributed log metadata
- initialDlogNamespaceMetadata(arguments.configurationStore, uriStr);
+ initialDlogNamespaceMetadata(arguments.configurationMetadataStore, uriStr);
// Format BookKeeper stream storage metadata
if (arguments.numStreamStorageContainers > 0) {
