Created
September 25, 2015 03:53
-
-
Save vicenteg/e7bb359d63c966ee6859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if maprcli node list -columns id; then | |
NODEID=$(maprcli node list -columns id -filter hostname==`hostname -f` -noheader | cut -f 1 -d ' ') | |
NODEVOLUMES=$(maprcli volume list -columns volumename | egrep "^mapr.`hostname -f`") | |
for volume in $NODEVOLUMES; do | |
maprcli volume remove -name $volume | |
done | |
maprcli node move -serverids $NODEID -topology /decomissioned | |
# Poll here for complete volume re-replication | |
sudo service mapr-warden stop | |
while :; do | |
HEARTBEAT_ALARMS=$(maprcli alarm list -entity `hostname -f` -type node -noheader | grep NODE_ALARM_NO_HEARTBEAT | wc -l) | |
if [ $HEARTBEAT_ALARMS == 1 ]; then | |
maprcli node remove -nodes `hostname -f` | |
break | |
fi | |
sleep 20 | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment