Skip to content

Instantly share code, notes, and snippets.

@dehowell
Created August 14, 2011 00:11
Show Gist options
  • Save dehowell/1144400 to your computer and use it in GitHub Desktop.
Save dehowell/1144400 to your computer and use it in GitHub Desktop.
Script to initiate a single node Hadoop cluster in a tmux session
#!/bin/bash
#
# Script to initiate (or connect to) a single node Hadoop cluster in a
# tmux session. Requires that tmux and hadoop are on your path.
SESSION=hadoop
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
echo "Session $SESSION already exists. Attaching."
sleep 1
tmux attach -t $SESSION
exit 0;
fi
tmux new-session -d -s $SESSION 2> /dev/null
tmux new-window -t $SESSION:0 -k -n namenode 'hadoop namenode'
tmux new-window -t $SESSION:1 -n datanode 'hadoop datanode'
tmux new-window -t $SESSION:2 -n jobtracker 'hadoop jobtracker'
tmux new-window -t $SESSION:3 -n tasktracker 'hadoop tasktracker'
tmux attach -t $SESSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment