mariusv.com

Watch as I awkwardly stumble through life

Distributed filesystem with GlusterFS

Posted by Marius Voila on June 26, 2010 in London, U.K . — 0 comments This post contains 261 words

This setup contains two GlusterFS-servers and one client, named s01, s02 and c01 in the examples below. Data stored in the mount point on c01 will be destributed to s01 and s02.

The Ubuntu APT repository doesn’t have the latest GlusterFS version, which we want. So we’ll have to build it ourself. Do this on all 3 nodes.

Install packages required to build GlusterFS.

# aptitude install build-essential flex bison

Download and install GlusterFS. As of date, 3.0.2 is the latest version.

# wget http://ftp.gluster.com/pub/gluster/glusterfs/3.0/LATEST/glusterfs-3.0.2.tar.gz
# tar zxf glusterfs-3.0.2.tar.gz
# cd glusterfs-3.0.2
# ./configure
# make
# make install
# ldconfig

Make sure /export/sda2 exists on both servers, this folder will contain the data stored on the volume.

On s01, do this.

# mkdir /etc/glusterfs
# cd /etc/glusterfs
# glusterfs-volgen --name storage01 s01:/export/sda2 s02:/export/sda2
# ln -s s01-storage01-export.vol glusterfsd.vol
# /etc/init.d/glusterfsd start

On s02, do this.

# mkdir /etc/glusterfs
# cd /etc/glusterfs
# glusterfs-volgen --name storage01 s01:/export/sda2 s02:/export/sda2
# ln -s s02-storage01-export.vol glusterfsd.vol
# /etc/init.d/glusterfsd start

On c01, do this.

# mkdir /etc/glusterfs
# cd /etc/glusterfs
# glusterfs-volgen --name storage01 s01:/export/sda2 s02:/export/sda2

Edit /etc/fstab on c01 and add the following line.

/etc/glusterfs/storage01-tcp.vol        /storage        glusterfs defaults,_netdev      0       0

The share can now be mounted on the client.

# mount /storage
# mount
...
/etc/glusterfs/storage01-tcp.vol on /storage type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)

That’s it, for more failsafe setup, consider using –raid for the glusterfs-volgen command.