[Improve][Standalone] Standalone Add param of --metadata-url for runing with metadata
@@ -223,6 +223,10 @@ public class PulsarStandalone implements AutoCloseable {
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 class PulsarStandalone implements AutoCloseable {
if (!this.isOnlyBroker()) {
if (usingNewDefaultsPIP117) {
- startBookieWithRocksDB();
+ startBookieWithMetadataStore();
} else {
startBookieWithZookeeper();
}
@@ -434,10 +438,13 @@ public class PulsarStandalone implements AutoCloseable {
}
}
-
- private void startBookieWithRocksDB() throws Exception {
+ private void startBookieWithMetadataStore() throws Exception {
+ if (StringUtils.isBlank(metadataStoreUrl)){
log.info("Starting BK with RocksDb metadata store");
- String metadataStoreUrl = "rocksdb://" + Paths.get(metadataDir).toAbsolutePath();
+ metadataStoreUrl = "rocksdb://" + Paths.get(metadataDir).toAbsolutePath();
+ } else {
+ log.info("Starting BK with metadata store:", metadataStoreUrl);
+ }
bkCluster = BKCluster.builder()
.metadataServiceUri(metadataStoreUrl)
.bkPort(bkPort)
