Home > Software engineering >  How do I synchronize my gluster replicated volumes?
How do I synchronize my gluster replicated volumes?

Time:10-25

I want to use a gluster replication volume for sqlite db storage However, when the '.db' file is updated, LINUX does not detect the change, so synchronization between bricks is not possible.

Is there a way to force sync? It is not synchronized even if you use the gluster volume heal command.

< My Gluster volume status >

[root@be-k8s-worker-1 common]#  gluster volume create sync_test replica 2 transport tcp 10.XX.XX.X1:/home/common/sync_test  10.XX.XX.X2:/home/common/sync_test
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: http://docs.gluster.org/en/latest/Administrator Guide/Split brain and ways to deal with it/.
Do you still want to continue?
 (y/n) y
volume create: sync_test: success: please start the volume to access data
[root@be-k8s-worker-1 common]# gluster volume start sync_test
volume start: sync_test: success
[root@be-k8s-worker-1 sync_test]# gluster volume status sync_test
Status of volume: sync_test
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick 10.XX.XX.X1:/home/common/sync_test    49155     0          Y       1142
Brick 10.XX.XX.X2:/home/common/sync_test    49155     0          Y       2134
Self-heal Daemon on localhost               N/A       N/A        Y       2612
Self-heal Daemon on 10.XX.XX.X1             N/A       N/A        Y       4257

Task Status of Volume sync_test
------------------------------------------------------------------------------
There are no active volume tasks

< Problem Case >

[root@be-k8s-worker-1 sync_test]# ls -al ## client 1
total 20
drwxrwxrwx. 4 root  root           122 Oct 17 10:51 .
drwx------. 8 sbyun domain users  4096 Oct 17 10:50 ..
-rw-r--r--. 1 root  root             0 Oct 17 10:35 test
-rwxr--r--. 1 sbyun domain users 16384 Oct 17 10:52 test.d
[root@be-k8s-worker-1 sync_test2]# ls -al ## client2
total 20
drwxrwxrwx. 4 root  root           122 Oct 17 10:51 .
drwx------. 8 sbyun domain users  4096 Oct 17 10:50 ..
-rw-r--r--. 1 root  root             0 Oct 17 10:35 test
-rwxr--r--. 1 sbyun domain users 16384 Oct 17 10:52 test.db
## diff -> No result
[root@be-k8s-worker-1 user]# diff sync_test/test.db sync_test2/test.db

But if I compare same file in windows compare on windows

CodePudding user response:

My sqlite db was set to WAL mode So the wal file was being updated and the .db file was not immediately synced. I canceled WAL Mode with the command below and confirmed that it was synced immediately.

PRAGMA journal_mode=DELETE;

According to Sqlite document, It doesn't work over a network file system https://sqlite.org/wal.html

All processes using a database must be on the same host computer; WAL does not work over a network filesystem.

  • Related