Skip to content

Commit

Permalink
refactor: update default nfs copy rate when add_node_list and offline…
Browse files Browse the repository at this point in the history
…_node_list (#714)
foreverneverer authored Apr 12, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 42f78aa commit 62e4b1f
Showing 3 changed files with 41 additions and 7 deletions.
12 changes: 9 additions & 3 deletions scripts/pegasus_add_node_list.sh
Original file line number Diff line number Diff line change
@@ -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`))
18 changes: 16 additions & 2 deletions scripts/pegasus_offline_node_list.sh
Original file line number Diff line number Diff line change
@@ -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`
18 changes: 16 additions & 2 deletions scripts/pegasus_rebalance_cluster.sh
Original file line number Diff line number Diff line change
@@ -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`

0 comments on commit 62e4b1f

Please sign in to comment.