Browse Source

HADOOP-11296. hadoop-daemons.sh throws 'host1: bash: host3: command not found...' (Contributed by Vinayakumar B)

Vinayakumar B 10 years ago
parent
commit
92ce6eda92

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -355,6 +355,9 @@ Trunk (Unreleased)
 
 
     HADOOP-11298. slaves.sh and stop-all.sh are missing slashes (aw)
     HADOOP-11298. slaves.sh and stop-all.sh are missing slashes (aw)
 
 
+    HADOOP-11296. hadoop-daemons.sh throws 'host1: bash: host3: 
+    command not found...' (vinayakumarb)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
     HADOOP-7761. Improve the performance of raw comparisons. (todd)
     HADOOP-7761. Improve the performance of raw comparisons. (todd)

+ 6 - 0
hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh

@@ -273,6 +273,12 @@ function hadoop_connect_to_hosts
     # moral of the story: just use pdsh.
     # moral of the story: just use pdsh.
     export -f hadoop_actual_ssh
     export -f hadoop_actual_ssh
     export HADOOP_SSH_OPTS
     export HADOOP_SSH_OPTS
+
+    # xargs is used with option -I to replace the placeholder in arguments
+    # list with each hostname read from stdin/pipe. But it consider one 
+    # line as one argument while reading from stdin/pipe. So place each 
+    # hostname in different lines while passing via pipe.
+    SLAVE_NAMES=$(echo "$SLAVE_NAMES" | tr ' ' '\n' )
     echo "${SLAVE_NAMES}" | \
     echo "${SLAVE_NAMES}" | \
     xargs -n 1 -P"${HADOOP_SSH_PARALLEL}" \
     xargs -n 1 -P"${HADOOP_SSH_PARALLEL}" \
     -I {} bash -c --  "hadoop_actual_ssh {} ${params}"
     -I {} bash -c --  "hadoop_actual_ssh {} ${params}"