Skip to content

emka.web.id

Menu
  • Home
  • Indeks Artikel
  • Tutorial
  • Tentang Kami
Menu

Membuat High-Availability Storage Server dengan GlusterFS

Posted on October 08, 2010 by Syauqi Wiryahasana
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 [sourcecode language="bash"]aptitude install glusterfs-server[/sourcecode] setelah selesai kita dapat mengecek versi keberapa GlusterFS yang kita pakai dengan command [code]glusterfs --version[/code] contohnya: [code] root@server1:~# 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. root@server1:~# [/code] 3. buat beberapa direktori penting: [code]mkdir /data/ mkdir /data/export mkdir /data/export-ns[/code] 4. buat konfigruasi untuk glusterfs server di [code]/etc/glusterfs/gluesterfsd.vol[/code] 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. [sourcecode] cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol_orig cat /dev/null > /etc/glusterfs/glusterfsd.vol vi /etc/glusterfs/glusterfsd.vol [/sourcecode] berikut konfigurasi milik saya: [sourcecode] 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 [/sourcecode] 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 [code]/etc/init.d/glusterfs-server start[/code]

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 [code]aptitude install glusterfs-client glusterfs-server[/code] 2. buat direktori untuk mounting sistem glusterfs [code]mkdir /mnt/glusterfs[/code] 3. buat konfigurasi glusterfs.vol dengan langkah serupa (salin dan ubah). [sourcecode] cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol_orig cat /dev/null > /etc/glusterfs/glusterfs.vol vi /etc/glusterfs/glusterfs.vol [/sourcecode] berikut contoh konfigurasi saya: [code] 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 [/code] 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: [code] glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs [/code] atau [code] mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs [/code] berikut adalah contoh apa yang terjadi ketika saya menjalankan command mount:
root@client1:~# 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)
 root@client1:~#
kalau dicek dengan perintah df -h, hasilnya sebagai berikut:
root@client1:~# 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
 root@client1:~#
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: [code] /etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults 0 0 [/code] Lakukan reboot pada client dan cek ulang dengan perintah df serta mount. Salam, Luthfi Emka PPTIK Universitas Negeri Semarang
Seedbacklink

Recent Posts

TENTANG EMKA.WEB>ID

EMKA.WEB.ID adalah blog seputar teknologi informasi, edukasi dan ke-NU-an yang hadir sejak tahun 2011. Kontak: kontak@emka.web.id.

©2024 emka.web.id Proudly powered by wpStatically