High availability

Here I discuss about How to setup a High availability Load balanced website in Rackspace.

For Loadbalancing, I use Rackspace loadbalacers, which is cheap and efficient. You can create two cloud servers in Rackspace. Select servers atleast having 1GB RAM.

Here I created two servers gluster1 and gluster2. Add the names and corresponding IPs in the /etc/hosts file. Follow the below steps for installation and configuration of High availability.

1. Database replication :

Mysql master-master replication can be found here:

MySQL Master-Master Replication

2. File replication :

I am using glusterFS for master-master files replication.

Installing GlusterFS package On both gluster1 and gluster2 servers.

apt-get    update
apt-get install python-software-properties

add-apt-repository ppa:semiosis/ubuntu-glusterfs-3.4

apt-get update
apt-get install glusterfs-server

Note : If you already have an old version of glusterfs, you can remove it and install as

below:

apt-get remove glusterfs-server

add-apt-repository ppa:semiosis/ubuntu-glusterfs-3.4

apt-get update
apt-get install glusterfs-server

3. Create a cluster of nodes

In this step, we are adding the servers to cluster of nodes. Since we are having only two

nodes, need to execute the command only in first server.

root@gluster1:~# gluster peer probe gluster2
Probe successful

If you execute it in the second server, you will get an error that the host already exist.
root@gluster2:~# gluster peer probe gluster1
Probe on host gluster1 port 24007 already in peer list

At any time, you can check the status as below :

root@gluster1:~# gluster peer status
Number of Peers: 1

Hostname: gluster2
Uuid: be8f2ff9-60e9-49ba-a476-9dbfe0fd0ab0
State: Peer in Cluster (Connected)

root@gluster2:~# gluster peer status
Number of Peers: 1

Hostname: gluster1
Uuid: ffa8d4cf-e311-4de2-8d48-6a0d8a318aef
State: Peer in Cluster (Connected)

4. Create a gluster volume

root@gluster1:~# gluster volume create datavol replica 2 transport tcp gluster1:/data

gluster2:/data

Creation of volume datavol has been successful. Please start the volume to access data.

5. Start the volume

root@gluster1:~# gluster volume start datavol
Starting volume datavol has been successful

You can use the below commands to see the volume status

gluster volume status
gluster volume info

Important : Gluster volumes are accessible only through gluster client or nfs share. In order

to improve the security, we can specify the IPs, only those are allowed to access the gluster

volume.

You can specify more IPs separated by comma.

root@gluster1:~# gluster volume set datavol auth.allow 10.178.199.52,10.178.196.101
Set volume successful

6. Mount the gluster volume

As I mentioned earlier, I am using only two servers for the whole setup. So I am installing

the Glusterfsclient also in the same servers (Already installed ).

root@gluster1:~# apt-get install glusterfs-client

root@gluster2:~# apt-get install glusterfs-client

Here I mount the volume to the location /var/www/ in both servers. Run the below commands in

both the serves:

mkdir /var/www/

You can add the below fstab entry for automatic boot:

In server1,

server1:/datavol      /var/www           glusterfs       _netdev,fetch-attempts=10       0 0

In server2,

server2:/datavol      /var/www           glusterfs       _netdev,fetch-attempts=10       0 0

 

Enjoy 🙂

 

Advertisements

One thought on “High availability

  1. Pingback: automount volume only after bootingup - TecHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s