GlusterFS: un file system distribuito
Introduzione
[http://www.gluster.org/ GlusterFS] è un file system clusterizzato capace di gestire molti petabytes di dati.
Quella che segue è un'installazione di esempio su un sistema Ubuntu-like.
Installazione
L'ultima release di [http://www.ubuntu.com/getubuntu/releasenotes/810 Ubuntu] (8.10 ovvero Ibex) ha pacchettizato sia Fuse che GlusterFS; viene quindi divisa la sezione di installazione a seconda si utilizzi la Ibex (se non lo avete ancora fatto, apt-get dist-upgrade funziona a meraviglia) oppure un'altra versione Debian-like in cui i due software non sono ancora disponibili in APT.
Installazione Ibex
Il lato client di GlusterFS usa Fuse per il mount.
Installazione da sorgente
Il lato client di GlusterFS usa Fuse per il mount.
Scaricare l'ultima versione di GlusterFS da [http://europe.gluster.org/glusterfs/1.3/].
E' consigliabile installare anche una versione patchata di Fuse, fatta su misura per GlusterFS (migliori performance IO ed altro). Si può scaricare da [http://europe.gluster.org/glusterfs/fuse/].
$ cd /opt/source $ mkdir glusterFS $ wget http://europe.gluster.org/glusterfs/1.3/glusterfs-1.3.8pre6.tar.gz $ wget http://europe.gluster.org/glusterfs/fuse/fuse-2.7.2glfs9.tar.gz $ tar xvzf glusterfs-1.3.8pre6.tar.gz $ tar xvzf fuse-2.7.2glfs9.tar.gz
Per prima cosa occorre installare Fuse (ricordandosi di effettuare un backup del modulo originale di fuse, se è già installato).
$ sudo mv /lib/modules/2.6.22-14/kernel/fs/fuse/fuse.ko /lib/modules/2.6.22-14/kernel/fs/fuse/fuse.ko.orig $ cd fuse-2.7.2glfs9/ $ ./configure --prefix=/opt/fuse --enable-kernel-module $ make $ sudo make install $ sudo ldconfig $ sudo rmmod fuse $ sudo modprobe fuse
Adesso è la volta di GlusterFS.
$ cd glusterfs-1.3.8pre6/ $ LDFLAGS='-L/opt/fuse/lib' CPPFLAGS='-I/opt/fuse/include' ./configure --prefix=/opt/glusterfs $ make $ sudo make install
Configurazione
Questa installazione fa uso di 2 servers ed 1 client. Prima occorre creare su entrambi i servers (chiamiamoli remote1 e remote2) la directory condivisa.
sudo mkdir -p /data/export
Su entrambi i servers (remote1 e remote2) editare il file /opt/glusterfs/etc/glusterfs/glusterfs-server.vol
# file: /opt/glusterfs/etc/glusterfs/glusterfs-server.vol volume brick type storage/posix option directory /data/export end-volume volume server type protocol/server option transport-type tcp/server option auth.ip.brick.allow * subvolumes brick end-volume
e sul client editare il file /opt/glusterfs/etc/glusterfs/glusterfs-client.vol
# file: /opt/glusterfs/etc/glusterfs/glusterfs-client.vol volume remote1 type protocol/client option transport-type tcp/client option remote-host ''remote1.indirizzo.ip'' option remote-subvolume brick end-volume volume remote2 type protocol/client option transport-type tcp/client option remote-host ''remote2.indirizzo.ip'' option remote-subvolume brick end-volume volume mirror0 type cluster/afr subvolumes remote1 remote2 end-volume
Infine avviare il demone su entrambi i servers
$ sudo /opt/glusterfs/sbin/glusterfsd -f /opt/glusterfs/etc/glusterfs/glusterfs-server.vol
e montare la directory remota sul client
$ sudo /opt/glusterfs/sbin/glusterfs -f /opt/glusterfs/etc/glusterfs/glusterfs-client.vol /mnt/glusterfs $ # oppure $ sudo /opt/glusterfs/sbin/glusterfs -s remote1.indirizzo.ip /mnt/glusterfs
Si può montare la directory anche con il comando mount
$ sudo mount -t glusterfs remote1.indirizzo.ip /mnt/glusterfs
Per montare la direcotry in modo automatico all'avvio del sistema, aggiungere una riga al file /etc/fstab
remote1.indirizzo.ip /mnt/glusterfs glusterfs defaults 0 0
oppure
/opt/glusterfs/etc/glusterfs/glusterfs-client.vol /mnt/glusterfs glusterfs defaults 0 0
ATTENZIONE: Non bisogna MAI tentare di scrivere direttamente nella directory gestita da GlusterFS, ovvero in questo esempio in /data/export !!
Ulteriori risorse
[http://www.gluster.org/ Home di GlusterFS]
[http://www.gluster.org/docs/index.php/GlusterFS Wiki di GlusterFS]
[http://www.piemontewireless.net Wiki dell'autore dell'articolo]