This is an automated email from the ASF dual-hosted git repository.
binbin pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 86abc210 Allow create-cluster to be run from other dirs, not just its
own dir (#1773)
86abc210 is described below
commit 86abc210149890c5bfcfaccecbd87bd4c19d5de6
Author: Binbin <[email protected]>
AuthorDate: Thu Sep 21 16:05:38 2023 +0800
Allow create-cluster to be run from other dirs, not just its own dir (#1773)
The current harcode directory causes us to only run create-cluster
in the create-cluster directory. This PR makes it possible to run
create-cluster from any dir, not just its own dir.
---
utils/create-cluster/create-cluster | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/utils/create-cluster/create-cluster
b/utils/create-cluster/create-cluster
index 3d15cdd0..3b6f3f5d 100755
--- a/utils/create-cluster/create-cluster
+++ b/utils/create-cluster/create-cluster
@@ -18,7 +18,9 @@
# under the License.
# Settings
-BIN_PATH="../../build/"
+SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd
)"
+BIN_PATH="$SCRIPT_DIR/../../build/"
+DEFAULT_CONF_PATH="$SCRIPT_DIR/default.conf"
HOST=127.0.0.1
PORT=30000
NODES=6
@@ -60,7 +62,7 @@ then
echo "Starting $PORT"
mkdir node_${PORT}
conf_file="node_${PORT}.conf"
- cp ./default.conf ${conf_file}
+ cp ${DEFAULT_CONF_PATH} ${conf_file}
sed -i.bak "s|pidfile.*|pidfile node_${PORT}.pid|g" ${conf_file} &&
rm ${conf_file}.bak
sed -i.bak "s|port.*|port ${PORT}|g" ${conf_file} && rm
${conf_file}.bak
sed -i.bak "s|dir.*|dir "node_${PORT}"|g" ${conf_file} && rm
${conf_file}.bak