Ubuntu 14.04 LTS and Glusterfs

Picture the scene,

I run a kvm host with 5 machines, it’s Ubuntu LTS. The 5 vms constist of minecraft servers, a shell server so myself and a few friends can access IRC, and a webserver which I host all of my websites. My main worry was that if the server goes down for what ever reason, I’ve lost everything on there, that’ll take down all my vms and I’m basically stuffed. What does one do in this situation, I’m not overly rich so I can’t host elsewhere, I do however have a spare server that’s not doing a lot apart from gathering dust. I know, I’ll setup a gluster system so that everything is mirrored, the vms, when updated are copied to the second server so I can just bring that online in the event of a failure. It’s not the perfect solution but it’s ok for a little home setup.

edit the hosts files on both machines so that they are able to ping each other

xxx.xxx.xxx.xxx rmcvirt01.paulmellors.local rmcvirt01
xxx.xxx.xxx.xxx rmcvirt02.paulmellors.local rmcvirt02

Install the gluster software

apt-get install glusterfs-server

add the second server to the gluster

gluster peer probe rmcvirt02

check it’s status

gluster peer status

Create the gluster volume

gluster volume create vol_replica transport tcp rmvcirt01:/home/glustervms rmcvirt02:/home/glustervms

*note* I had to add force at the end of the volume create line as my folders were part of / which apparently it doesn’t like.

Start the volume

gluster volume start vol_replica

If you want to check it, then use

gluster volume info or gluster volume status

Create a folder that you want to mount as the gluster drive

mkdir glustervmsmnt

Mount the volume to a folder

mount -t glusterfs rmcvirt01:/vol_replica /home/glustervmsmnt/

I can’t remember if I did all this on the second server so it knows about the first server, you’ll just have to play.

To test I had it working, I touched a file on server1 in the /home/glustermnt folder, and then the same folder on server2, if it’s working then you should see the file replicated, and in my case I did.

I then had to shutdown all my virtual machines one by one, move the qcow2 file to the glustermnt folder, and change the vms config to point to the new hdd file location and start up the machine.

Seems to be working fine, I don’t really know much about glusterfs, so if you had a question, I’ll more than likely just say don’t know and have a look on the internet, but I’ll get there.


One thought on “Ubuntu 14.04 LTS and Glusterfs

  1. On the second server you should really mount the local version…
    i.e. mount -t glusterfs rmcvirt02:/vol_replica /home/glustervmsmnt/
    Glad you are liking Gluster though. oVirt next 😉


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