Un petit chapitre consacré aux 'Replicated Volumes'.

Nous disposons de 4 serveurs gluster. Dans le mode 'replicated volume', nous devons créer un nombre de réplicats égal aux nombres de briques du gluster (a savoir 4 dans notre cas)

Création du volume :

gluster volume create replicated-volume replica 4 \
server-01:/home/glusterfs-RV \
server-02:/home/glusterfs-RV \
server-03:/home/glusterfs-RV \
server-04:/home/glusterfs-RV

Creation of volume replicated-volume has been successful. Please start the volume to access data.

Status du volume :

# gluster volume info

Volume Name: replicated-volume
Type: Replicate
Status: Created
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: server-01:/home/glusterfs-RV
Brick2: server-02:/home/glusterfs-RV
Brick3: server-03:/home/glusterfs-RV
Brick4: server-04:/home/glusterfs-RV

On lance le volume

# gluster volume start replicated-volume
Starting volume replicated-volume has been successful

On monte le volume :

mount -t nfs server-01:/replicated-volume /mnt/gluster-RV/

Un test rapide :

for i in `seq 1 20`;do dd if=/dev/zero of=/mnt/gluster-RV/test$i bs=1M count=10; done

Ce qui donne sur le montage NFS :

client-01:~# ll /mnt/gluster-RV/
total 204888
drwxr-xr-x 2 root root     4096 2011-08-31 12:48 ./
drwxr-xr-x 3 root root     4096 2011-08-31 12:26 ../
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test1
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test10
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test11
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test12
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test13
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test14
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test15
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test16
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test17
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test18
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test19
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test2
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test20
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test3
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test4
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test5
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test6
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test7
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test8
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test9

Les fichiers sont bien répliqués sur chaque brique du gluster :

server-01:~# ll /home/glusterfs-RV/
total 204888
drwxr-xr-x 2 root root     4096 2011-08-31 12:48 ./
drwxr-xr-x 4 root root     4096 2011-08-31 12:19 ../
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test1
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test10
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test11
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test12
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test13
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test14
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test15
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test16
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test17
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test18
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test19
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test2
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test20
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test3
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test4
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test5
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test6
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test7
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test8
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test9

server-02:~# ll /home/glusterfs-RV/
total 204888
drwxr-xr-x 2 root root     4096 2011-08-31 12:48 ./
drwxr-xr-x 4 root root     4096 2011-08-31 12:19 ../
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test1
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test10
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test11
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test12
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test13
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test14
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test15
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test16
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test17
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test18
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test19
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test2
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test20
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test3
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test4
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test5
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test6
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test7
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test8
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test9

[...]

On casse une brique du gluster (kill -9)

server-01:~# gluster peer status
Number of Peers: 3

Hostname: server-03
Uuid: 3cbd07b9-65ff-4ea6-a55e-afae48d7dad5
State: Peer in Cluster (Connected)

Hostname: server-04
Uuid: 7c17079e-a75c-4618-8237-5a7256c3cc2d
State: Peer in Cluster (Connected)

Hostname: server-02
Uuid: 48e33e29-67b5-4613-9cba-e32155a92900
State: Peer in Cluster (Disconnected)

Sur le client tout les fichiers sont bien présent :

client-01:~# ll /mnt/gluster-RV/
total 204888
drwxr-xr-x 2 root root     4096 2011-08-31 12:48 ./
drwxr-xr-x 3 root root     4096 2011-08-31 12:26 ../
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test1
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test10
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test11
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test12
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test13
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test14
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test15
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test16
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test17
-rw-r--r-- 1 root root 10485760 2011-08-31 12:47 test18
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test19
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test2
-rw-r--r-- 1 root root 10485760 2011-08-31 12:48 test20
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test3
-rw-r--r-- 1 root root 10485760 2011-08-31 12:45 test4
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test5
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test6
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test7
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test8
-rw-r--r-- 1 root root 10485760 2011-08-31 12:46 test9

Créons des fichiers avec une brique HS :

client-01:~# for i in `seq 1 10`;do dd if=/dev/zero of=/mnt/gluster-RV/test2$i bs=1M count=10; done

La création de fichiers se passe bien. On relance la brique HS.

Les fichiers se répliquent sur la brique HS une fois qu'ils sont accédés depuis le client.

server-03:~# ll /home/glusterfs-RV/
-rw-r--r-- 1 root root        0 2011-08-31 12:54 test21
-rw-r--r-- 1 root root        0 2011-08-31 12:55 test210
-rw-r--r-- 1 root root        0 2011-08-31 12:54 test22

client-01:~# cat /mnt/gluster-RV/test210 > /dev/null

server-03:~# ll /home/glusterfs-RV/
-rw-r--r-- 1 root root        0 2011-08-31 12:54 test21
-rw-r--r-- 1 root root 10485760 2011-08-31 12:55 test210
-rw-r--r-- 1 root root        0 2011-08-31 12:54 test22