You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2020/08/19 02:09:49 UTC

[GitHub] [incubator-pegasus] acelyc111 commented on a change in pull request #576: fix(script): operation return before the cluster balance when using pegasus_rolling_update.sh

acelyc111 commented on a change in pull request #576:
URL: https://github.com/apache/incubator-pegasus/pull/576#discussion_r472591196



##########
File path: scripts/pegasus_rebalance_cluster.sh
##########
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# Pegasus cluster rebalance 
+#
+
+PID=$$
+
+if [ $# -le 2 ]; then
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <only_move_primary>"

Review comment:
       unify to use `-` or `_`

##########
File path: scripts/pegasus_rebalance_cluster.sh
##########
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# Pegasus cluster rebalance 
+#
+
+PID=$$
+
+if [ $# -le 2 ]; then
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <only_move_primary>"
+  echo
+  echo "for example:"
+  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 true"
+  echo
+  exit 1
+fi
+
+cluster=$1
+meta_list=$2
+only_move_primary=$3
+
+pwd="$( cd "$( dirname "$0"  )" && pwd )"
+shell_dir="$( cd $pwd/.. && pwd )"
+cd $shell_dir
+
+source ./scripts/minos_common.sh
+find_cluster $cluster
+if [ $? -ne 0 ]; then
+  echo "ERROR: cluster \"$cluster\" not found"
+  exit 1
+fi
+
+echo "UID=$UID"
+echo "PID=$PID"
+echo "Start time: `date`"
+rebalance_start_time=$((`date +%s`))
+echo
+
+echo "Generating /tmp/$UID.$PID.pegasus.rebalance.cluster_info..."
+echo cluster_info | ./run.sh shell --cluster $meta_list 2>&1 | sed 's/ *$//' >/tmp/$UID.$PID.pegasus.rebalance.cluster_info
+cname=`grep zookeeper_root /tmp/$UID.$PID.pegasus.rebalance.cluster_info | grep -o '/[^/]*$' | grep -o '[^/]*$'`

Review comment:
       It's very hard to read these code, JSON format output is supported, could you plz to use JSON?

##########
File path: scripts/pegasus_rebalance_cluster.sh
##########
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# Pegasus cluster rebalance 
+#
+
+PID=$$
+
+if [ $# -le 2 ]; then
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <only_move_primary>"
+  echo
+  echo "for example:"
+  echo "  $0 onebox 127.0.0.1:34601,127.0.0.1:34602 true"
+  echo
+  exit 1
+fi
+
+cluster=$1
+meta_list=$2
+only_move_primary=$3
+
+pwd="$( cd "$( dirname "$0"  )" && pwd )"
+shell_dir="$( cd $pwd/.. && pwd )"
+cd $shell_dir
+
+source ./scripts/minos_common.sh
+find_cluster $cluster
+if [ $? -ne 0 ]; then
+  echo "ERROR: cluster \"$cluster\" not found"
+  exit 1
+fi
+
+echo "UID=$UID"
+echo "PID=$PID"
+echo "Start time: `date`"
+rebalance_start_time=$((`date +%s`))
+echo
+
+echo "Generating /tmp/$UID.$PID.pegasus.rebalance.cluster_info..."
+echo cluster_info | ./run.sh shell --cluster $meta_list 2>&1 | sed 's/ *$//' >/tmp/$UID.$PID.pegasus.rebalance.cluster_info
+cname=`grep zookeeper_root /tmp/$UID.$PID.pegasus.rebalance.cluster_info | grep -o '/[^/]*$' | grep -o '[^/]*$'`

Review comment:
       We are also plan to refactor remote commands to HTTP APIs, the latter will output in JSON format, we can reuse these JSON parser code then.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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