Glusterfs 3.2

 

 

入門的就不提了,直接從入門之後的說起。。。

 

 

 

 

源碼安裝3.2   . 從3.0.8開始 glusterfs 這玩意本來文檔就少的可憐,到了3.2壓根就表明一點點。。

 

感覺gluster 不重視這快了,重點發展那個虛擬化平臺。。 想了解個所以然 只有通過看代碼。。。

 

3.2 中你會發現少了 scheduler 包括裏面的

 

alu random rr 等 loadbalance Translators 可惡的是  doc 裏面的 tanslator-options  壓根沒提

 

社區詢問得到回覆。。。

 

 

 

 
Are Booster removed from the glusterfs 3.1.0 ?

1 Answer •3 days agoUnfollow



Vijay Bellur
0 votes
Booster is not supported in all 3.x versions
1 Comment |3 days ago
 

 

但是做集羣的時候依依舊 分佈到各個bricks上。  這個後面代碼分析。

 

 

 

輸入 glusterd 會自動啓動並且根據配置信息恢復 服務器的vol peer等信息。

 

 

配置文件路徑 /etc/glusterd/

 

/etc/glusterd/vols : 這裏面放置了 gluster> volume create 的卷組信息。

 

比如建立了一個 名叫kko 的卷組,就可以在

 

/etc/glusterd/vols/kko 

 

下發現關於這個vols的信息。

 

 
drwxr-xr-x 4 root root 4096 2011-05-14 02:19 ./
drwxr-xr-x 3 root root 4096 2011-05-18 18:55 ../
-rw-r--r-- 1 root root 895 2011-05-13 04:37 kko.192.168.100.33.home-g1.vol
drwxr-xr-x 2 root root 4096 2011-05-13 04:37 bricks/
-rw-r--r-- 1 root root 15 2011-05-18 18:53 cksum
-rw-r--r-- 1 root root 174 2011-05-13 04:37 info
-rw-r--r-- 1 root root 895 2011-05-13 04:37 kko.192.168.100.54.home-g1.vol
-rw-r--r-- 1 root root 1043 2011-05-13 04:37 kko-fuse.vol
drwxr-xr-x 2 root root 4096 2011-05-18 18:53 run/
 

其中 kko.192.168.100.54.home-g1.vol 就是關於該bricks的 Translators信息。

 

我嘗試把 這個文件隱藏之後,發現卷組的  bricks丟失 ,只有在你對該掛載點操作的時候,會發現奇怪的問題。。

 

回覆該vol配置,需要重啓gluster 後,一切恢復

 

看一下 執行glusterd 會出現哪些進程

 

 

 
root@ubuntu:/etc/glusterd/vols/kko# ps -ef|grep glusterfsd
root 3579 1 6 19:14 ? 00:00:00 glusterd
root 3631 1 0 19:14 ? 00:00:00 /usr/local/sbin/glusterfsd --xlator-option kko-server.listen-port=24010 -s localhost --volfile-id kko.192.168.100.33.home-g1 -p /etc/glusterd/vols/kko/run/192.168.100.33-home-g1.pid -S /tmp/3e01b34f148d44fd35cc9726bef4c035.socket --brick-name /home/g1 --brick-port 24010 -l /usr/local/var/log/glusterfs/bricks/home-g1.log
root 3635 1 4 19:14 ? 00:00:00 /usr/local/sbin/glusterfs -f /etc/glusterd/nfs/nfs-server.vol -p /etc/glusterd/nfs/run/nfs.pid -l /usr/local/var/log/glusterfs/nfs.log
 

從這裏可以看到gluster的一些祕密:

 

他使用 -f 

/etc/glusterd/nfs/nfs-server.vol

 

來表示當前服務端的信息。 所以可以直接修改這個文件。

 

客戶端沒有發現這個文件,那是要自己寫麼 client的日誌文件可以看到

 

 

 

 寫道
root@ubuntu:/etc/glusterd/vols#
root 1962 1 0 18:57 ? 00:00:02 /usr/local/sbin/glusterfs --log-level=INFO --volfile-id=/kko --volfile-server=192.168.100.54 /mnt/szxm

這裏 沒有指定 log ,那麼就在默認的地方 

 

 

root@ubuntu:/usr/local/var/log/glusterfs

 

 
drwxr-xr-x 2 root root 4096 2011-05-17 22:00 ./
drwxr-xr-x 3 root root 4096 2011-05-16 01:27 ../
-rw-r--r-- 1 root root 14018 2011-05-17 02:33 bak_mnt-szxm.log
-rw-r--r-- 1 root root 0 2011-05-17 21:48 .cmd_log_history
-rw-r--r-- 1 root root 4554 2011-05-18 19:32 mnt-szxm.log
-rw-r--r-- 1 root root 534 2011-05-16 01:54 usr-local-etc-glusterfs-glusterfs.vol.log
 

