2009年5月14日 星期四

Gluster install on Gentoo Linux

話說,某日z1x長輩丟來訊息:


剛好最近也需要類似的東西,所以就來測看看。
目前我是用 Gentoo Linux 來測試,安裝設定上應該算簡單的。
kernel: linux-2.6.28-gentoo-r5
Step1.
因為 Gluster 是 over 在 FUSE,而目前 FUSE 已經進 linux official kernel 了,所以只需要重編一下 kernel,就可以了。
# 編好 kernel 後,重新 reboot.
Step2.
kernel support 後,還需安裝一些 API 來操作。
$ emerge -uD sys-fs/fuse
Step3.
下載 GlusterFS 最新 source code. 並且安裝它。我目前用的是 glusterfs-2.0.1
$ ./configure
$ make
$ make install
$ ldconfig
Step4.
設定,glusterfs 的設定選項很多,各位可以參考網站上面附的範例設定檔,我這邊貼一下我其中一組設定。
$ cat /etc/glusterfs/glusterfs-server.vol
=========================
GlusterFS Server configuration
=========================
volume posix
type storage/posix
option mandate-attribute no
option directory /hd1 # export dir
end-volume
volume locks
type features/posix-locks
subvolumes posix
end-volume
volume io-threads
type performance/io-threads
option thread-count 16
option autoscaling on
option min-threads 16
option max-threads 256
subvolumes locks
end-volume
volume write-behind
type performance/write-behind
subvolumes io-threads
end-volume
volume read-ahead
type performance/read-ahead
subvolumes write-behind
end-volume
volume server
type protocol/server
option transport-type tcp/server
option auth.addr.read-ahead.allow 127.0.0.1,140.110.x.*
subvolumes read-ahead
end-volume
$ cat /etc/glusterfs/distributed-replicated-client.vol
=========================
GlusterFS Client configuration
=========================
volume node24
type protocol/client
option transport-type tcp
option remote-host 140.110.x.24
option remote-subvolume read-ahead
end-volume
volume node25
type protocol/client
option transport-type tcp
option remote-host 140.110.x.25
option remote-subvolume read-ahead
end-volume
volume node26
type protocol/client
option transport-type tcp
option remote-host 140.110.x.26
option remote-subvolume read-ahead
end-volume
volume node27
type protocol/client
option transport-type tcp
option remote-host 140.110.x.27
option remote-subvolume read-ahead
end-volume
volume node28
type protocol/client
option transport-type tcp
option remote-host 140.110.x.28
option remote-subvolume read-ahead
end-volume
volume replicate1
type cluster/replicate
option data-self-heal on
option metadata-self-heal on
option entry-self-heal on
option data-change-log on
option metadata-change-log on
option entry-change-log on
subvolumes node25 node26
end-volume
volume replicate2
type cluster/replicate
option data-self-heal on
option metadata-self-heal on
option entry-self-heal on
option data-change-log on
option metadata-change-log on
option entry-change-log on
subvolumes node27 node28
end-volume
volume distribute
type cluster/distribute
subvolumes replicate1 replicate2
end-volume
volume io-threads
type performance/io-threads
option thread-count 16
option autoscaling on
option min-threads 16
option max-threads 256
subvolumes distribute
end-volume
volume write-behind
type performance/write-behind
subvolumes io-threads
end-volume
volume read-ahead
type performance/read-ahead
subvolumes write-behind
end-volume
Step5.
啟動 Storage Sever 服務。
$ glusterfsd -f /etc/glusterfs/glusterfs-server.vol --debug
Step6.
啟動 Storage 掛載。
$ glusterfs -f /etc/glusterfs/distributed-replicated-client.vol /mnt/glusterfs/
Step7.
檢查確認一下。
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p3 33G 2.1G 31G 7% /
udev 10M 40K 10M 1% /dev
shm 506M 0 506M 0% /dev/shm
/dev/cciss/c0d1p1 34G 280M 34G 1% /hd1
/etc/glusterfs/distributed-replicated-client.vol 68G 1.2G 67G 2% /mnt/glusterfs
說明:
目前空間
node25 提供 34G 空間
node26 提供 34G 空間
node27 提供 34G 空間
node28 提供 34G 空間
node25與node26跑replicate成group1
node27與node28跑replicate成group2
group1與group2跑distribute
總共約 68G 空間,每個 node 可看到掛載上來的空間都是 68G
參考:
關於安裝設定部份可參考 Installation GuideConfiguration

沒有留言:

張貼留言