Skip to content

Instantly share code, notes, and snippets.

@brunneis
Last active December 10, 2019 15:46
Show Gist options
  • Save brunneis/d217e45914980f053ccac44e938edd9b to your computer and use it in GitHub Desktop.
Save brunneis/d217e45914980f053ccac44e938edd9b to your computer and use it in GitHub Desktop.
GlusterFS

Servers

Installation

yum -y install centos-release-gluster
yum -y install glusterfs-server ntp
systemctl enable glusterd ntpd
systemctl start glusterd ntpd
apt -y install glusterfs-server ntp
systemctl enable glusterd ntp
systemctl start glusterd ntp

Add nodes

gluster peer probe dynastinae0
gluster peer probe dynastinae1
gluster peer probe dynastinae2

Create volumes with 2 replicas + 1 arbiter WITH 3 NODES

## dynastinae0
mkdir -p /media/wdr0/gluster/00 /media/wdr0/gluster/21 /media/wdr0/gluster/12

## dynastinae1
mkdir -p /media/wdr1/gluster/10 /media/wdr1/gluster/01 /media/wdr1/gluster/22

# dynastinae2
mkdir -p /media/wdr2/gluster/20 /media/wdr2/gluster/11 /media/wdr2/gluster/02

gluster volume create wdr replica 3 arbiter 1 \
dynastinae0:/media/wdr0/gluster/00 dynastinae1:/media/wdr1/gluster/01 dynastinae2:/media/wdr2/gluster/02 \
dynastinae1:/media/wdr1/gluster/10 dynastinae2:/media/wdr2/gluster/11 dynastinae0:/media/wdr0/gluster/12 \
dynastinae2:/media/wdr2/gluster/20 dynastinae0:/media/wdr0/gluster/21 dynastinae1:/media/wdr1/gluster/22

gluster volume start wdr
## dynastinae0
mkdir -p /media/wdw0/gluster/00 /media/wdw0/gluster/21 /media/wdw0/gluster/12

## dynastinae1
mkdir -p /media/wdw1/gluster/10 /media/wdw1/gluster/01 /media/wdw1/gluster/22

# dynastinae2
mkdir -p /media/wdw2/gluster/20 /media/wdw2/gluster/11 /media/wdw2/gluster/02

gluster volume create wdw replica 3 arbiter 1 \
dynastinae0:/media/wdw0/gluster/00 dynastinae1:/media/wdw1/gluster/01 dynastinae2:/media/wdw2/gluster/02 \
dynastinae1:/media/wdw1/gluster/10 dynastinae2:/media/wdw2/gluster/11 dynastinae0:/media/wdw0/gluster/12 \
dynastinae2:/media/wdw2/gluster/20 dynastinae0:/media/wdw0/gluster/21 dynastinae1:/media/wdw1/gluster/22

gluster volume start wdw
## dynastinae0
mkdir -p /media/cr0/gluster/00 /media/cr0/gluster/21 /media/cr0/gluster/12

## dynastinae1
mkdir -p /media/cr1/gluster/10 /media/cr1/gluster/01 /media/cr1/gluster/22

# dynastinae2
mkdir -p /media/cr2/gluster/20 /media/cr2/gluster/11 /media/cr2/gluster/02

gluster volume create cr replica 3 arbiter 1 \
dynastinae0:/media/cr0/gluster/00 dynastinae1:/media/cr1/gluster/01 dynastinae2:/media/cr2/gluster/02 \
dynastinae1:/media/cr1/gluster/10 dynastinae2:/media/cr2/gluster/11 dynastinae0:/media/cr0/gluster/12 \
dynastinae2:/media/cr2/gluster/20 dynastinae0:/media/cr0/gluster/21 dynastinae1:/media/cr1/gluster/22

gluster volume start cr

Mount volumes

mount.glusterfs localhost:wdr /media/gluster/wdr
mount.glusterfs localhost:wdw /media/gluster/wdw
mount.glusterfs localhost:cr /media/gluster/cr

FStab

# GlusterFS volume wdr
localhost:/wdr /media/gluster/wdr glusterfs defaults,_netdev 0 0

# GlusterFS volume wdw
localhost:/wdw /media/gluster/wdw glusterfs defaults,_netdev 0 0

# GlusterFS volume cr
localhost:/cr /media/gluster/cr glusterfs defaults,_netdev 0 0

Clients

Installation

apt -y install glusterfs-client
yum -y install glusterfs-client

FStab

# GlusterFS volume wdr
dynastinae0:/wdr /media/gluster/wdr glusterfs defaults,_netdev 0 0

# GlusterFS volume wdw
dynastinae0:/wdw /media/gluster/wdw glusterfs defaults,_netdev 0 0

# GlusterFS volume cr
dynastinae0:/cr /media/gluster/cr glusterfs defaults,_netdev 0 0

Commands

gluster volume status all detail
gluster volume status all clients
gluster volume info all
gluster peer status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment