Commit 8c4c3f96 authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-49 Created Apache HDFS and Yarn init scripts.

parent e3dec450
......@@ -23,3 +23,9 @@
- name: Configure Apache Yarn.
template: src=yarn-site.xml.j2 dest="{{ installation_path }}/hadoop/etc/hadoop/yarn-site.xml" owner=root group=root mode=0644
- name: Copy Apache HDFS init script.
template: src=hdfs-init.j2 dest=/etc/init.d/hdfs-init owner=root group=root mode=0755
- name: Copy Apache Yarn init script.
template: src=yarn-init.j2 dest=/etc/init.d/yarn-init owner=root group=root mode=0755
#!/bin/bash
# The path where Apache Hadoop is installed.
INSTALLATION_PATH="{{ installation_path }}"
# The full path of the pid file to use.
PIDFILE="$INSTALLATION_PATH/hadoop/hdfs.pid"
# The full path of the lock file to use.
LOCKFILE="$INSTALLATION_PATH/hadoop/hdfs-lock"
# The command that will start Apache HDFS.
START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-dfs.sh"
start(){
touch $PIDFILE
nohup $START_COMMAND & echo $! > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
kill -s 9 $(cat $PIDFILE)
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
}
restart(){
stop
start
}
RETVAL=0
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
[ -f $LOCKFILE ] && restart || :
;;
status)
ps -p $(cat $PIDFILE)
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
RETVAL=1
esac
exit $RETVAL
#!/bin/bash
# The path where Apache Hadoop is installed.
INSTALLATION_PATH="{{ installation_path }}"
# The full path of the pid file to use.
PIDFILE="$INSTALLATION_PATH/hadoop/yarn.pid"
# The full path of the lock file to use.
LOCKFILE="$INSTALLATION_PATH/hadoop/yarn-lock"
# The command that will start Apache Yarn.
START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-yarn.sh"
start(){
touch $PIDFILE
nohup $START_COMMAND & echo $! > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
kill -s 9 $(cat $PIDFILE)
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
}
restart(){
stop
start
}
RETVAL=0
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
[ -f $LOCKFILE ] && restart || :
;;
status)
ps -p $(cat $PIDFILE)
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
RETVAL=1
esac
exit $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