Commit b73a1da7 authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-49 Changed Apache HDFS and Yarn init script to use hduser.

parent a04b4777
......@@ -11,7 +11,7 @@
- format-hdfs
- name: Start Apache HDFS.
shell: su - hduser -c "/etc/init.d/hdfs-init start > /dev/null &"
shell: /etc/init.d/hdfs-init start > /dev/null &
tags:
- start-hdfs
......@@ -21,7 +21,7 @@
- start-hdfs
- name: Start Apache Yarn.
shell: su - hduser -c "/etc/init.d/yarn-init start > /dev/null &"
shell: /etc/init.d/yarn-init start > /dev/null &
tags:
- start-yarn
......
......@@ -3,6 +3,9 @@
# Source environment file to make sure JAVA_HOME variable is available.
source /etc/environment
# Define the user that should run this script.
SCRIPT_USER=hduser
# The path where Apache Hadoop is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -16,16 +19,16 @@ START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-dfs.sh"
STOP_COMMAND="$INSTALLATION_PATH/hadoop/sbin/stop-dfs.sh"
start(){
nohup $START_COMMAND > /dev/null &
sudo -u $SCRIPT_USER nohup $START_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER touch $LOCKFILE)
return $RETVAL
}
stop(){
nohup $STOP_COMMAND > /dev/null &
sudo -u $SCRIPT_USER nohup $STOP_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER rm -f $LOCKFILE)
return $RETVAL
}
......
......@@ -3,6 +3,9 @@
# Source environment file to make sure JAVA_HOME variable is available.
source /etc/environment
# Define the user that should run this script.
SCRIPT_USER=hduser
# The path where Apache Hadoop is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -16,16 +19,16 @@ START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-yarn.sh"
STOP_COMMAND="$INSTALLATION_PATH/hadoop/sbin/stop-yarn.sh"
start(){
nohup $START_COMMAND > /dev/null &
sudo -u $SCRIPT_USER nohup $START_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER touch $LOCKFILE)
return $RETVAL
}
stop(){
nohup $STOP_COMMAND > /dev/null &
sudo -u $SCRIPT_USER nohup $STOP_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER rm -f $LOCKFILE)
return $RETVAL
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment