diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java index decc32c24a0..ad242c11160 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java @@ -61,7 +61,9 @@ public class Main { BK_OPTS.addOption("m", "zkledgerpath", true, "Zookeeper ledgers root path"); BK_OPTS.addOption("p", "bookieport", true, "bookie port exported"); BK_OPTS.addOption("hp", "httpport", true, "bookie http port exported"); - BK_OPTS.addOption("j", "journal", true, "bookie journal directory"); + Option journalDirs = new Option ("j", "journaldirs", true, "bookie journal directories"); + journalDirs.setArgs(10); + BK_OPTS.addOption(journalDirs); Option indexDirs = new Option ("i", "indexdirs", true, "bookie index directories"); indexDirs.setArgs(10); BK_OPTS.addOption(indexDirs); @@ -81,8 +83,10 @@ private static void printUsage() { + "The settings in configuration file will be overwrite by provided arguments.\n" + "Options including:\n"; String footer = "Here is an example:\n" - + "\tBookieServer -c bookie.conf -z localhost:2181 -m /bookkeeper/ledgers " - + "-p 3181 -j /mnt/journal -i \"/mnt/index1 /mnt/index2\"" + + "\tBookieServer -c bookie.conf -z localhost:2181 -m /bookkeeper/ledgers" + + " -p 3181" + + " -j \"/mnt/journal1 /mnt/journal2\"" + + " -i \"/mnt/index1 /mnt/index2\"" + " -l \"/mnt/ledger1 /mnt/ledger2 /mnt/ledger3\"\n"; hf.printHelp("BookieServer [options]\n", header, BK_OPTS, footer, true); } @@ -165,9 +169,12 @@ private static ServerConfiguration parseArgs(String[] args) } if (cmdLine.hasOption('j')) { - String sJournalDir = cmdLine.getOptionValue('j'); - log.info("Get cmdline journal dir: {}", sJournalDir); - conf.setJournalDirName(sJournalDir); + String[] sJournalDirs = cmdLine.getOptionValues('j'); + log.info("Get cmdline journal dirs: "); + for (String journal : sJournalDirs) { + log.info("journalDir : {}", journal); + } + conf.setJournalDirsName(sJournalDirs); } if (cmdLine.hasOption('i')) { diff --git a/deploy/kubernetes/gke/bookkeeper.statefulset.yml b/deploy/kubernetes/gke/bookkeeper.statefulset.yml index 49548f09d05..d8e52ee0b38 100644 --- a/deploy/kubernetes/gke/bookkeeper.statefulset.yml +++ b/deploy/kubernetes/gke/bookkeeper.statefulset.yml @@ -35,7 +35,7 @@ metadata: data: BK_BOOKIE_EXTRA_OPTS: "\"-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB\"" BK_bookiePort: "3181" - BK_journalDirectory: "/bookkeeper/data/journal" + BK_journalDirectories: "/bookkeeper/data/journal" BK_ledgerDirectories: "/bookkeeper/data/ledgers" BK_indexDirectories: "/bookkeeper/data/ledgers" BK_zkServers: zookeeper diff --git a/deploy/kubernetes/gke/bookkeeper.yaml b/deploy/kubernetes/gke/bookkeeper.yaml index 78b28c892a1..3c1d02e4554 100644 --- a/deploy/kubernetes/gke/bookkeeper.yaml +++ b/deploy/kubernetes/gke/bookkeeper.yaml @@ -26,7 +26,7 @@ metadata: data: BK_BOOKIE_EXTRA_OPTS: "\"-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB\"" BK_bookiePort: "3181" - BK_journalDirectory: "/bookkeeper/data/journal" + BK_journalDirectories: "/bookkeeper/data/journal" BK_ledgerDirectories: "/bookkeeper/data/ledgers" BK_indexDirectories: "/bookkeeper/data/ledgers" BK_zkServers: zookeeper diff --git a/docker/README.md b/docker/README.md index 462f1ae2a16..04b37ac6391 100644 --- a/docker/README.md +++ b/docker/README.md @@ -215,7 +215,7 @@ Default value is empty - " ". so ledgers dir in zookeeper will be at "/ledgers" #### `BK_DATA_DIR` This variable allows you to specify where to store data in docker instance. -This could be override by env vars "BK_journalDirectory", "BK_ledgerDirectories", "BK_indexDirectories" and also `journalDirectory`, `ledgerDirectories`, `indexDirectories` in [bk_server.conf](https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/conf/bk_server.conf). +This could be override by env vars "BK_journalDirectories", "BK_ledgerDirectories", "BK_indexDirectories" and also `journalDirectories`, `ledgerDirectories`, `indexDirectories` in [bk_server.conf](https://github.com/apache/bookkeeper/blob/master/conf/bk_server.conf). Default value is "/data/bookkeeper", which contains volumes `/data/bookkeeper/journal`, `/data/bookkeeper/ledgers` and `/data/bookkeeper/index` to hold Bookkeeper data in docker. diff --git a/docker/scripts/common.sh b/docker/scripts/common.sh index 0f745db4b45..0b188eefc0b 100755 --- a/docker/scripts/common.sh +++ b/docker/scripts/common.sh @@ -36,7 +36,7 @@ export BK_metadataServiceUri=${BK_metadataServiceUri:-"zk://${BK_zkServers}${BK_ export BK_bookiePort=${BK_bookiePort:-${PORT0}} export BK_httpServerEnabled=${BK_httpServerEnabled:-"true"} export BK_httpServerPort=${BK_httpServerPort:-${BOOKIE_HTTP_PORT}} -export BK_journalDirectory=${BK_journalDirectory:-${BK_DATA_DIR}/journal} +export BK_journalDirectories=${BK_journalDirectories:-${BK_journalDirectory:-${BK_DATA_DIR}/journal}} export BK_ledgerDirectories=${BK_ledgerDirectories:-${BK_DATA_DIR}/ledgers} export BK_indexDirectories=${BK_indexDirectories:-${BK_ledgerDirectories}} # dlog @@ -55,7 +55,7 @@ echo "" echo " [bookie]" echo " BK_bookiePort bookie service port is $BK_bookiePort" echo " BK_DATA_DIR is $BK_DATA_DIR" -echo " BK_journalDirectory is ${BK_journalDirectory}" +echo " BK_journalDirectories is ${BK_journalDirectories}" echo " BK_ledgerDirectories are ${BK_ledgerDirectories}" echo " BK_indexDirectories are ${BK_indexDirectories}" echo "" @@ -77,15 +77,15 @@ export BOOKIE_CONF=${BK_HOME}/conf/bk_server.conf export SERVICE_PORT=${PORT0} function create_bookie_dirs() { - mkdir -p "${BK_journalDirectory}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" + mkdir -p "${BK_journalDirectories}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" echo "Created bookie dirs : " - echo " journal = ${BK_journalDirectory}" + echo " journal = ${BK_journalDirectories}" echo " ledger = ${BK_ledgerDirectories}" echo " index = ${BK_indexDirectories}" # -------------- # # Allow the container to be started with `--user` if [ "$(id -u)" = '0' ]; then - chown -R "${BK_USER}:${BK_USER}" "${BK_journalDirectory}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" + chown -R "${BK_USER}:${BK_USER}" "${BK_journalDirectories}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" fi # -------------- # } diff --git a/tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh b/tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh index 4248862648b..32e4ed37ba1 100644 --- a/tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh +++ b/tests/docker-images/all-versions-image/scripts/update-conf-and-boot.sh @@ -20,7 +20,7 @@ mkdir -p $BK_JOURNALDIR $BK_LEDGERDIR -sed -i "s|journalDirectory=.*|journalDirectory=$BK_JOURNALDIR|" /opt/bookkeeper/*/conf/bk_server.conf +sed -i "s|journalDirectories=.*|journalDirectories=$BK_JOURNALDIR|" /opt/bookkeeper/*/conf/bk_server.conf sed -i "s|ledgerDirectories=.*|ledgerDirectories=$BK_LEDGERDIR|" /opt/bookkeeper/*/conf/bk_server.conf sed -i "s|zkServers=.*|zkServers=$BK_ZKCONNECTSTRING|" /opt/bookkeeper/*/conf/bk_server.conf