`
sunzixun
  • 浏览: 74850 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

<cloud> 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
 

 

所以你可以把你的 配置文件工程在这里修改。。  好奇怪的设计。。。。 

 

 

 

 

以上仅限于服务端 , 客户端无所谓 不用我解释吧。。 

  • 大小: 101.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics