0

I am playing with GlusterFS. And now I am curious how to fully rebuild replicated volume.

So I`ve created 1 replicated volume from server1 and server2 nodes:

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

And mounted it to client node:

root@client:~# mount.glusterfs server1:/distributed /mnt/distrib/

Now I am trying to test high-availability. So I`ve turned off server1 and trying to write smth to client mount-point:

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

So ok so far. All files are also on 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# 

After all my server1 goes online and there I can see only skeleton of files w/o data in it:

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

Only after accessing to files from client mount-point (with cat or like this) info is pulling into server2 files:

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# 

Is it possible to rebuild all files automatically on previously failed server w/o accessing to them from client mount point?

1 Answer 1

1

stat()-ing the files from the client mountpoint is how Gluster knows that the files need to be re-replicated, so basically the answer to your question is "no".

The solution though is just to stat() every file - which is actually easier than it sounds, just run this from a client:

find /mnt/repl1 -exec stat {} \;

This is documented here.

3
  • And if in the same time server2 goes offline - I can loose all data, because server1 still doesn't have replicated data (for example data was not stated before). Are my thoughts correct?
    – ipeacocks
    Jul 12, 2015 at 16:05
  • 1
    Yes, if the only server holding your data goes down, you'll lose access to it. If you need more redundancy, add more servers. Jul 12, 2015 at 17:37
  • stat()-ing is not helping me. Only with cat files on repl node again with data.
    – ipeacocks
    Jul 12, 2015 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .