Membuat High-Availability Storage Server dengan GlusterFS
Tutorial kali ini berangkat dari apa yang saya coba bangun kemarin, saya mencoba membuat 2 server storage dengan kemampuan tinggi menggunakan GlusterFS di Ubuntu Server 10.04. Skenarionya, setiap server storage akan menjadi cermin/mirror dari server storage yang lain dan file akan otomatis saling direplikasi diantara kedua server tersebut.
GlusterFS memang file sistem cluster yang luar biasa, GlusterFS mampu menangani storage sampai dengan akhiran petabyte!. Hal ini wajar karena Gluster sendiri dikembangkan dengan mengkombinasikan beberapa teknologi seperti Infiniband RDMA atau interkoneksi TCP/IP pada jaringan file sistem besar.
Sekadar catatan, IP Address yang saya gunakan adalah 192.168.0.100 untuk server1, 192.168.0.101 untuk server2 dan sebuah client dengan IP 192.168.0.102. Semua komputer tersebut harus sudah mempunyai hostname yang jelas (silakan oprek /etc/hosts/ anda).
Langkah Instalasi Server GlusterFS
1. masuk sebagai root pada terminal,
2. jalankan instalasi glusterfs-server dengan aptitude
aptitude install glusterfs-server
setelah selesai kita dapat mengecek versi keberapa GlusterFS yang kita pakai dengan command
glusterfs --version
contohnya:
[email protected]:~# glusterfs --version glusterfs 3.0.2 built on Mar 23 2010 00:24:16 Repository revision: v3.0.2 Copyright (c) 2006-2009 Gluster Inc. <http://www.gluster.com> GlusterFS comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GlusterFS under the terms of the GNU General Public License. [email protected]:~#
3. buat beberapa direktori penting:
mkdir /data/ mkdir /data/export mkdir /data/export-ns
4. buat konfigruasi untuk glusterfs server di
/etc/glusterfs/gluesterfsd.vol
dengan mencadangkan file asli dan melakukan pengubahan seperti mendefisikan kembali direktori yang akan diekspor (misalnya /data/export) dan client mana yang diperbolehkan (misalnya 192.168.0.102) dll.
cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol_orig cat /dev/null > /etc/glusterfs/glusterfsd.vol vi /etc/glusterfs/glusterfsd.vol
berikut konfigurasi milik saya:
volume posix type storage/posix option directory /data/export end-volume volume locks type features/locks subvolumes posix end-volume volume brick type performance/io-threads option thread-count 8 subvolumes locks end-volume volume server type protocol/server option transport-type tcp option auth.addr.brick.allow 192.168.0.102 subvolumes brick end-volume
Oh ya, selain anda menetapkan IP address secara statik, anda bisa juga menggunakan wildcard seperti 192.168.* serta menaruh banyak IP pada baris yang sama dengan dipisah tanda koma.
5. restart daemon glusterfs server
/etc/init.d/glusterfs-server start
Konfigurasi Client GlusterFS
Client dari sistem GlusterFS ini juga harus dikonfigurasi. Untuk tiap klien harus diinstall glusterfs-client dan glusterfs-server.
1. instalasi glusterfs-client dan glusterfs-server
aptitude install glusterfs-client glusterfs-server
2. buat direktori untuk mounting sistem glusterfs
mkdir /mnt/glusterfs
3. buat konfigurasi glusterfs.vol dengan langkah serupa (salin dan ubah).
cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol_orig cat /dev/null > /etc/glusterfs/glusterfs.vol vi /etc/glusterfs/glusterfs.vol
berikut contoh konfigurasi saya:
volume remote1 type protocol/client option transport-type tcp option remote-host server1.example.com option remote-subvolume brick end-volume volume remote2 type protocol/client option transport-type tcp option remote-host server2.example.com option remote-subvolume brick end-volume volume replicate type cluster/replicate subvolumes remote1 remote2 end-volume volume writebehind type performance/write-behind option window-size 1MB subvolumes replicate end-volume volume cache type performance/io-cache option cache-size 512MB subvolumes writebehind end-volume
Catt. Pastikan anda mencantumkan hostname atau IP address yang benar pada baris-baris option remote-host!
Penggunaan
Untuk menggunakan storage besar ini, anda harus melakukan mounting dulu dengan perintah sebagai berikut:
glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs
atau
mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs
berikut adalah contoh apa yang terjadi ketika saya menjalankan command mount:
[email protected]:~# mount /dev/mapper/server3-root on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) none on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) none on /dev type devtmpfs (rw,mode=0755) none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) none on /dev/shm type tmpfs (rw,nosuid,nodev) none on /var/run type tmpfs (rw,nosuid,mode=0755) none on /var/lock type tmpfs (rw,noexec,nosuid,nodev) none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755) none on /var/lib/ureadahead/debugfs type debugfs (rw,relatime) /dev/sda1 on /boot type ext2 (rw) /etc/glusterfs/glusterfs.vol on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072) [email protected]:~#
kalau dicek dengan perintah df -h, hasilnya sebagai berikut:
[email protected]:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/server3-root 29G 852M 26G 4% / none 243M 172K 242M 1% /dev none 247M 0 247M 0% /dev/shm none 247M 36K 247M 1% /var/run none 247M 0 247M 0% /var/lock none 247M 0 247M 0% /lib/init/rw none 29G 852M 26G 4% /var/lib/ureadahead/debugfs /dev/sda1 228M 17M 199M 8% /boot /etc/glusterfs/glusterfs.vol 18G 848M 16G 5% /mnt/glusterfs [email protected]:~#
dapat dilihat kalau server1 memilik ruang bebas sekitar 18GB saja, padahal aslinya 36GB, hal ini dikarenakan kita memilih opsi saling mirror sehingga terdeteksi separuhnya saja.
Untuk melakukan mounting otomatis tiap sistem linux dijalankan, silakan masukkan baris berikut pada /etc/fstab:
/etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults 0 0
Lakukan reboot pada client dan cek ulang dengan perintah df serta mount.
Salam,
Luthfi Emka
PPTIK Universitas Negeri Semarang