Glusterfs kasutamine Gentooga
sissejuhatus
probleem
1. On olemas veebiserver mis peaks olema töökorras 99% ajast. Et välistada erinevaid softi-raua vigu peaks hoidma üleval kahte.
2. Ühest veebiserverist jääb väheks klientide teenindamisel. Oleks vaja koormust jaotada. Samas veebiserveri sisu muutub pidevalt ja vaja on erinevate serverite infot hoida sünkroonis.
On olemas kaks veebiserverit.
Esimese ip 192.168.1.10 Teise ip 192.168.1.11
Installime mõlemale glusterfs'i
saab seda aadressilt http://ftp.zresearch.com/pub/gluster/glusterfs/
tar -xf glusterfs-1.3.0.tar.gz ./configure --prefix=/usr --disable-ibverbs make make install
localhost gluster # cat /etc/glusterfs.vol
- Export volume "brick" with the contents of "/home/export" directory.
volume brick
type storage/posix # POSIX FS translator option directory /home/export # Export this directory
end-volume
- Export volume "brick-afr" with the contents of "/home/afr-export" directory.
volume brick-afr
type storage/posix # POSIX FS translator option directory /home/afr-export # Export this directory
end-volume
- Add network serving capability to above brick.
volume server
type protocol/server subvolumes brick brick-afr option transport-type tcp/server # For TCP/IP transport option auth.ip.brick.allow * # access to "brick" volume option auth.ip.brick-afr.allow * # access to "brick" volume
end-volume localhost gluster # cat /etc/glusterfs_client.vol
- Add client feature and attach to remote subvolume of server1
volume brick1
type protocol/client option transport-type tcp/client # for TCP/IP transport option remote-host 192.168.1.10 # IP address of the remote brick option remote-subvolume brick # name of the remote volume
end-volume
- Add client feature and attach to remote subvolume of brick2
volume brick2
type protocol/client option transport-type tcp/client # for TCP/IP transport option remote-host 192.168.1.11 # IP address of the remote brick option remote-subvolume brick # name of the remote volume
end-volume
- Add AFR feature to brick1
volume afr
type cluster/afr subvolumes brick1 brick2 #option replicate *.html:2,*.db:1,*:2 # Do not leave space before or after "," and ":" option replicate *:2
end-volume
- volume ns
- type storage/posix
- option directory /home/GlusterFS-NS
- end-volume
- Add unify feature to cluster the servers. Associate an
- appropriate scheduler that matches your I/O demand.
- volume bricks
- option namespace ns
- type cluster/unify
- subvolumes afr
- option scheduler rr
- option rr.limits.min-free-disk 5%
- end-volume
localhost gluster # cat /etc/conf.d/local.start
- !/bin/bash
- /etc/conf.d/local.start
ifconfig eth0 192.168.1.11 netmask 255.255.255.0 route add default gw 192.168.1.1
glusterfsd -f /etc/glusterfs.vol glusterfs -f /etc/glusterfs_client.vol -l /var/log/glusterfs.log -L ERROR /mnt/gluster