Credits: http://gluster.readthedocs.io/en/latest/Quick-Start-Guide/Quickstart/
The setup is a 2 node architecture with 2 EBS volumes on each EC2 instance, both instances are in the same network.
(Creation of EC2 instances is not in the scope of this document).
- SSH into the ec2 instance
- Create partition and format the second volume
- fdisk /dev/xvdb
- n, p, 1, enter, enter and then w
- mkfs.xfs -i size=512 /dev/xvdb1
- mkdir -p /data/brick1
- echo ‘/dev/xvdb1 /data/brick1 xfs defaults 1 2’ >> /etc/fstab
- mount /dev/xvdb1 /data/brick1/ -t xfs
- yum install epel-release
- yum install centos-release-gluster
- yum install glusterfs-server
- service glusterd start
- service glusterd status
- gluster peer probe gluster1 (from gluster2)
- gluster peer probe gluster2 (from gluster1)
- mkdir -p /data/brick1/gv0
- gluster volume create gv0 replica 2 gluster1:/data/brick1/gv0 gluster2: /data/brick1/gv0
- gluster volume start gv0
- gluster volume info
Test
- mount -t glusterfs gluster1:/gv0 /mnt
- for i in `seq -w 1 100`; do cp -rp /var/log/messages /mnt/copy-test-$i; d one
- ls -lA /mnt | wc -l
- ls -lA /data/brick1/gv0 (in each server to prove that files replicated across both)