Created
October 25, 2012 21:56
-
-
Save dlecocq/3955693 to your computer and use it in GitHub Desktop.
Riak Bootstrap
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
# Make sure the log directory is writable | |
sudo chmod a+rw /var/log | |
# We need a few tools to make this tick | |
sudo yum install -y mdadm git boost{,-devel} automake libtool flex bison pkgconfig gcc-c++ {libevent,python,zlib,ruby,ncurses,openssl}{,-devel} make | |
# Make sure the log directory is writable | |
sudo chmod a+rw /var/log |
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
# Unmount the default-mounted ephemeral drive | |
sudo umount /media/ephemeral0/ | |
# Now create a software raid and write it to the configuration | |
yes | sudo mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=4 /dev/xvd{b,c,d,e} | |
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf | |
# Edit /etc/fstab and replace the last line with: | |
sudo sed -i '$ d' /etc/fstab | |
echo '/dev/md0 /media/raid ext4 noatime,barrier=0,data=writeback 0 0' | sudo tee -a /etc/fstab | |
# Now make an ext4 on /dev/md0 | |
sudo mkfs.ext4 /dev/md0 | |
# And load it | |
sudo mkdir /media/raid | |
sudo mount /media/raid |
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
# We need erlang in order to build Riak | |
cd && mkdir erlang && cd erlang | |
curl -OL http://erlang.org/download/otp_src_R15B01.tar.gz | |
tar xf otp_src_R15B01.tar.gz | |
cd otp_src_R15B01 | |
# Do the magics | |
./configure && make -j8 && sudo make install |
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
# These are the settings recommended by Riak for using the leveldb backend | |
echo "net.core.wmem_default=8388608 | |
net.core.rmem_default=8388608 | |
net.core.wmem_max=8388608 | |
net.core.rmem_max=8388608 | |
net.core.netdev_max_backlog=10000 | |
net.core.somaxconn=4000 | |
net.ipv4.tcp_max_syn_backlog=40000 | |
net.ipv4.tcp_fin_timeout=15 | |
net.ipv4.tcp_tw_reuse=1 | |
vm.swappiness=0" | sudo tee -a /etc/sysctl.conf | |
# And now make sure they're loaded correctly | |
sudo sysctl -p |
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
# And now, we build Riak from source | |
cd && mkdir riak && cd riak | |
curl -O http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/CURRENT/riak-1.2.1.tar.gz | |
tar xf riak-1.2.1.tar.gz | |
cd riak-1.2.1 | |
# Now do the magics | |
make rel | |
# To make sure that riak is in the user path | |
echo "export PATH=$PATH:/home/ec2-user/riak/riak-1.2.1/rel/riak/bin" >> ~/.bash_profile | |
source ~/.bash_profile | |
# And now for the configuration | |
INTERNAL_IP_ADDRESS=`ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'` | |
RIAK_CONF_PATH=/home/ec2-user/riak/riak-1.2.1/rel/riak/etc/app.config | |
RIAK_VM_PATH=/home/ec2-user/riak/riak-1.2.1/rel/riak/etc/vm.args | |
RIAK_DIR=/media/raid/riak | |
RIAK_DATA_PATH=$RIAK_DIR/data | |
sudo mkdir -p $RIAK_DATA_PATH | |
sudo chown -R ec2-user:ec2-user $RIAK_DIR | |
sed -i "s#riak_kv_bitcask_backend#riak_kv_eleveldb_backend#" $RIAK_CONF_PATH | |
sed -i "s#127.0.0.1#$INTERNAL_IP_ADDRESS#" $RIAK_CONF_PATH | |
sed -i "s#./data#$RIAK_DATA_PATH#" $RIAK_CONF_PATH | |
sed -i "s#127.0.0.1#$INTERNAL_IP_ADDRESS#" $RIAK_VM_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment