diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java index 2f3d15b1eafb4..4fd22eba785b9 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java @@ -223,6 +223,10 @@ public boolean isHelp() { description = "Directory for storing metadata") private String metadataDir = "data/metadata"; + @Parameter(names = { "--metadata-url" }, + description = "Metadata store url") + private String metadataStoreUrl = ""; + @Parameter(names = {"--zookeeper-port"}, description = "Local zookeeper's port", hidden = true) private int zkPort = 2181; @@ -290,7 +294,7 @@ public void start() throws Exception { if (!this.isOnlyBroker()) { if (usingNewDefaultsPIP117) { - startBookieWithRocksDB(); + startBookieWithMetadataStore(); } else { startBookieWithZookeeper(); } @@ -434,10 +438,13 @@ public void close() { } } - - private void startBookieWithRocksDB() throws Exception { - log.info("Starting BK with RocksDb metadata store"); - String metadataStoreUrl = "rocksdb://" + Paths.get(metadataDir).toAbsolutePath(); + private void startBookieWithMetadataStore() throws Exception { + if (StringUtils.isBlank(metadataStoreUrl)){ + log.info("Starting BK with RocksDb metadata store"); + metadataStoreUrl = "rocksdb://" + Paths.get(metadataDir).toAbsolutePath(); + } else { + log.info("Starting BK with metadata store:", metadataStoreUrl); + } bkCluster = BKCluster.builder() .metadataServiceUri(metadataStoreUrl) .bkPort(bkPort)