Almacenamiento · 3 min read · Feb 06, 2026

Almacenamiento de Alta Disponibilidad Con GlusterFS En Mandriva 2010.0 - Replicación Automática de Archivos Entre Dos Servidores de Almacenamiento - Página 2

3 Configurando El Cliente GlusterFS

client1.example.com:

En el cliente, podemos instalar el cliente GlusterFS de la siguiente manera:

urpmi glusterfs-client glusterfs-server

Luego creamos el siguiente directorio:

mkdir /mnt/glusterfs

A continuación, creamos el archivo /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 |

¡Asegúrate de usar los nombres de host o direcciones IP correctas en las líneas de opción remote-host!

¡Eso es todo! Ahora podemos montar el sistema de archivos GlusterFS en /mnt/glusterfs con uno de los siguientes dos comandos:

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

o

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

Ahora deberías ver el nuevo recurso compartido en las salidas de…

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

… y…

df -h
[root@client1 administrator]# df -h  
Sistema de archivos            Tamaño  Usado Disponible Uso% Montado en  
/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 y server2.example.com cada uno tiene 29GB de espacio para el sistema de archivos GlusterFS, pero debido a que los datos están reflejados, el cliente no ve 58GB (2 x 29GB), sino solo 29GB.)

En lugar de montar el recurso compartido de GlusterFS manualmente en el cliente, podrías modificar /etc/fstab para que el recurso se monte automáticamente cuando el cliente arranca.

Abre /etc/fstab y agrega la siguiente línea:

vi /etc/fstab

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

Para probar si tu /etc/fstab modificado está funcionando, reinicia el cliente:

reboot

Después del reinicio, deberías encontrar el recurso compartido en las salidas de…

df -h

… y…

mount

4 Pruebas

Ahora vamos a crear algunos archivos de prueba en el recurso compartido de GlusterFS:

client1.example.com:

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

Ahora vamos a verificar el directorio /data/export en server1.example.com y server2.example.com. Los archivos test1 y test2 deberían estar presentes en cada 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]#

Ahora apagamos server1.example.com y agregamos/borramos algunos archivos en el recurso compartido de GlusterFS en 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

Los cambios deberían ser visibles en el directorio /data/export en 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]#

Vamos a reiniciar server1.example.com y a mirar el directorio /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]#

Como ves, server1.example.com no ha notado los cambios que ocurrieron mientras estaba apagado. Esto es fácil de solucionar, solo necesitamos invocar un comando de lectura en el recurso compartido de GlusterFS en client1.example.com, por ejemplo:

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]#

Ahora echa un vistazo al directorio /data/export en server1.example.com nuevamente, y deberías ver que los cambios se han replicado a ese 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 Enlaces

Share: X/Twitter LinkedIn

Recibe nuevas publicaciones en tu bandeja de entrada.

No spam. Cancela la suscripción en cualquier momento.