Archiviazione · 3 min read · Feb 06, 2026

Archiviazione ad Alta Disponibilità Con GlusterFS Su Mandriva 2010.0 - Replica Automatica dei File Tra Due Server di Archiviazione - Pagina 2

3 Configurazione del Client GlusterFS

client1.example.com:

Sul client, possiamo installare il client GlusterFS come segue:

urpmi glusterfs-client glusterfs-server

Poi creiamo la seguente directory:

mkdir /mnt/glusterfs

Successivamente creiamo il file /etc/glusterfs/glusterfs.vol:

vi /etc/glusterfs/glusterfs.vol

| volume remote1 type protocol/client option transport-type tcp option remote-host server1.example.com option remote-subvolume brick end-volume volume remote2 type protocol/client option transport-type tcp option remote-host server2.example.com option remote-subvolume brick end-volume volume replicate type cluster/replicate subvolumes remote1 remote2 end-volume volume writebehind type performance/write-behind option window-size 1MB subvolumes replicate end-volume volume cache type performance/io-cache option cache-size 512MB subvolumes writebehind end-volume |

Assicurati di utilizzare i nomi host o gli indirizzi IP corretti nelle righe option remote-host!

Ecco fatto! Ora possiamo montare il filesystem GlusterFS su /mnt/glusterfs con uno dei seguenti due comandi:

glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs

oppure

mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs

Dovresti ora vedere la nuova condivisione negli output di…

mount
[root@client1 administrator]# mount  
/dev/sda1 on / type ext4 (rw,relatime)  
none on /proc type proc (rw)  
/dev/sda6 on /home type ext4 (rw,relatime)  
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)  
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)  
nfsd on /proc/fs/nfsd type nfsd (rw)  
/etc/glusterfs/glusterfs.vol on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)  
[root@client1 administrator]#

… e…

df -h
[root@client1 administrator]# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/sda1             12G  1.5G  9.8G  13% /  
/dev/sda6             16G  172M   16G   2% /home  
/etc/glusterfs/glusterfs.vol  
                       29G  1.7G  26G   6% /mnt/glusterfs  
[root@client1 administrator]#

( server1.example.com e server2.example.com hanno ciascuno 29GB di spazio per il filesystem GlusterFS, ma poiché i dati sono duplicati, il client non vede 58GB (2 x 29GB), ma solo 29GB.)

Invece di montare manualmente la condivisione GlusterFS sul client, puoi modificare /etc/fstab in modo che la condivisione venga montata automaticamente all’avvio del client.

Apri /etc/fstab e aggiungi la seguente riga:

vi /etc/fstab

| [...] /etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults 0 0 |

Per testare se la tua modifica a /etc/fstab funziona, riavvia il client:

reboot

Dopo il riavvio, dovresti trovare la condivisione negli output di…

df -h

… e…

mount

4 Test

Ora creiamo alcuni file di test sulla condivisione GlusterFS:

client1.example.com:

touch /mnt/glusterfs/test1  
touch /mnt/glusterfs/test2

Ora controlliamo la directory /data/export su server1.example.com e server2.example.com. I file test1 e test2 dovrebbero essere presenti su ciascun nodo:

server1.example.com/server2.example.com:

ls -l /data/export
[root@server1 administrator]# ls -l /data/export  
total 0  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test1  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test2  
[root@server1 administrator]#

Ora spegniamo server1.example.com e aggiungiamo/eliminiamo alcuni file sulla condivisione GlusterFS su client1.example.com.

server1.example.com:

shutdown -h now

client1.example.com:

touch /mnt/glusterfs/test3  
touch /mnt/glusterfs/test4  
rm -f /mnt/glusterfs/test2

Le modifiche dovrebbero essere visibili nella directory /data/export su server2.example.com:

server2.example.com:

ls -l /data/export
[root@server2 administrator]# ls -l /data/export  
total 0  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test1  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test3  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test4  
[root@server2 administrator]#

Riavviamo server1.example.com e diamo un’occhiata alla directory /data/export:

server1.example.com:

ls -l /data/export
[root@server1 administrator]# ls -l /data/export  
total 0  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test1  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test2  
[root@server1 administrator]#

Come puoi vedere, server1.example.com non ha notato le modifiche avvenute mentre era spento. Questo è facile da risolvere, tutto ciò che dobbiamo fare è invocare un comando di lettura sulla condivisione GlusterFS su client1.example.com, ad esempio:

client1.example.com:

ls -l /mnt/glusterfs/
[root@client1 administrator]# ls -l /mnt/glusterfs/  
total 0  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test1  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test3  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test4  
[root@client1 administrator]#

Ora dai un’occhiata alla directory /data/export su server1.example.com di nuovo, e dovresti vedere che le modifiche sono state replicate a quel nodo:

server1.example.com:

ls -l /data/export
[root@server1 administrator]# ls -l /data/export  
total 0  
-rw-r--r-- 1 root root 0 2009-12-18 15:37 test1  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test3  
-rw-r--r-- 1 root root 0 2009-12-18 15:39 test4  
[root@server1 administrator]#

5 Link

Share: X/Twitter LinkedIn

Ricevi i nuovi post nella tua casella di posta.

Nessuno spam. Disiscriviti in qualsiasi momento.