Forked from markusklems/bootstrap-riak-cluster.sh
Last active
December 21, 2015 12:29
-
-
Save bugra-derre/6305987 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 -ex | |
# Stop the Riak node | |
service riak stop | |
# Change standard IP to the Riak node's eth0 IP | |
my_ip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'` | |
sed -ire "s/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\"\, 8087/$my_ip\"\, 8087/g" /etc/riak/app.config | |
sed -ire "s/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\"\, 8098/$my_ip\"\, 8098/g" /etc/riak/app.config | |
sed -ire "s/\-name riak\@[0-9]*(\.[0-9]*){3}/\-name riak\@$my_ip/" /etc/riak/vm.args | |
# Get rid of old Riak data and info | |
rm -rf /var/lib/riak/ring/* | |
rm -rf /var/lib/riak/anti_entropy/* | |
rm -rf /var/lib/riak/bitcask/* | |
rm -rf /var/lib/riak/kv_node/* | |
# Start the Riak node again | |
service riak start | |
# If you are not the first node, join the party. | |
if [ -n "$1" ] ; then | |
sudo /usr/sbin/riak-admin cluster join "riak@$1" | |
sudo /usr/sbin/riak-admin cluster plan | |
sudo /usr/sbin/riak-admin cluster commit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment