Tutorial ini menunjukkan bagaimana melakukan striping data (segmentasi data sekuensial logis, seperti file tunggal, sehingga segmen dapat ditetapkan ke beberapa perangkat fisik secara round-robin dan dengan demikian ditulis secara bersamaan) di empat server penyimpanan tunggal (menjalankan CentOS 5.4) dengan GlusterFS. Sistem klien (CentOS 5.4 juga) akan dapat mengakses penyimpanan seolah-olah itu adalah sistem file lokal. GlusterFS adalah sistem file berkerumun yang mampu menskalakan hingga beberapa peta-byte. Ini menggabungkan berbagai bata penyimpanan melalui Infiniband RDMA atau TCP/IP interkoneksi ke dalam satu sistem file jaringan paralel yang besar. Bata penyimpanan dapat dibuat dari perangkat keras komoditas apa pun seperti server x86_64 dengan RAID SATA-II dan HBA Infiniband.
Harap dicatat bahwa jenis penyimpanan ini tidak menyediakan fitur ketersediaan tinggi/toleransi kesalahan, seperti halnya dengan penyimpanan yang direplikasi.
Saya tidak memberikan jaminan apa pun bahwa ini akan berhasil untuk Anda!
1 Catatan Awal
Dalam tutorial ini saya menggunakan lima sistem, empat server dan satu klien:
- server1.example.com:alamat IP 192.168.0.100 (server)
- server2.example.com:alamat IP 192.168.0.101 (server)
- server3.example.com:alamat IP 192.168.0.102 (server)
- server4.example.com:alamat IP 192.168.0.103 (server)
- client1.example.com:alamat IP 192.168.0.104 (klien)
Kelima sistem harus dapat menyelesaikan nama host sistem lain. Jika ini tidak dapat dilakukan melalui DNS, Anda harus mengedit file /etc/hosts sehingga berisi baris berikut di kelima sistem:
vi /etc/hosts
[...] 192.168.0.100 server1.example.com server1 192.168.0.101 server2.example.com server2 192.168.0.102 server3.example.com server3 192.168.0.103 server4.example.com server4 192.168.0.104 client1.example.com client1 [...] |
(Dimungkinkan juga untuk menggunakan alamat IP alih-alih nama host dalam pengaturan berikut. Jika Anda lebih suka menggunakan alamat IP, Anda tidak perlu peduli apakah nama host dapat diselesaikan atau tidak.)
2 Menyiapkan Server GlusterFS
server1.example.com/server2.example.com/server3.example.com/server4.example.com:
GlusterFS tidak tersedia sebagai paket untuk CentOS 5.4, oleh karena itu kita harus membangunnya sendiri. Pertama kita install prasyaratnya:
yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
yum install libibverbs-devel fuse-devel
Kemudian kami mengunduh rilis GlusterFS terbaru dari http://www.gluster.org/download.php dan membangunnya sebagai berikut:
cd /tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/TERBARU/glusterfs-2.0.9.tar.gz
tar xvfz glusterfs-2.0.9.tar .gz
cd glusterfs-2.0.9
./configure
Di akhir perintah ./configure, Anda akan melihat sesuatu seperti ini:
[...]
Ringkasan konfigurasi GlusterFS
==========================
Klien FUSE :yes
Kata kerja Infiniband : yes
epoll IO multiplex : yes
Berkeley-DB : yes
libglusterfsclient : yes
argp-standalone : no
[[email protected] glusterfs-2.0.9]#
buat &&buat instal
ldconfig
Periksa versi GlusterFS setelahnya (seharusnya 2.0.9):
glusterfs --version
[[email protected] glusterfs-2.0.9]# glusterfs --version
glusterfs 2.0.9 dibuat pada 1 Mar 2010 15:34:50
Revisi repositori:v2.0.9
Hak Cipta ( c) 2006-2009 Gluster Inc.
GlusterFS datang dengan BENAR-BENAR TANPA JAMINAN.
Anda dapat mendistribusikan kembali salinan GlusterFS di bawah persyaratan Lisensi Publik Umum GNU.
[[email protected] glusterfs-2.0.9]#
Selanjutnya kita buat beberapa direktori:
mkdir /data/
mkdir /data/ekspor
mkdir /data/ekspor-ns
mkdir /etc/glusterfs
Sekarang kita membuat file konfigurasi server GlusterFS /etc/glusterfs/glusterfsd.vol yang menentukan direktori mana yang akan diekspor (/data/ekspor) dan klien apa yang diizinkan untuk terhubung (192.168.0.104 =client1.example.com):
vi /etc/glusterfs/glusterfsd.vol
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/server option auth.addr.brick.allow 192.168.0.104 subvolumes brick end-volume |
Harap dicatat bahwa dimungkinkan untuk menggunakan wildcard untuk alamat IP (seperti 192.168.*) dan Anda dapat menentukan beberapa alamat IP yang dipisahkan dengan koma (misalnya 192.168.0.104,192.168.0.105).
Setelah itu kita buat symlink berikut...
ln -s /usr/local/sbin/glusterfsd /sbin/glusterfsd
... dan kemudian sistem startup menautkan untuk server GlusterFS dan memulainya:
chkconfig --levels 35 glusterfsd aktif
/etc/init.d/glusterfsd mulai
3 Menyiapkan Klien GlusterFS
client1.example.com:
GlusterFS tidak tersedia sebagai paket untuk CentOS 5.4, oleh karena itu kita harus membangunnya sendiri. Pertama kita install prasyaratnya:
yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
yum install libibverbs-devel fuse-devel
Kemudian kita memuat modul kernel sekering...
modprobe fuse
... dan buat file /etc/rc.modules dengan konten berikut sehingga modul kernel fuse akan dimuat secara otomatis setiap kali sistem boot:
vi /etc/rc.modules
modprobe fuse |
Jadikan file tersebut dapat dieksekusi:
chmod +x /etc/rc.modules
Kemudian kami mengunduh sumber GlusterFS 2.0.9 (harap dicatat bahwa ini adalah versi yang sama yang diinstal pada server!) dan membangun GlusterFS sebagai berikut:
cd /tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/TERBARU/glusterfs-2.0.9.tar.gz
tar xvfz glusterfs-2.0.9.tar .gz
cd glusterfs-2.0.9
./configure
Di akhir perintah ./configure, Anda akan melihat sesuatu seperti ini:
[...]
Ringkasan konfigurasi GlusterFS
==========================
Klien FUSE :yes
Kata kerja Infiniband : yes
epoll IO multiplex : yes
Berkeley-DB : yes
libglusterfsclient : yes
argp-standalone : no
buat &&buat instal
ldconfig
Periksa versi GlusterFS setelahnya (seharusnya 2.0.9):
glusterfs --version
[[email protected] glusterfs-2.0.9]# glusterfs --version
glusterfs 2.0.9 dibuat pada 1 Mar 2010 15:58:06
Revisi repositori:v2.0.9
Hak Cipta ( c) 2006-2009 Gluster Inc.
GlusterFS datang dengan BENAR-BENAR TANPA JAMINAN.
Anda dapat mendistribusikan kembali salinan GlusterFS di bawah persyaratan Lisensi Publik Umum GNU.
[[email protected] glusterfs-2.0.9]#
Kemudian kita buat dua direktori berikut:
mkdir /mnt/glusterfs
mkdir /etc/glusterfs
Selanjutnya kita buat file /etc/glusterfs/glusterfs.vol:
vi /etc/glusterfs/glusterfs.vol
volume remote1 type protocol/client option transport-type tcp/client option remote-host server1.example.com option remote-subvolume brick end-volume volume remote2 type protocol/client option transport-type tcp/client option remote-host server2.example.com option remote-subvolume brick end-volume volume remote3 type protocol/client option transport-type tcp/client option remote-host server3.example.com option remote-subvolume brick end-volume volume remote4 type protocol/client option transport-type tcp/client option remote-host server4.example.com option remote-subvolume brick end-volume volume stripe type cluster/stripe option block-size 1MB subvolumes remote1 remote2 remote3 remote4 end-volume volume writebehind type performance/write-behind option window-size 1MB subvolumes stripe end-volume volume cache type performance/io-cache option cache-size 512MB subvolumes writebehind end-volume |
Pastikan Anda menggunakan nama host server atau alamat IP yang benar pada opsi baris host jarak jauh!
Itu dia! Sekarang kita dapat memasang sistem file GlusterFS ke /mnt/glusterfs dengan salah satu dari dua perintah berikut:
glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs
atau
mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs
Anda sekarang akan melihat bagian baru di output...
mount
[[email protected] ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / ketik ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts ketik devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot ketik ext3 (rw)
tmpfs on / dev/shm ketik tmpfs (rw)
none di /proc/sys/fs/binfmt_misc ketik binfmt_misc (rw)
sunrpc di /var/lib/nfs/rpc_pipefs ketik rpc_pipefs (rw)
glusterfs#/etc/glusterfs/glusterfs.vol pada /mnt/glusterfs jenis sekering (rw,allow_other,default_permissions,max_read=131072)
[[email protected] ~]#
... dan...
df -h
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Dipasang di
/dev/mapper/VolGroup00-LogVol00
> /dev/sda1 99m 13m 82m 14%/boot
TMPFS 187M 0 187M 0%/dev/shm
GLUSTERFS#/etc/GLUSTERFS/GLUSTERFS.VOL
112g 2.3g 110g 2%/ mnt/glusterfs
[[email protected] ~]#
(server1.example.com, server2.example.com, server3.example.com, dan server4.example.com masing-masing memiliki sekitar 28GB ruang untuk sistem file GlusterFS, sehingga bagian yang dihasilkan memiliki ukuran sekitar 4 x 28GB ( 112 GB).)
Alih-alih memasang bagian GlusterFS secara manual pada klien, Anda dapat memodifikasi /etc/fstab sehingga bagian tersebut dipasang secara otomatis saat klien melakukan booting.
Buka /etc/fstab dan tambahkan baris berikut:
vi /etc/fstab
[...] /etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults 0 0 |
Untuk menguji apakah /etc/fstab Anda yang dimodifikasi berfungsi, reboot klien:
reboot
Setelah reboot, Anda akan menemukan share di output...
df -h
... dan...
mount
4 Pengujian
Sekarang mari kita buat file uji besar di share GlusterFS:
client1.example.com:
dd if=/dev/zero of=/mnt/glusterfs/test.img bs=1024k count=1000
ls -l /mnt/glusterfs
[[email protected] ~]# ls -l /mnt/glusterfs
total 1024032
-rw-r--r-- 1 root root 1048576000 2010-02-23 17:31 test.img
[[dilindungi email] ~]#
Sekarang mari kita periksa direktori /data/export pada server1.example.com, server2.example.com, server3.example.com, dan server4.example.com. Anda akan melihat file test.img pada setiap node, tetapi dengan ukuran yang berbeda (karena striping data):
server1.example.com:
ls -l /data/export
[[email protected] ~]# ls -l /data/export
total 256008
-rw-r--r-- 1 root root 1045430272 2010-02-23 17:31 test.img
[[dilindungi email] ~]#
server2.example.com:
ls -l /data/export
[[email protected] ~]# ls -l /data/export
total 256008
-rw-r--r-- 1 root root 1046478848 2010-02-23 17:27 test.img
[[dilindungi email] ~]#
server3.example.com:
ls -l /data/export
[[email protected] ~]# ls -l /data/export
total 256008
-rw-r--r-- 1 root root 1047527424 2010-02-23 17:26 test.img
[[dilindungi email] ~]#
server4.example.com:
ls -l /data/export
[[email protected] ~]# ls -l /data/export
total 256008
-rw-r--r-- 1 root root 1048576000 2010-02-23 17:30 test.img
[[dilindungi email] ~]#
5 Tautan
- GlusterFS:http://www.gluster.org/
- CentOS:http://www.centos.org/