Membuat Distributed Volume di GlusterFS 3.10

Pada tutorial kali ini saya akan membahas tentang metode penyimpanan distribusi pada glusterFS. Apa yang dimaksud dengan Distributed? Jadi kapan kita mengunakan metode ini? Baik mari kita bahas secara mendalam. Sebelum mulai lab ini, maka anda harus coba install glusterFs terbelih dahulu ya (disini)

Jenis distributed volume adalah pilihan default jika kita tidak mencantumkan pada saat awal konfigurasi. Disini file akan didistribusikan diberbagai brick pada volume jadi file dapat disimpan pada brick hpc01 , hpc02  atau hpc03 tapi tidak kedua-duanya. Oleh karena itu pada penerapan distributed volume tidak ada redudansi data.

*note : kegagalan disk atau server pada volume terdistribusi dapat mengakibatkan hilangnya data karena isi direktori tersebar secara acak pada brick dalam volume.

Jadi skema distributed volume yang akan dilab kan adalah seperti diatas, dimana nanti semua file yang tersimpan pada cluster storage akan di distribusikan ke masing2 hpc secara acak.

setelah itu config cluster storage  (cukup dilakukan pada satu node saja misal di hpc01 )

[root@hpc01 ~]# gluster peer probe hpc02
peer probe: success. 
[root@hpc01 ~]# gluster peer probe hpc03
peer probe: success. 

gluster peer probe berfungsi untuk membuat cluster pada glusterfs, sehingga semua node bisa saling berkominikasi dan menjadikannya satu cluster. setelah itu kita bisa melihat status cluster dengan cara seperti ini

[root@hpc01 ~]# gluster peer status
Number of Peers: 2

Hostname: hpc02
Uuid: 3d8b736c-3d74-40c3-a629-86b1761e5eea
State: Peer in Cluster (Connected)

Hostname: hpc03
Uuid: ffdf6ff5-0372-40ac-93d4-e13d3fd7e451
State: Peer in Cluster (Connected)

Pastikan state peer in cluster bernilai connected, utnuk semua node.

Sebelumnya kita harus membuat direktori atau brick pada semua node hpc

# mkdir /glusterfs/distributed

setalah itu buat volume dengan tipe distributed yang dilakukan disalah satu node saja ( contoh : hpc01)

[root@hpc01 ~]# gluster volume create vol_distributed transport tcp hpc01:/glusterfs/distributed hpc02:/glusterfs/distributed hpc03:/glusterfs/distributed
volume create: vol_distributed: success: please start the volume to access data

setelah succes membuat vol_distributed maka volume tersebut supaya bisa diakses oleh client maka harus di start terlebih dahulu.

[root@hpc01 ~]# gluster volume start vol_distributed
volume start: vol_distributed: success

setelah itu, kita bisa memverifikasi volume distributed dengan cara seperti berikut ini

[root@hpc01 ~]# gluster volume info
 
Volume Name: vol_distributed
Type: Distribute
Volume ID: e2069fda-acb9-4747-80b7-5930d99497ab
Status: Started
Snapshot Count: 0
Number of Bricks: 3
Transport-type: tcp
Bricks:
Brick1: hpc01:/glusterfs/distributed
Brick2: hpc02:/glusterfs/distributed
Brick3: hpc03:/glusterfs/distributed
Options Reconfigured:
transport.address-family: inet
nfs.disable: on

dan setelah itu kita bisa melihat status volume

[root@hpc01 ~]# gluster volume status
Status of volume: vol_distributed
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick hpc01:/glusterfs/distributed          49152     0          Y       9429 
Brick hpc02:/glusterfs/distributed          49152     0          Y       4268 
Brick hpc03:/glusterfs/distributed          49152     0          Y       8757 
 
Task Status of Volume vol_distributed
------------------------------------------------------------------------------
There are no active volume tasks

setelah  cluster sotragenya terbentuk, maka selanjutnya adalah mengkonfigurasi client suapaya dapat mengakses glusterfs.

[Client]

Untuk tahap terakhir adalah menginstall gluster client di sis client. pada dasarnya client utnuk mengakses gluserfs server membutuhkan FUSE (Filesystem in UserSpace), dengan menginstall seperti dibawah ini, pastikan versi glusterfs yg di install pada client sama seperti di server

# yum -y install centos-release-gluster310
# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-3.10.repo
# yum --enablerepo=centos-gluster310,epel -y install glusterfs glusterfs-fuse

setelah itu mounting volume vol_distributed ke folder /mnt

[root@automation-vm ~]# mount -t glusterfs hpc01:/vol_distributed /mnt/
[root@automation-vm ~]# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/vda1               4,8G  1,2G  3,5G  25% /
devtmpfs                991M     0  991M   0% /dev
tmpfs                  1000M     0 1000M   0% /dev/shm
tmpfs                  1000M  8,3M  991M   1% /run
tmpfs                  1000M     0 1000M   0% /sys/fs/cgroup
tmpfs                   200M     0  200M   0% /run/user/0
hpc01:/vol_distributed   15G   97M   15G   1% /mnt

setelah kita cek dengan df -h dari sisi klien disitu terbaca bahwa  hpc01:/vol_distributed 15G itu artinya semua volume yang ada di setiap node, kapasitasnya ditambah 😀

untuk testing kita akan membuat 30 file, pada folder /mnt, kemudian setelah itu kita harus cek pada semua volume di server, untuk memastikan bahwa semau file tersebut telah terdistribusi ke masing2 brick pada volume vol_distributed.

[root@automation-vm ~]# cd /mnt/
[root@automation-vm mnt]# touch file{1..30}
[root@automation-vm mnt]# ls /mnt/
file1   file12  file15  file18  file20  file23  file26  file29  file4  file7
file10  file13  file16  file19  file21  file24  file27  file3   file5  file8
file11  file14  file17  file2   file22  file25  file28  file30  file6  file9

Dari sisi client, semua file akan terlihat semua yaitu 30 file, namun dari sisi server, kita bisa melihat bahwa itu akan distribusi, ayo kita liat 😀

[HPC01]

[root@hpc01 ~]# ls /glusterfs/distributed/
file14  file20  file22  file26  file5  file8
file15  file21  file23  file30  file6

[HPC02]

[root@hpc02 ~]# ls /glusterfs/distributed/
file10  file12  file13  file18  file28  file3  file4  file7  file9

[HPC03]

[root@hcp03 ~]# ls /glusterfs/distributed/
file1  file11  file16  file17  file19  file2  file24  file25  file27  file29

dari situ kita sudah berhasil, membutikan bahwa ketika kita mengunakan volume distributed pada glusterfs maka file tersebut akan di distribusikan pada semua node.

Baik, cukup sekian lab kali ini tentang distributed volume di glusterfs, untuk lab selanjutnya kita akan bahas yg replicated di glusterfs, see you next time. Wassalamualaikum 🙂

About the author
Alan Adi Prastyo

Routecloud Networks

Information about Server, Linux and Computer Network.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Routecloud Networks.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.