GlusterFS Debian wheezy HowTo

GlusterFS Debian wheezy HowTo

In dieser Anleitung beschreibe ich wie man unter Debian Wheezy ein GlusterFs Replicated Volumen einrichtet.

Dafür benötigen wir zwei Server mit Debian Wheezy.

Vorbereitung auf beiden Servern.

Als erstes wird die /etc/hosts bearbeitet um sicherzustellen das der Hostnamen auf den richtigen Server zeigt.
[stextbox id=“bash“] nano /etc/hosts[/stextbox]

192.168.10.201    test01
192.168.10.202    test02

Als nächstes werden die benötigten Pakete installiert
[stextbox id=“bash“] apt-get update
apt-get install glusterfs-server glusterfs-client glusterfs-common[/stextbox]

Export Verzeichnis anlegen auf beiden Servern.

In Export Verzeichnissen werden die Daten Local auf dem Jeweiligen Servern gespeichert.
In diesem Verzeichniss dürfen keine änderungen gemacht werden, da diese dann nicht Repliziert werden. Dafür gib es später einen Mountpoint.
[stextbox id=“bash“] mkdir -p /export/data[/stextbox]

Glusterfs Setup mit der CLI

Hier wird der zweite Server dem Storage Pool hinzugefügt.
Syntax# gluster peer probe HOSTNAME
[stextbox id=“bash“] gluster peer probe test02
Probe successful
[/stextbox]
Da wir ein Replikations Volume aufsetzen benuzen wir dieses Kommando.
Syntax# gluster volume create NEW-VOLNAME replica COUNT transport tcp HOSTNAME01:/export/data HOSTNAME02:/export/data

Auf Server Test01
[stextbox id=“bash“] gluster volume create datastore replica 2 transport tcp test01:/export/data test02:/export/data/
Creation of volume datastore has been successful. Please start the volume to access data.[/stextbox]

Als nächstes legen wir fest wer darauf connecten darf.

Syntax# gluster volume set datastore auth.allow [IP,IP,IP*]

Einzelne IPs freigeben
Auf Server Test01
[stextbox id=“bash“] gluster volume set datastore auth.allow 192.168.10.201,192.168.10.202
Set volume unsuccessful[/stextbox]

Oder gleich ein ganzes Subnet freigeben
Auf Server Test01
[stextbox id=“bash“] gluster volume set datastore auth.allow 192.168.10.*
Set volume unsuccessful[/stextbox]

Starten des GlusterFS Volume

Auf Server Test01
[stextbox id=“bash“] gluster volume start datastore
Starting volume datastore has been successful[/stextbox]

Konfiguration Verifizieren

Auf Test01 und Test02
[stextbox id=“bash“] gluster volume info
Volume Name: datastore
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: test01:/export/data
Brick2: test02:/export/data
Options Reconfigured:
auth.allow: 192.168.10.*[/stextbox]

Mountpoints erstellen auf beiden Servern und das GlusterFS mounten

Auf Test01
[stextbox id=“bash“]mkdir /mnt/datastore
mount -t glusterfs test01:/datastore /mnt/datastore
mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=123422,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=102108k,mode=755)
/dev/xvda2 on / type xfs (rw,relatime,attr2,delaylog,noquota)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=413920k)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
test01:/datastore on /mnt/datastore type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)

df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 10G 619M 9.4G 7% /
udev 10M 0 10M 0% /dev
tmpfs 100M 68K 100M 1% /run
/dev/xvda2 10G 619M 9.4G 7% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 405M 0 405M 0% /run/shm
test01:/datastore 10G 619M 9.4G 7% /mnt/datastore[/stextbox]

Auf Test02
[stextbox id=“bash“]mkdir /mnt/datastore
mount -t glusterfs test02:/datastore /mnt/datastore
mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=123422,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=102108k,mode=755)
/dev/xvda2 on / type xfs (rw,relatime,attr2,delaylog,noquota)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=413920k)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
test02:/datastore on /mnt/datastore type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)

df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 10G 619M 9.4G 7% /
udev 10M 0 10M 0% /dev
tmpfs 100M 68K 100M 1% /run
/dev/xvda2 10G 619M 9.4G 7% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 405M 0 405M 0% /run/shm
test02:/datastore 10G 619M 9.4G 7% /mnt/datastore[/stextbox]

Um das ganze nach einen Reboot auch gleich gemountet zu haben sollte das eigentlich funktionieren aber es tut es nicht.

[stextbox id=“bash“]nano /etc/fstab[/stextbox]
Auf Test01

test01:/datastore /mnt/datastore glusterfs defaults,_netdev 0 0

Auf Test02

test02:/datastore /mnt/datastore glusterfs defaults,_netdev 0 0

Aber dann machen wir das halt anders auf beiden Servern

[stextbox id=“bash“]nano /etc/fstab[/stextbox]

/etc/glusterfs/glusterfs.vol /mnt/datastore glusterfs defaults 0 0

Und legen die Datei /etc/glusterfs/glusterfs.vol an
[stextbox id=“bash“]nano /etc/glusterfs/glusterfs.vol[/stextbox]

Wichtig ist hier das bei option remote-subvolume das Volume angeben ist das wir oben freigegeben haben. In diesem Fall /export/data

volume remote1
   type protocol/client
   option transport-type tcp
   option remote-host test01
   option remote-subvolume /export/data
end-volume

volume remote2
   type protocol/client
   option transport-type tcp
   option remote-host test02
   option remote-subvolume /export/data
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

2 Kommentare zu „GlusterFS Debian wheezy HowTo

  1. Hallo lieber Verfasser oder liebe Verfasserin,

    sehr schöne Anleitung!

    Ich habe ein kleines Problem.
    Meine Fehlermeldung ist bei diesem Befehl: -gluster volume create datastore replica 2 transport tcp raspi04:/export/data raspi05:/export/data raspi06:/export/data raspi07:/export/data

    Fehlermeldung:volume create: datastore: failed: The brick raspi04:/export/data 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.

    Ich hoffe Du/Ihr könnt mir helfen.
    Gruß,
    Alexander Pokraka

  2. Hi Alexander,

    der fehle kommt weil dein Export Directory in / liegt.
    Am besten ist es wenn du einen eigenen Mount Point hast. Ich hab es immer mit LVM gemacht und dann ein separates LVM nach /export/data gemounten und dieses dann im GlusterFS genutzt.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*