這個用掛載點命令的文件

 

 寫道
[2011-05-18 19:32:00.904344] I [fuse-bridge.c:3218:fuse_thread_proc] 0-fuse: unmounting /mnt/szxm
[2011-05-18 19:32:17.808040] W [write-behind.c:3023:init] 0-kko-write-behind: disabling write-behind for first 0 bytes
[2011-05-18 19:32:17.837283] I [client.c:1935:notify] 0-kko-client-0: parent translators are ready, attempting connect on transport
[2011-05-18 19:32:17.837939] I [client.c:1935:notify] 0-kko-client-1: parent translators are ready, attempting connect on transport
Given volfile:
+------------------------------------------------------------------------------+
1: volume kko-client-0
2: type protocol/client
3: option remote-host 192.168.100.33
4: option remote-subvolume /home/g1
5: option transport-type tcp
6: end-volume
7:
8: volume kko-client-1
9: type protocol/client
10: option remote-host 192.168.100.54
11: option remote-subvolume /home/g1
12: option transport-type tcp
13: end-volume
14:
15: volume kko-dht
16: type cluster/distribute
17: subvolumes kko-client-0 kko-client-1
18: end-volume
19:
20: volume kko-write-behind
21: type performance/write-behind
22: subvolumes kko-dht
23: end-volume
24:
25: volume kko-read-ahead
26: type performance/read-ahead
27: subvolumes kko-write-behind
28: end-volume
29:
30: volume kko-io-cache
31: type performance/io-cache
32: subvolumes kko-read-ahead
33: end-volume
34:
35: volume kko-quick-read
36: type performance/quick-read
37: subvolumes kko-io-cache
38: end-volume
39:
40: volume kko-stat-prefetch
41: type performance/stat-prefetch
42: subvolumes kko-quick-read
43: end-volume
44:
45: volume kko
46: type debug/io-stats
47: option latency-measurement off
48: option count-fop-hits off
49: subvolumes kko-stat-prefetch
50: end-volume

+------------------------------------------------------------------------------+
 

 

原來從服務端那邊獲得了。。。

 

把 其中的 volume 信息複製出來,保存在 一個 client.vol 文件中

然後執行

 

glusterfs -f /etc/glusterd/client.vol /mnt/szxm

 

 

Everything is fine !~

 

 

 

 

發現peer啓動之後 ,不能自動感知, 如果你手動修改了 vols信息, 該volume 就會出現問題

 

 

 

下面是解析配置文件的步驟

 

會產生一個線程 ,用於監聽信號 如nginx 那樣

 

 

[New Thread 0xb4c1bb70 (LWP 8767)]

[New Thread 0xb5ef6b70 (LWP 8766)]

[New Thread 0xb6943b70 (LWP 8765)]

 

glusterfs_sigwaiter

 

 

glusterfs_volumes_init

 

 

 

#0  parse_opts (key=16777219, arg=0x0, state=0xbffff0b4) at glusterfsd.c:455

#1  0xb7eb4532 in ?? () from /lib/libc.so.6

#2  0xb7eb4d67 in argp_parse () from /lib/libc.so.6

#3  0x0804cdb1 in parse_cmdline (argc=1, argv=0xbffff7f4, ctx=0x8074008) at glusterfsd.c:1033

#4  0x0804d38b in main (argc=1, argv=0xbffff7f4) at glusterfsd.c:1454

 

 

glusterfs_volumes_init()

 

gf_log_volume_file()

 

 

 fp = get_volfp (ctx);

 

glusterfs_process_volfp()

 

preprocess()/*這裏會對配置文件做一些統計處理*/

 


這裏可以看到 gluster 其實先讀取了 

 

 

/usr/local/etc/glusterfs

文件中的工作目錄,然後在進行上面提到的操作

 

 
root@ubuntu:/usr/local/etc/glusterfs# cat glusterd.vol
volume management
type mgmt/glusterd
option working-directory /etc/glusterd
option transport-type socket,rdma
option transport.socket.keepalive-time 10
option transport.socket.keepalive-interval 2
end-volume
 

 

所以你可以把你的 配置文件工程在這裏修改。。  好奇怪的設計。。。。 

 

 

 

 

以上僅限於服務端 , 客戶端無所謂 不用我解釋吧。。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章