From cc4ff86547f1c9710e6bacc5e3b42e9be556d651 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 13 Feb 2015 11:34:00 +0100 Subject: [PATCH] article about glusterfs Signed-off-by: Nico Schottelius --- ...access-gluster-from-multiple-networks.mdwn | 90 +++++++++++++++++++ follow-up-including.mdwn | 7 ++ shortcuts.mdwn | 1 + 3 files changed, 98 insertions(+) create mode 100644 blog/how-to-access-gluster-from-multiple-networks.mdwn create mode 100644 follow-up-including.mdwn diff --git a/blog/how-to-access-gluster-from-multiple-networks.mdwn b/blog/how-to-access-gluster-from-multiple-networks.mdwn new file mode 100644 index 00000000..4338a5c8 --- /dev/null +++ b/blog/how-to-access-gluster-from-multiple-networks.mdwn @@ -0,0 +1,90 @@ +[[!meta title="How to access gluster running from multiple networks"]] + +# TL;DR + +Create volumes name based instead of IP based: + + gluster volume create xfs-plain replica 2 transport vmhost1:/home/gluster vmhost2:/home/gluster + +instead of + + gluster volume create xfs-plain replica 2 transport 192.168.0.1:/home/gluster 192.168.0.2:/home/gluster +And have the names point to different IP addresses. + +## The setup + +The basic setup (in our case) looks like this: + + + --------------------------------- + | Clients / Users | + --------------------------------- + | + | + --------------------------------- --------------------------------- + | frontend (with opennebula) | ---| vmhost1 with glusterfs | + --------------------------------- / --------------------------------- + | / eth0 eth1 + |-------------------------< || + \ eth0 eth1 + \ --------------------------------- + ---| vmhost2 with glusterfs | + --------------------------------- + + +The frontend running [[!opennebula]] connects to +**vmhost1** and **vmhost2** using their public interfaces. + +The gluster bricks running on the vm hosts are supposed to communicate +via eth1, so that the traffic for [[!gluster]] does not influence +the traffic of the virtual machines to the Internet. The gluster filesystem +of the vmhosts is only thought to be used by the virtual machines running +on those two hosts - an isolated cluster. Thus the volume initially has been created +like this: + + gluster volume create xfs-plain replica 2 transport 192.168.0.1:/home/gluster 192.168.0.2:/home/gluster + +## The problem + +However, the frontend requires access to the gluster volume, because +[[!opennebula]] needs to copy and import the VM image into the gluster +datastore. Even though the *glusterd* process listens on any IP address, +the volume contains the information that it runs on 192.168.0.1 +and 192.168.0.2 and is thus not reachable from the frontend. + +## Using name based volumes + +The frontend can reach the vm hosts via **vmhost1** and **vmhost2**, +which resolves to their **public IP addresses** via DNS. + +On the vm hosts we created entries in **/etc/hosts** using [[!cdist]] +that looks as following: + + 192.168.0.1 vmhost1 + 192.168.0.2 vmhost2 + +Now we re-created the volume using + + gluster volume create xfs-plain replica 2 transport tcp vmhost1:/home/gluster vmhost2:/home/gluster + gluster volume start xfs-plain + +And it correctly shows up in the volume info: + + %gluster volume info + Volume Name: xfs-plain + Type: Replicate + Volume ID: fe45c626-c79d-4e67-8f19-77938470f2cf + Status: Started + Number of Bricks: 1 x 2 = 2 + Transport-type: tcp + Bricks: + Brick1: vmhost1-cluster1.place4.ungleich.ch:/home/gluster + Brick2: vmhost2-cluster1.place4.ungleich.ch:/home/gluster + +And now we can mount it successfully on the frontend using + + % mount -t glusterfs vmhost2:/xfs-plain /mnt/gluster + +[[!inline pages="follow-up-include" archive="yes" show=0 quick=no]] + +[[!tag gluster filesystem unix ungleich]] diff --git a/follow-up-including.mdwn b/follow-up-including.mdwn new file mode 100644 index 00000000..66b2abed --- /dev/null +++ b/follow-up-including.mdwn @@ -0,0 +1,7 @@ +## Follow up + +If you find this article interesting, you may want to stay updated by following +me and ungleich on Twitter: + +* [[!twitter ungleich]] +* [[!twitter NicoSchottelius]] diff --git a/shortcuts.mdwn b/shortcuts.mdwn index 2213e1b0..1e68220d 100644 --- a/shortcuts.mdwn +++ b/shortcuts.mdwn @@ -36,6 +36,7 @@ * [[!shortcut name=notmuch desc="notmuch" url="http://notmuchmail.org/"]] * [[!shortcut name=opennebula desc="Opennebula" url="http://www.opennebula.org"]] * [[!shortcut name=ceph desc="Ceph" url="http://ceph.com/"]] +* [[!shortcut name=gluster desc="Gluster" url="http://www.gluster.org/"]] * [[!shortcut name=consul desc="Consul" url="http://consul.io/"]] * [[!shortcut name=icinga desc="Icinga" url="https://www.icinga.org/"]] * [[!shortcut name=nagios desc="Nagios" url="http://www.nagios.org/"]]