incubator-bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1189561 - in /incubator/bigtop/trunk/bigtop-packages/src: deb/hadoop/service-init.d.tpl rpm/hadoop/SOURCES/hadoop-init.tmpl rpm/hadoop/SOURCES/hadoop-init.tmpl.suse
Date Thu, 27 Oct 2011 00:40:43 GMT
Author: rvs
Date: Thu Oct 27 00:40:42 2011
New Revision: 1189561

URL: http://svn.apache.org/viewvc?rev=1189561&view=rev
Log:
BIGTOP-189. hadoop daemons do not run under the dedicated users (hdfs, mapred)

Modified:
    incubator/bigtop/trunk/bigtop-packages/src/deb/hadoop/service-init.d.tpl
    incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl
    incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl.suse

Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hadoop/service-init.d.tpl
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hadoop/service-init.d.tpl?rev=1189561&r1=1189560&r2=1189561&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-packages/src/deb/hadoop/service-init.d.tpl (original)
+++ incubator/bigtop/trunk/bigtop-packages/src/deb/hadoop/service-init.d.tpl Thu Oct 27 00:40:42
2011
@@ -150,7 +150,9 @@ hadoop_stop_pidfile() {
 }
 
 start() {
-
+    TARGET_USER_NAME="HADOOP_`echo @HADOOP_DAEMON@ | tr a-z A-Z`_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+    
     if [ "@HADOOP_DAEMON@" = "datanode" ]; then
       # The following needs to be removed once HDFS-1943 gets finally put to rest.
       # The logic of this ugly hack is this: IFF we do NOT have jsvc installed it is
@@ -161,18 +163,14 @@ start() {
       #    1. HADOOP_DATANODE_USER being set to root
       #    2. jsvc is installed but Hadoop is configures to run in an unsecure mode
       # Both will currently fail
-      if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] ; then
-         DN_USER=root
-      else
-         DN_USER=$HADOOP_DATANODE_USER
+      if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] &&
[ -n "$HADOOP_SECURE_DN_USER" ]; then
+         TARGET_USER=root
       fi
-      su -s /bin/bash $DN_USER -c "$HADOOP_HOME/bin/hadoop-daemon.sh start @HADOOP_DAEMON@
$DAEMON_FLAGS"
-      # Some processes are slow to start
-      sleep $SLEEP_TIME
-    else
-      $HADOOP_HOME/bin/hadoop-daemon.sh start @HADOOP_DAEMON@ $DAEMON_FLAGS
     fi
+    su -s /bin/bash $TARGET_USER -c "$HADOOP_HOME/bin/hadoop-daemon.sh start @HADOOP_DAEMON@
$DAEMON_FLAGS"
 
+    # Some processes are slow to start
+    sleep $SLEEP_TIME
 }
 stop() {
     $HADOOP_HOME/bin/hadoop-daemon.sh stop @HADOOP_DAEMON@

Modified: incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl?rev=1189561&r1=1189560&r2=1189561&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl (original)
+++ incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl Thu Oct
27 00:40:42 2011
@@ -51,6 +51,9 @@ SLEEP_TIME=5
 start() {
   echo -n $"Starting $desc (hadoop-@HADOOP_DAEMON@): "
 
+  TARGET_USER_NAME="HADOOP_`echo @HADOOP_DAEMON@ | tr a-z A-Z`_USER"
+  TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+
   if [ "@HADOOP_DAEMON@" = "datanode" ]; then
     # The following needs to be removed once HDFS-1943 gets finally put to rest.
     # The logic of this ugly hack is this: IFF we do NOT have jsvc installed it is
@@ -61,21 +64,16 @@ start() {
     #    1. HADOOP_DATANODE_USER being set to root
     #    2. jsvc is installed but Hadoop is configures to run in an unsecure mode
     # Both will currently fail
-    if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] ; then
-       DN_USER=root
-    else
-       DN_USER=$HADOOP_DATANODE_USER
+    if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] &&
[ -n "$HADOOP_SECURE_DN_USER" ]; then
+      TARGET_USER=root
     fi
-    su -s /bin/bash $DN_USER -c "@HADOOP_COMMON_ROOT@/bin/hadoop-daemon.sh --config '@HADOOP_CONF_DIR@'
start @HADOOP_DAEMON@ $DAEMON_FLAGS"
-
-    # Some processes are slow to start
-    sleep $SLEEP_TIME
-    checkstatus
-    RETVAL=$?
-  else
-    daemon @HADOOP_COMMON_ROOT@/bin/hadoop-daemon.sh --config "@HADOOP_CONF_DIR@" start @HADOOP_DAEMON@
$DAEMON_FLAGS
-    RETVAL=$?
   fi
+  su -s /bin/bash $TARGET_USER -c "@HADOOP_COMMON_ROOT@/bin/hadoop-daemon.sh --config '@HADOOP_CONF_DIR@'
start @HADOOP_DAEMON@ $DAEMON_FLAGS"
+
+  # Some processes are slow to start
+  sleep $SLEEP_TIME
+  checkstatus
+  RETVAL=$?
 
   [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
   return $RETVAL

Modified: incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl.suse
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl.suse?rev=1189561&r1=1189560&r2=1189561&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl.suse (original)
+++ incubator/bigtop/trunk/bigtop-packages/src/rpm/hadoop/SOURCES/hadoop-init.tmpl.suse Thu
Oct 27 00:40:42 2011
@@ -73,6 +73,9 @@ start() {
   [ -f $config ] || exit $ERROR_PROGRAM_NOT_CONFIGURED
   log_success_msg "Starting $desc (hadoop-@HADOOP_DAEMON@): "
 
+  TARGET_USER_NAME="HADOOP_`echo @HADOOP_DAEMON@ | tr a-z A-Z`_USER"
+  TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+
   if [ "@HADOOP_DAEMON@" = "datanode" ]; then
     # The following needs to be removed once HDFS-1943 gets finally put to rest.
     # The logic of this ugly hack is this: IFF we do NOT have jsvc installed it is
@@ -83,21 +86,16 @@ start() {
     #    1. HADOOP_DATANODE_USER being set to root
     #    2. jsvc is installed but Hadoop is configures to run in an unsecure mode
     # Both will currently fail
-    if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] ; then
-       DN_USER=root
-    else
-       DN_USER=$HADOOP_DATANODE_USER
+    if [ -f $HADOOP_HOME/libexec/jsvc.amd64 -o -f $HADOOP_HOME/libexec/jsvc.i386 ] &&
[ -n "$HADOOP_SECURE_DN_USER" ]; then
+      TARGET_USER=root
     fi
-    su -s /bin/bash $DN_USER -c "$EXEC_PATH --config '$CONFIG_PATH' start @HADOOP_DAEMON@
$DAEMON_FLAGS"
-
-    # Some processes are slow to start
-    sleep $SLEEP_TIME
-    checkstatusofproc
-    RETVAL=$?
-  else
-    start_daemon $EXEC_PATH --config "$CONFIG_PATH" start @HADOOP_DAEMON@ $DAEMON_FLAGS
-    RETVAL=$?
   fi
+  su -s /bin/bash $TARGET_USER -c "$EXEC_PATH --config '$CONFIG_PATH' start @HADOOP_DAEMON@
$DAEMON_FLAGS"
+
+  # Some processes are slow to start
+  sleep $SLEEP_TIME
+  checkstatusofproc
+  RETVAL=$?
 
   [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
   return $RETVAL



Mime
View raw message