Skip to content

Instantly share code, notes, and snippets.

View markusklems's full-sized avatar

Markus Klems markusklems

View GitHub Profile
@markusklems
markusklems / install_cassandra.sh
Created December 5, 2012 11:08
install_cassandra.sh
#!/bin/sh -ex
## Install Apache Cassandra and dependencies.
## The scripts are based on a combination of the DataStax ComboAMI scripts,
## the whirr cassandra scripts and my own scripts.
## By Markus Klems (2012).
## Tested with Ubuntu 11.10 (ami-cdc072a4).
################################
### NO WARRANTIES WHATSOEVER ###
################################
export DEBIAN_FRONTEND=noninteractive
@markusklems
markusklems / install_ycsb.sh
Created December 6, 2012 22:37
install_ycsb.sh
#!/bin/bash
hosts=""
for host in $@; do
hosts="$host,$hosts"
done
#remove last character
hosts=${hosts%?}
wget https://github.com/downloads/brianfrankcooper/YCSB/ycsb-0.1.4.tar.gz
tar xfvz ycsb-0.1.4.tar.gz
#!/bin/bash -ex
# Riak install and config script snippets
# For Ubuntu
# http://docs.basho.com/riak/latest/tutorials/installation/Installing-on-Debian-and-Ubuntu/
# 1. First you must get the signing key.
curl http://apt.basho.com/gpg/basho.apt.key | sudo apt-key add -
# 2. Then add the Basho repository to your apt sources list (and update them).
#!/bin/bash -ex
# Riak install and config script snippets
# http://docs.basho.com/riak/latest/ops/building/installing/debian-ubuntu/
# http://docs.basho.com/riak/latest/tutorials/installation/Installing-on-RHEL-and-CentOS/
if which dpkg &> /dev/null; then
curl http://apt.basho.com/gpg/basho.apt.key | sudo apt-key add -
sudo bash -c "echo deb http://apt.basho.com $(lsb_release -sc) main > /etc/apt/sources.list.d/basho.list"
sudo apt-get update
#!/bin/bash -ex
# Make sure the Riak cluster is stopped
sudo /usr/sbin/riak stop
# Change IP from 127.0.0.1 to whatever the eth0 ip is
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 -i -e "s|127.0.0.1|$my_ip|" /etc/riak/app.config
sed -i -e "s|127.0.0.1|$my_ip|" /etc/riak/vm.args
# Get rid of old info that is stored on the node
sudo rm -rf /var/lib/riak/ring/*
@markusklems
markusklems / DBWrapper
Created July 15, 2013 15:05
Modified DBWrapper records null rows as -2 errors.
/**
* Copyright (c) 2010 Yahoo! Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
#!/bin/bash -ex
cat >sysctl.conf <<END_OF_FILE
vm.swappiness = 0
net.ipv4.tcp_max_syn_backlog = 40000
net.core.somaxconn=4000
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_fin_timeout = 15
#!/bin/bash
sudo apt-get install haproxy
echo "
listen riak 0.0.0.0:8087
balance leastconn
mode tcp
option tcplog
option contstats
#!/bin/bash
sudo apt-get install -y xfsprogs
sudo lvcreate -l 100%FREE -n riak-data ubuntu-vg
sudo mkfs.xfs /dev/ubuntu-vg/riak-data
sudo mkdir /riak-data
echo "/dev/ubuntu-vg/riak-data /riak-data xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mount -a
sudo ln -s /riak-data/riak /var/lib
#!/bin/bash
sudo lvcreate -l 100%FREE -n riak-data ubuntu-vg
sudo mkfs.ext4 /dev/ubuntu-vg/riak-data
sudo mkdir -p /riak-data/riak
echo "/dev/ubuntu-vg/riak-data /riak-data ext4 default 0 0" | sudo tee -a /etc/fstab
sudo mount -a
sudo ln -s /riak-data/riak /var/lib