jittagornp.me
จิตกร พิทักษ์เมธากุล
Jan 17, 2020

Install GlusterFS (Distribute Storage) on Ubuntu 18.04

glusterfs.png

Environments

  • Linux Ubuntu 18.04
  • Nodes
1. client-node : xxxxx  
2. glusterfs-node1 : 10.130.15.87
3. glusterfs-node2 : 10.130.117.8    

Steps

  1. Install glusterfs-server on Storage Server
  2. Create Mount Point on Storage Server
  3. Set Storage Pool
  4. Create Volume
  5. Install glusterfs-client
  6. Create Mount Point on Client
  7. Bind Mount Point from Client to Storage Volume

On glusterfs-node1 & glusterfs-node2

  1. edit hosts (map ip & hostname)
$ vi /etc/hosts

add configs

10.130.15.87 glusterfs-node1
10.130.117.8 glusterfs-node2
  1. install software-properties-common
$ sudo apt install software-properties-common -y
  1. download glusterfs public-key
    see version on https://download.gluster.org/pub/gluster/glusterfs/
$ wget -O- https://download.gluster.org/pub/gluster/glusterfs/6/rsa.pub | apt-key add -  
  1. add repository
$ sudo add-apt-repository ppa:gluster/glusterfs-6  
  1. install glusterfs
$ sudo apt install glusterfs-server -y
  1. start glusterfs service
$ sudo systemctl start glusterd
  1. enabled run everytime at system boot
$ sudo systemctl enable glusterd
  1. show glusterfs status
$ systemctl status glusterd
  1. show glusterfs version
$ glusterfsd --version
  1. create directory for share in cluster
$ mkdir -p /storage

Only glusterfs-node1

  1. add server to glusterfs storage pool
$ gluster peer probe glusterfs-node2  
  1. check status
$ gluster peer status
  1. show list
$ gluster pool list  
  1. create volume (select 4.1 or 4.2)

4.1) replica

$ gluster volume create volume-01 replica 2 transport tcp \
glusterfs-node1:/storage \
glusterfs-node2:/storage \
force

4.2) distribute

$ gluster volume create volume-01 transport tcp \
glusterfs-node1:/storage \
glusterfs-node2:/storage \
force

volume-01 is name of volume

  1. start volume
$ gluster volume start volume-01  
  1. show volume info
$ gluster volume info volume-01   

On client-node

  1. edit hosts (map ip & hostname)
$ vi /etc/hosts

add configs

10.130.15.87 glusterfs-node1
10.130.117.8 glusterfs-node2
  1. download glusterfs public-key
    see version on https://download.gluster.org/pub/gluster/glusterfs/
$ wget -O- https://download.gluster.org/pub/gluster/glusterfs/6/rsa.pub | apt-key add -  
  1. add repository
$ sudo add-apt-repository ppa:gluster/glusterfs-6  
  1. install glusterfs client
$ sudo apt install glusterfs-client -y
  1. create mount directory
$ mkdir -p /storage  
  1. mount to volumn (glusterfs-node1:/volume-01)
$ sudo mount -t glusterfs glusterfs-node1:/volume-01 /storage  

/storage is directory on client-node

  1. check available volume
$ df -h /storage  

/storage is directory on client-node

  1. set permanent mount
$ vim /etc/fstab

add configuration

glusterfs-node1:/volume-01 /storage glusterfs defaults,_netdev 0 0  

Test On Client-node

try create empty file file01, file02, file03

$ cd /storage
$ touch file01 file02 file03  

On glusterfs-node1 & glusterfs-node2

show file on glusterfs node

$ cd /storage
$ ll

Reference

https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-ubuntu-1804/

จิตกร พิทักษ์เมธากุล
วิธีการทำนายอนาคตที่ดีที่สุด คือ การสร้างมันขึ้นมา