Linux

How to install gluster-server on centos 7

GlusterFS

Add new hard disk and format with preferred file system

first, add new hard drive with the same capacity

  • on both servers, update /etc/hosts:

192.168.1.3 mail1
192.168.1.4 mail2
  • add new disk on mail1:

type 'n', and hit enter for next question, (don't forget to write) hit 'w'

fdisk /dev/sdb
/sbin/mkfs.ext4 /dev/sdb1
mkdir /glusterfs1

Update /etc/fstab:

/dev/sdb1 /glusterfs1      ext4    defaults        1 2

remount all:

mount -a
  • add new disk on mail2:

type 'n', and hit enter for next question, (don't forget to write) hit 'w'

fdisk /dev/sdb
/sbin/mkfs.ext4 /dev/sdb1
mkdir /glusterfs2

Update /etc/fstab:

/dev/sdb1 /glusterfs2      ext4    defaults        1 2

remount all

mount -a

Install and Configure GulsterFS

  • on both servers (mail1 & mail2):

yum -y install epel-release
yum -y install centos-release-gluster38.noarch
yum -y install glusterfs glusterfs-fuse glusterfs-server

activate the service

systemctl enable glusterd.service
systemctl start glusterd.service

disabling firewall

systemctl stop firewalld.service
systemctl disable firewalld.service
  • on mail1:

gluster peer probe mail2
  • on mail2:

gluster peer probe mail1

you can check status with command below:

gluster peer status
  • ONLY on mail1:

gluster volume create mailrep-volume replica 2  mail1:/glusterfs1/vmail  mail2:/glusterfs2/vmail force
gluster volume start mailrep-volume

check it

gluster volume info mailrep-volume
  • create folder for vmail and mount glusterfs to vmail folder

on mail1:

mkdir  /var/vmail
mount.glusterfs mail1:/mailrep-volume /var/vmail/

Update /etc/fstab

mail1:/mailrep-volume /var/vmail glusterfs defaults,_netdev 0 0

remount all

mount -a

check it

df -h
  • on mail2:

mkdir  /var/vmail
mount.glusterfs mail2:/mailrep-volume /var/vmail/

Update /etc/fstab:

mail2:/mailrep-volume /var/vmail glusterfs defaults,_netdev 0 0

remount all

mount -a

check it

df -h

you can test it by creating some files on one of your mail servers

cd /var/vmail; touch R1 R2 R3 R4 R5 R6

make sure it syncs, by checking files on both servers

ls -la /var/vmail

Note: 

if output No package centos-release-gluster38.noarch available.

Please run command bellow:

sudo yum install centos-release-storage-common
sudo yum install glusterfs-server

Or

sudo yum install centos-release-gluster
sudo yum install glusterfs-server

Thanks for visit my website