Distributed File System on Amazon Linux — GlusterFS

  • Post author:
  • Post category:IT
  • Post comments:0评论

[Introduction]

This article provides a quick started guide on how to set up and configure GlusterFS on Amazon Linux. Two EC2 instance are being launched to accomplish this goal. On both EC2 instances, there is an instance-store volume serving as the shared storage.

Edit /etc/hosts on both EC2 instances with the following entries (assuming that the private IP addresses are 172.31.0.11 and 172.31.0.12).

172.31.4.11	gluster01
172.31.4.12	gluster02

Create the a repository definition /etc/yum.repos.d/gluster-epel.repo with the following content:

# Place this file in your /etc/yum.repos.d/ directory

[glusterfs-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-6/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=0

[glusterfs-noarch-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-6/noarch
enabled=1
skip_if_unavailable=1
gpgcheck=0

[glusterfs-source-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes. - Source
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-6/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=0

Use the following commands to install the necessary packages and start services.

sudo yum update
sudo yum install fuse fuse-libs nfs-utils
sudo yum install glusterfs glusterfs-fuse glusterfs-geo-replication glusterfs-server

sudo chkconfig glusterd on
sudo chkconfig glusterfsd on
sudo chkconfig rpcbind on
sudo service glusterd start
sudo service rpcbind start

[Configurations]

On both EC2 instances, create file system on the instance-store volume and mount it to /glusterfs.

sudo mkdir /glusterfs
sudo mkfs.ext4 /dev/xvdb
sudo mount /dev/xvdb /glusterfs
sudo mkdir -p /glusterfs/brick

On gluster01, probe the other EC2 instance and create the GlusterFS volume. The name of the volume is “test-volume”.

sudo gluster peer probe gluster02
sudo gluster volume create test-volume replica 2 transport tcp gluster01:/glusterfs/brick gluster02:/glusterfs/brick
sudo gluster volume start test-volume

On both EC2 instance, mount the GlusterFS volume. The name of the volume is “test-volume”. Then we change the ownership of the /mnt/glusterfs folder to “ec2-user:ec2-user” so that the default “ec2-user” can use the shared folder directly.

sudo mkdir -p /mnt/glusterfs
sudo mount -t glusterfs gluster01:test-volume /mnt/glusterfs
cd /mnt
sudo chown -R ec2-user:ec2-user glustefs
mount
df -h

Now the shared file system has been set up, and you can create a text file under /mnt/glusterfs and observe that the file created appears on both EC2 instances. Please bear in mind that this is only a quick start guide, and you should not use this configuration directly in a production system without further tunings.

发表回复