This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit dedc52a0226cb6d42481510f10cefb3c9f167d2a
Author: Andrew Wong <[email protected]>
AuthorDate: Fri Jan 15 20:20:15 2021 -0800

    scripts: add extra flags to start_kudu.sh
    
    This adds the following configurations to start_kudu.sh:
    --clusterdir: allows users to specify the base directory for the
    cluster, rather than always defaulting to using the build directory.
    --tserver-flags: extra gflags to add to the tablet servers.
    --master-flags: extra gflags to add to the master servers.
    
    I found these useful in creating some data in a cluster with specific
    gflags with one executable, and "upgrading" the cluster to use a
    different executable while using that same data.
    
    Here's an example:
    
    /data/8/awong/Repositories/kudu/src/kudu/scripts/start_kudu.sh \
        -b /data/8/awong/kudu-1.4.x/build/release \
        -c /data/8/awong/kudu-1.4.x/build/release/kudu-2233-cluster \
        -T "--flush_threshold_secs=1 --flush_threshold_mb=1 
--raft_enable_pre_election=false \
            --consensus_inject_latency_ms_in_notifications=100 \
            --leader_failure_max_missed_heartbeat_periods=0.1 
--log_segment_size_mb=1 \
            --raft_heartbeat_interval_ms=50 --unlock_experimental_flags"
    
    Change-Id: Ic8808570259b084970c228fcac5cb4ea7e0b8d1e
    Reviewed-on: http://gerrit.cloudera.org:8080/16958
    Tested-by: Andrew Wong <[email protected]>
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/scripts/start_kudu.sh | 44 +++++++++++++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/src/kudu/scripts/start_kudu.sh b/src/kudu/scripts/start_kudu.sh
index 38607d5..baf733c 100755
--- a/src/kudu/scripts/start_kudu.sh
+++ b/src/kudu/scripts/start_kudu.sh
@@ -28,16 +28,21 @@ function usage() {
 cat << EOF
 Usage:
 start_kudu.sh [flags]
--h, --help         Print help
--m, --num-masters  Number of Kudu Masters to start (default: 1)
--t, --num-tservers Number of Kudu Tablet Servers to start (default: 3)
---rpc-master       RPC port of first Kudu Master; HTTP port is the next number.
-                   Subsequent Masters will have following numbers
---rpc-tserver      RPC port of first Kudu Tablet Server; HTTP port is the next
-                   number. Subsequent Tablet Servers will have following 
numbers
---time_source      Time source for Kudu Masters and Tablet Servers
-                   (default: system_unsync)
--b, --builddir     Path to the Kudu build directory
+-h, --help          Print help
+-m, --num-masters   Number of Kudu Masters to start (default: 1)
+-t, --num-tservers  Number of Kudu Tablet Servers to start (default: 3)
+--rpc-master        RPC port of first Kudu Master; HTTP port is the next 
number.
+                    Subsequent Masters will have following numbers
+--rpc-tserver       RPC port of first Kudu Tablet Server; HTTP port is the next
+                    number. Subsequent Tablet Servers will have following 
numbers
+--time_source       Time source for Kudu Masters and Tablet Servers
+                    (default: system_unsync)
+-b, --builddir      Path to the Kudu build directory
+-c  --clusterdir    Path to place the Kudu masters and tablet servers.
+-T, --tserver-flags Extra flags to be used on the tablet servers. Multiple
+                    flags can be specified if wrapped in ""s.
+-M, --master-flags  Extra flags to be used on the master servers. Multiple
+                    flags can be specified if wrapped in ""s.
 EOF
 }
 
@@ -47,6 +52,9 @@ MASTER_RPC_PORT_BASE=8764
 TSERVER_RPC_PORT_BASE=9870
 TIME_SOURCE=system_unsync
 BUILDDIR="$PWD"
+CLUSTER_DIR="$PWD"
+EXTRA_TSERVER_FLAGS=""
+EXTRA_MASTER_FLAGS=""
 echo $(readlink -f $(dirname $0))
 while (( "$#" )); do
   case "$1" in
@@ -78,6 +86,18 @@ while (( "$#" )); do
       BUILDDIR="$2"
       shift 2
       ;;
+    -c|--clusterdir)
+      CLUSTER_DIR=$2
+      shift 2
+      ;;
+    -T|--tserver-flags)
+      EXTRA_TSERVER_FLAGS=$2
+      shift 2
+      ;;
+    -M|--master-flags)
+      EXTRA_MASTER_FLAGS=$2
+      shift 2
+      ;;
     --) # end argument parsing
       shift
       break
@@ -112,7 +132,7 @@ IP=127.0.0.1
 # 1) Create "data", "wal" and "log" directories for a server before start
 
 function create_dirs_and_set_vars() {
-  root_dir="$BUILDDIR/$1"
+  root_dir="$CLUSTER_DIR/$1"
   dir_data="$root_dir/data"
   dir_wal="$root_dir/wal"
   dir_log="$root_dir/log"
@@ -150,6 +170,7 @@ function start_master() {
   ARGS="$ARGS --webserver_port=$HTTP_PORT"
   ARGS="$ARGS --webserver_interface=$IP"
   ARGS="$ARGS --webserver_doc_root=$WEBSERVER_DOC_ROOT"
+  ARGS="$ARGS $EXTRA_MASTER_FLAGS"
   $ARGS &
   pids+=($!)
 }
@@ -170,6 +191,7 @@ function start_tserver() {
   ARGS="$ARGS --webserver_interface=$IP"
   ARGS="$ARGS --webserver_doc_root=$WEBSERVER_DOC_ROOT"
   ARGS="$ARGS --tserver_master_addrs=$4"
+  ARGS="$ARGS $EXTRA_TSERVER_FLAGS"
   $ARGS &
   pids+=($!)
 }

Reply via email to