Browse Source

Add ability to sleep a bit between each command that's submitted to a slave, to meter slave commands a bit.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@384340 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 years ago
parent
commit
45d0820258
2 changed files with 9 additions and 0 deletions
  1. 4 0
      bin/slaves.sh
  2. 5 0
      conf/hadoop-env.sh.template

+ 4 - 0
bin/slaves.sh

@@ -6,6 +6,7 @@
 #
 #   HADOOP_SLAVES    File naming remote hosts.  Default is ~/.slaves
 #   HADOOP_CONF_DIR  Alternate conf dir. Default is ${HADOOP_HOME}/conf.
+#   HADOOP_SLAVE_SLEEP Seconds to sleep between spawning remote commands.
 ##
 
 usage="Usage: slaves.sh command..."
@@ -54,6 +55,9 @@ fi
 for slave in `cat "$HADOOP_SLAVES"`; do
  ssh $HADOOP_SSH_OPTS $slave $"${@// /\\ }" \
    2>&1 | sed "s/^/$slave: /" &
+ if [ "$HADOOP_SLAVE_SLEEP" != "" ]; then
+   sleep $HADOOP_SLAVE_SLEEP
+ fi
 done
 
 wait

+ 5 - 0
conf/hadoop-env.sh.template

@@ -26,6 +26,11 @@
 # host:path where hadoop code should be rsync'd from.  Unset by default.
 # export HADOOP_MASTER=master:/home/$USER/src/hadoop
 
+# Seconds to sleep between slave commands.  Unset by default.  This
+# can be useful in large clusters, where, e.g., slave rsyncs can
+# otherwise arrive faster than the master can service them.
+# export HADOOP_SLAVE_SLEEP=0.1
+
 # The directory where pid files are stored. /tmp by default.
 # export HADOOP_PID_DIR=/var/hadoop/pids