####Nodes
# Cluster1, Node1
10.224.13.24
# Cluster1, Node2
10.249.9.198
# Cluster2, Node1
10.224.8.208
# Cluster2, Node2
10.250.77.34
####Installing Riak 1.3 (each node)
sudo yum install expect
sudo rpm -ivh riak-ee-1.3.1-1.el6.x86_64.rpm
####Config Changes (each node)
#Get IP Address
OS=`uname`
IP=""
case $OS in
Linux) IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
FreeBSD|OpenBSD) IP=`ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'` ;;
SunOS) IP=`ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2} '` ;;
*) IP="Unknown";;
esac
#Replace IP Addresses in Config Files
sudo sed -i "s/riak@127\.0\.0\.1/riak@$IP/g" /etc/riak/vm.args ; sudo sed -i "s/127\.0\.0\.1/$IP/g" /etc/riak/app.config
#Add Cluster Manager IP / Port
sudo sed -i "s/%% Default location of ringstate/{cluster_mgr, {\"$IP\", 9080 }},/g" /etc/riak/app.config
#Start Riak
riak start
####Test connections between nodes (each node)
curl http://10.224.13.24:8098/buckets/?buckets=true
####If there are security group problems (AWS...)
iptables --flush
####Join nodes in each cluster #####(from 10.249.9.198)
riak-admin cluster join [email protected]
riak-admin cluster plan
riak-admin cluster commit
riak-admin status | grep ring_members
#####(from 10.250.77.34)
riak-admin cluster join [email protected]
riak-admin cluster plan
riak-admin cluster commit
riak-admin status | grep ring_members
####Name Clusters #####(from 10.224.13.24)
riak-repl clustername Cluster1
#####(from 10.224.8.208)
riak-repl clustername Cluster2
####Connect Clusters #####(from 10.224.13.24)
riak-repl connect 10.224.8.208:9080
riak-repl connections
#####(from 10.224.8.208)
riak-repl connect 10.224.13.24:9080
riak-repl connections
####Add a test keys 1 and 2
curl -v -XPOST http://10.224.13.24:8098/buckets/test/keys/test1 \
-H 'Content-Type: text/plain' \
-d 'this is a test'
curl -XGET http://10.224.13.24:8098/buckets/test/keys/test1
#(this is a test)
curl -XGET http://10.224.8.208:8098/buckets/test/keys/test1
#(not found)
curl -v -XPOST http://10.224.8.208:8098/buckets/test/keys/test2 \
-H 'Content-Type: text/plain' \
-d 'this is a test'
curl -XGET http://10.224.13.24:8098/buckets/test/keys/test2
#(not found)
curl -XGET http://10.224.8.208:8098/buckets/test/keys/test2
#(this is a test)
####Enable and Start Realtime Replication (continuous) #####(from 10.224.13.24)
riak-repl realtime enable Cluster2
riak-repl realtime start Cluster2
#####(from 10.224.8.208)
riak-repl realtime enable Cluster1
riak-repl realtime start Cluster1
####Add test key 3
curl -v -XPOST http://10.224.13.24:8098/buckets/test/keys/test3 \
-H 'Content-Type: text/plain' \
-d 'this is a test'
curl -XGET http://10.224.13.24:8098/buckets/test/keys/test3
#(this is a test)
curl -XGET http://10.224.8.208:8098/buckets/test/keys/test3
#(this is a test)
####Enable and Start Fullsync Replication #####(from 10.224.13.24)
riak-repl fullsync enable Cluster2
riak-repl fullsync start Cluster2
#####(from 10.224.8.208)
riak-repl fullsync enable Cluster1
riak-repl fullsync start Cluster1
####Verify
curl -XGET http://10.224.8.208:8098/buckets/test/keys/test1
#(this is a test)
curl -XGET http://10.224.13.24:8098/buckets/test/keys/test2
#(this is a test)