Glusterfs
Sur troll3 et troll4, nous utilisons du glusterfs.
Pré-requis
Il faut une partition pour mettre le stockage et une connectivité reseau.
On va donc creer un volume lvm exprès de chaque côté :
root@troll4:~# lvcreate -L1024G -n glusterfs troll4-vg root@troll4:~# mkfs.ext4 /dev/mapper/troll4--vg-glusterfs root@troll4:~# mkdir /glusterfs root@troll4:~# echo "/dev/troll4-vg/glusterfs /glusterfs ext4 defaults 0 2" >> /etc/fstab root@troll4:~# mount /glusterfs
root@troll3:~# lvcreate -L1024G -n glusterfs troll3-vg root@troll3:~# mkfs.ext4 /dev/mapper/troll3--vg-glusterfs root@troll3:~# mkdir /glusterfs root@troll3:~# echo "/dev/troll3-vg/glusterfs /glusterfs ext4 defaults 0 2" >> /etc/fstab root@troll3:~# mount /glusterfs
Mettre la conf reseau qui va bien :
root@troll4:~# ifconfig eth1 192.168.0.1/24
root@troll3:~# ifconfig eth1 192.168.0.2/24
Et faire en sorte d'avoir une mini resolution dns :
root@troll4:~# echo "192.168.0.1 troll4.lan.parinux.org">> /etc/hosts root@troll4:~# echo "192.168.0.2 troll3.lan.parinux.org">> /etc/hosts
root@troll3:~# echo "192.168.0.1 troll4.lan.parinux.org">> /etc/hosts root@troll3:~# echo "192.168.0.2 troll3.lan.parinux.org">> /etc/hosts
Setup
root@troll4:~# gluster peer probe troll3.lan.parinux.org
Creation d'un volume
root@troll4:~# gluster volume create lxc_www1 replica 2 transport tcp troll4.lan.parinux.org:/glusterfs/lxc_www1 troll3.lan.parinux.org:/glusterfs/lxc_www1 force
Mise en place des options qui vont bien
root@troll4:~# gluster volume set ${curVol} cluster.readdir-optimize on root@troll4:~# gluster volume set ${curVol} performance.parallel-readdir on root@troll4:~# gluster volume set ${curVol} nfs.disable on root@troll4:~# gluster volume set ${curVol} performance.client-io-threads on # quand on est pas riche en ram et qu'on monte un truc en local .. root@troll4:~# gluster volume set ${curVol} performance.io-cache off
Activation d'un quota
Attention, c'est pas toujours une bonne idee, ni une bonne option ..
root@troll4:~# gluster volume quota lxc_www1 enable root@troll4:~# gluster volume quota lxc_www1 limit-usage / 10GB
Demarrage d'un volume
root@troll4:~# gluster volume start lxc_www1
Utilisation d'un volume
root@troll4:~# echo "troll4.lan.parinux.org:/lxc_www1 /var/lib/lxc/www glusterfs defaults,noatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072 0 0" >> /etc/fstab root@troll4:~# mount /var/lib/lxc/www
root@troll3:~# echo "troll3.lan.parinux.org:/lxc_www1 /var/lib/lxc/www glusterfs defaults,noatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072 0 0" >> /etc/fstab root@troll3:~# mount /var/lib/lxc/www