Eljött az ideje, hogy megírjak egy kis doksit a GlusterFS beüzemelésével kapcsolatban CentOS 6.5 operációs rendszeren… bár van néhány glusterfs csomag a CentOS repóban, érdemes hozzáadni a “hivatalos” Gluster repót:
# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
A telepítés egyszerű, az alábbi csomagokra lesz szükségünk:
# yum install glusterfs.x86_64 glusterfs-fuse.x86_64 glusterfs-api.x86_64 glusterfs-server.x86_64
...
Állítsuk be, hogy induljon el automatikusan és indítsuk el:
# chkconfig --levels 235 glusterd on
# chkconfig --levels 235 glusterfsd on
# /etc/init.d/glusterd start
Ezt ismételjük meg az összes olyan lábon, ahol szeretnénk egy Gluster téglát (“brick”), majd mutassuk be egymásnak őket:
# gluster peer probe 10.129.216.43
peer probe: success.
# gluster peer status
Number of Peers: 1
Hostname: 10.129.216.43
Uuid: e50cfdf5-9a4f-4072-b6d7-f0ba0d2126d2
State: Peer in Cluster (Connected)
A másik lábon ellenőrizzük:
# gluster peer status
Number of Peers: 1
Hostname: 10.129.214.116
Uuid: b7f8df63-fa0f-4457-9a84-7f0493b49772
State: Peer in Cluster (Connected)
Hozzunk létre egy elosztott kötetet:
# gluster volume create dist-volume 10.129.214.116:/srv/dist-volume/ 10.129.216.43:/srv/dist-volume/
volume create: dist-volume: failed: The brick 10.129.214.116:/srv/dist-volume is is being created in the root partition. It is recommended that you don't use the system's root partition for storage backend. Or use 'force' at the end of the command if you want to override this behavior.
Ha nem adunk a lábnak egy külön (‘/’ fájlrendszertől eltérő) fájlrendszert, akkor használnunk kell a force kulcsszót:
# gluster volume create dist-volume 10.129.214.116:/srv/dist-volume/ 10.129.216.43:/srv/dist-volume/ force
volume create: dist-volume: success: please start the volume to access data
Ha sikeresen létrejött a kötet, akkor indítsuk el és ellenőrizzük a tagokat:
# gluster volume start dist-volume
volume start: dist-volume: success
# gluster volume info
Volume Name: dist-volume
Type: Distribute
Volume ID: 2299912d-c779-44c8-be68-9a249b4d95b4
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 10.129.214.116:/srv/dist-volume
Brick2: 10.129.216.43:/srv/dist-volume
Bármikor hozzá tudunk adni új tagokat, illetve új téglákat a felépített kötethez:
# gluster peer probe 10.129.215.37
peer probe: success.
# gluster peer probe 10.129.211.128
peer probe: success.
# gluster volume add-brick dist-volume 10.129.215.37:/srv/dist-volume/ force
volume add-brick: success
# gluster volume add-brick dist-volume 10.129.211.128:/srv/dist-volume/ force
volume add-brick: success
Ezt ellenőrizhetjük is:
# gluster volume info
Volume Name: dist-volume
Type: Distribute
Volume ID: 2299912d-c779-44c8-be68-9a249b4d95b4
Status: Started
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: 10.129.214.116:/srv/dist-volume
Brick2: 10.129.216.43:/srv/dist-volume
Brick3: 10.129.215.37:/srv/dist-volume
Brick4: 10.129.211.128:/srv/dist-volume
Most már csak fel kell csatolnunk:
# mkdir /home/distributed
# mount.glusterfs localhost:/dist-volume /home/distributed/
# df -h
Filesystem Size Used Avail Use% Mounted on
...
localhost:/dist-volume 79G 14G 62G 19% /home/distributed
Hozzunk létre replikált tárolót is:
# gluster volume create repl-volume replica 4 10.129.214.116:/srv/repl-volume/ 10.129.216.43:/srv/repl-volume/ 10.129.215.37:/srv/repl-volume/ 10.129.211.128:/srv/repl-volume/ force
volume create: repl-volume: success: please start the volume to access data
# gluster volume info
Volume Name: dist-volume
Type: Distribute
Volume ID: 2299912d-c779-44c8-be68-9a249b4d95b4
Status: Started
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: 10.129.214.116:/srv/dist-volume
Brick2: 10.129.216.43:/srv/dist-volume
Brick3: 10.129.215.37:/srv/dist-volume
Brick4: 10.129.211.128:/srv/dist-volume
Volume Name: repl-volume
Type: Replicate
Volume ID: 74247305-2a30-4ed7-a9d9-3ed9a2619a12
Status: Created
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: 10.129.214.116:/srv/repl-volume
Brick2: 10.129.216.43:/srv/repl-volume
Brick3: 10.129.215.37:/srv/repl-volume
Brick4: 10.129.211.128:/srv/repl-volume
Indítsuk el és csatoljuk fel:
# gluster volume start repl-volume
volume start: repl-volume: success
# mkdir -p /home/replicated/
# mount.glusterfs localhost:/repl-volume /home/replicated/
# df -h
Filesystem Size Used Avail Use% Mounted on
localhost:/repl-volume 20G 3,6G 16G 20% /home/replicated
Adjuk hozzá a felcsatolt kötetet az fstab fájlhoz:
localhost:/dist-volume /home/distributed glusterfs defaults,_netdev 0 0
localhost:/repl-volume /home/replicated glusterfs defaults,_netdev 0 0