You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by ji...@apache.org on 2021/06/23 10:42:40 UTC

[incubator-pegasus] 03/05: refactor: update default nfs copy rate when add_node_list and offline_node_list (#714)

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

jiashuo pushed a commit to branch v2.2.1
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git

commit c61baa2727635be147ef8d9a876bbd57df9b2ae9
Author: Jiashuo <js...@live.com>
AuthorDate: Mon Apr 12 09:59:06 2021 +0800

    refactor: update default nfs copy rate when add_node_list and offline_node_list (#714)
---
 scripts/pegasus_add_node_list.sh     | 12 +++++++++---
 scripts/pegasus_offline_node_list.sh | 18 ++++++++++++++++--
 scripts/pegasus_rebalance_cluster.sh | 18 ++++++++++++++++--
 3 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/scripts/pegasus_add_node_list.sh b/scripts/pegasus_add_node_list.sh
index 8617f20..81b4905 100755
--- a/scripts/pegasus_add_node_list.sh
+++ b/scripts/pegasus_add_node_list.sh
@@ -22,10 +22,10 @@
 PID=$$
 
 if [ $# -le 2 ]; then
-  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <replica-task-id-list>"
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <replica-task-id-list> <nfs_copy_rate_megabytes>(default 200)"
   echo
   echo "For example:"
-  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 1,2,3"
+  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 1,2,3 200"
   echo
   exit 1
 fi
@@ -40,6 +40,12 @@ cluster=$1
 meta_list=$2
 replica_task_id_list=$3
 
+if [ -z $4 ]; then
+  nfs_copy_rate_megabytes=200
+else
+  nfs_copy_rate_megabytes=$4
+fi
+
 pwd="$( cd "$( dirname "$0"  )" && pwd )"
 shell_dir="$( cd $pwd/.. && pwd )"
 cd $shell_dir
@@ -71,7 +77,7 @@ do
   echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
 done
 
-./scripts/pegasus_rebalance_cluster.sh $cluster $meta_list true
+./scripts/pegasus_rebalance_cluster.sh $cluster $meta_list true $nfs_copy_rate_megabytes
 
 echo "Finish time: `date`"
 add_node_finish_time=$((`date +%s`))
diff --git a/scripts/pegasus_offline_node_list.sh b/scripts/pegasus_offline_node_list.sh
index 55fed3b..86fb735 100755
--- a/scripts/pegasus_offline_node_list.sh
+++ b/scripts/pegasus_offline_node_list.sh
@@ -22,10 +22,10 @@
 PID=$$
 
 if [ $# -le 2 ]; then
-  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <replica-task-id-list>"
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <replica-task-id-list> <nfs_copy_rate_megabytes>(default 100)>"
   echo
   echo "For example:"
-  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 1,2,3"
+  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 1,2,3 100"
   echo
   exit 1
 fi
@@ -40,6 +40,12 @@ cluster=$1
 meta_list=$2
 replica_task_id_list=$3
 
+if [ -z $4 ]; then
+  nfs_copy_rate_megabytes=100
+else
+  nfs_copy_rate_megabytes=$4
+fi
+
 pwd="$( cd "$( dirname "$0"  )" && pwd )"
 shell_dir="$( cd $pwd/.. && pwd )"
 cd $shell_dir
@@ -52,6 +58,14 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+echo "Set nfs_copy_rate_megabytes $nfs_copy_rate_megabytes"
+echo "remote_command -t replica-server replica.nfs.max_copy_rate_megabytes $nfs_copy_rate_megabytes" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.offline_node_list.set_nfs_copy_rate_megabytes
+set_ok=`grep 'succeed: OK' /tmp/$UID.$PID.pegasus.offline_node_list.set_nfs_copy_rate_megabytes | wc -l`
+if [ $set_ok -le 0 ]; then
+  echo "ERROR: set nfs_copy_rate_megabytes failed"
+  exit 1
+fi
+
 echo "Set lb.assign_secondary_black_list..."
 echo "remote_command -l $pmeta meta.lb.assign_secondary_black_list $address_list" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list
 set_ok=`grep "set ok" /tmp/$UID.$PID.pegasus.offline_node_list.assign_secondary_black_list | wc -l`
diff --git a/scripts/pegasus_rebalance_cluster.sh b/scripts/pegasus_rebalance_cluster.sh
index b0fb46d..62f70c7 100755
--- a/scripts/pegasus_rebalance_cluster.sh
+++ b/scripts/pegasus_rebalance_cluster.sh
@@ -22,10 +22,10 @@
 PID=$$
 
 if [ $# -le 1 ]; then
-  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <only-move-primary>(default false)"
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <only-move-primary>(default false) <nfs_copy_rate_megabytes>(default 100)"
   echo 
   echo "for example:"
-  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 true"
+  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 true 100"
   echo
   exit 1
 fi
@@ -39,6 +39,12 @@ else
   only_move_primary=$3
 fi
 
+if [ -z $4 ]; then
+  nfs_copy_rate_megabytes=100
+else
+  nfs_copy_rate_megabytes=$4
+fi
+
 pwd="$( cd "$( dirname "$0"  )" && pwd )"
 shell_dir="$( cd $pwd/.. && pwd )"
 cd $shell_dir
@@ -82,6 +88,14 @@ if [ "$only_move_primary" == "true" ]; then
 fi
 echo
 
+echo "Set nfs_copy_rate_megabytes $nfs_copy_rate_megabytes"
+echo "remote_command -t replica-server replica.nfs.max_copy_rate_megabytes $nfs_copy_rate_megabytes" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.cluster_rebalance.set_nfs_copy_rate_megabytes
+set_ok=`grep 'succeed: OK' /tmp/$UID.$PID.pegasus.cluster_rebalance.set_nfs_copy_rate_megabytes | wc -l`
+if [ $set_ok -le 0 ]; then
+  echo "ERROR: set nfs_copy_rate_megabytes failed"
+  exit 1
+fi
+
 echo "Set meta level to lively..."
 echo "set_meta_level lively" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.rebalance.set_meta_level
 set_ok=`grep 'control meta level ok' /tmp/$UID.$PID.pegasus.rebalance.set_meta_level | wc -l`

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org