我正在玩GlusterFS。 现在我很好奇如何完全重build复制的卷。
所以我从server1和server2节点创build了1个复制卷:
root@server1:~# gluster volume create replicated replica 2 transport tcp server1:/mnt/repl1 server2:/mnt/repl2 force root@server1:~# gluster volume start replicated volume start: replicated: success
并将其安装到客户端节点:
root@client:~# mount.glusterfs server1:/distributed /mnt/distrib/
现在我正在尝试testing高可用性。 所以我已经closures了server1,并试图写smth到客户端的挂载点:
root@client:/mnt/replica# ls -lh total 106M -rw-r--r-- 1 root root 19 Jul 12 2015 1.txt -rw-r--r-- 1 root root 1.3K Jul 12 2015 2.txt -rw-r--r-- 1 root root 106M Jul 12 2015 testfile1
所以好吧。 所有文件也都在server2上:
root@server2:/mnt/repl2# ls -lh total 106M -rw-r--r-- 2 root root 19 Jul 12 03:52 1.txt -rw-r--r-- 2 root root 1.3K Jul 12 03:54 2.txt -rw-r--r-- 2 root root 106M Jul 12 03:53 testfile1 root@server2:/mnt/repl2#
毕竟我的服务器1上线,在那里我只能看到文件没有数据的骨架:
root@server1:/mnt/repl1# ls -lh total 4.0K -rw-r--r-- 2 root root 0 Jul 12 12:21 1.txt -rw-r--r-- 2 root root 0 Jul 12 03:54 2.txt -rw-r--r-- 2 root root 0 Jul 12 12:21 testfile1
只有在从客户端挂载点(使用cat或者像这样)访问文件之后,info才会进入server2文件:
root@client:/mnt/replica# cat 2.txt GlusterFS — blalabla.. root@server1:/mnt/repl1# ls -lh total 4.0K -rw-r--r-- 2 root root 0 Jul 12 12:21 1.txt -rw-r--r-- 2 root root 1.3K Jul 12 03:54 2.txt -rw-r--r-- 2 root root 0 Jul 12 12:21 testfile1 root@server1:/mnt/repl1#
是否有可能在以前失败的服务器上自动重build所有文件而不从客户端挂载点访问它们?
stat()来自客户机mountpoint的文件是Gluster如何知道这些文件需要重新复制,所以基本上你的问题的答案是“不”。
解决scheme虽然只是stat()每个文件 – 这实际上比听起来容易,只需从客户端运行:
find /mnt/repl1 -exec stat {} \;
这是在这里logging 。