在server01上,我已经安装并configuration了glusterfs-server和glusterfs-client来将目录/ var / appdata复制到server02。
看来任何东西都可以正常工作,但我不确定是否理解这个漏洞。
在server01上,glusterfs通过fstab挂载:
/etc/glusterfs/glusterfs.vol /var/gfs_appdata/ glusterfs defaults 0 0
在server01和server02上,glusterfs-server会在启动时自动启动,使用/etc/glusterfs/glusterfsd.vol:
volume posix1 type storage/posix option directory /var/appdata end-volume volume locks1 type features/locks subvolumes posix1 end-volume volume brick1 type performance/io-threads option thread-count 8 subvolumes locks1 end-volume volume server-tcp type protocol/server option transport-type tcp option auth.addr.brick1.allow * option transport.socket.listen-port 6996 option transport.socket.nodelay on subvolumes brick1 end-volume
/etc/glusterfs/glusterfs.vol:
# RAID 1 # TRANSPORT-TYPE tcp volume data01 type protocol/client option transport-type tcp option remote-host 192.168.0.1 option transport.socket.nodelay on option remote-port 6996 option remote-subvolume brick1 end-volume volume data02 type protocol/client option transport-type tcp option remote-host 192.168.0.2 option transport.socket.nodelay on option remote-port 6996 option remote-subvolume brick1 end-volume volume mirror-0 type cluster/replicate subvolumes data01 data02 end-volume volume readahead type performance/read-ahead option page-count 4 subvolumes mirror-0 end-volume volume iocache type performance/io-cache option cache-size `echo $(( $(grep 'MemTotal' /proc/meminfo | sed 's/[^0-9]//g') / 5120 ))`MB option cache-timeout 1 subvolumes readahead end-volume volume quickread type performance/quick-read option cache-timeout 1 option max-file-size 64kB subvolumes iocache end-volume volume writebehind type performance/write-behind option cache-size 4MB subvolumes quickread end-volume volume statprefetch type performance/stat-prefetch subvolumes writebehind end-volume
好吧,看起来这是实际的问题:
server01上生成的file01在什么时候出现在server02上,复制什么时候发生?
在server01上创build/更改/删除文件后立即开始复制。 完成复制需要多长时间取决于存储器I / O,networking带宽以及需要复制的数据量。
我使用glusterfs的方式,生活在gluster卷中的文件通常很小,因此复制一个新文件几乎是瞬间的。
更新:至于是否应该直接写入砖(/ var / appdata)或挂载(/ var / gfs_appdata),按照我理解的方式,应该始终使用mount来读写。 老实说,我不清楚这种情况的具体细节,一个(现在是前)的同事大约一年前用glusterfs进行了大量的testing,然后才开始使用它,而且我还没有认识到更好细节。
下面是一个类似的问题的答案,它给出了一些细节解释为什么应该这样做: Apache可以直接读取GlusterFS块,但写入GlusterFS挂载?