我想為 sqlite db 存盤使用 gluster 復制卷但是,當 '.db' 檔案更新時,LINUX 不會檢測到更改,因此磚塊之間的同步是不可能的。
有沒有辦法強制同步?即使您使用 gluster volume repair 命令,它也不會同步。
<我的 Gluster 卷狀態>
[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%20Guide/Split%20brain%20and%20ways%20to%20deal%20with%20it/.
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
<問題案例>
[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
但是,如果我在 Windows 中比較相同的檔案,請在 Windows 上進行比較
uj5u.com熱心網友回復:
我的 sqlite db 設定為 WAL 模式所以 wal 檔案正在更新并且 .db 檔案沒有立即同步。我使用以下命令取消了 WAL 模式,并確認它已立即同步。
PRAGMA journal_mode=DELETE;
根據 Sqlite 檔案,它不適用于網路檔案系統 https://sqlite.org/wal.html
所有使用資料庫的行程必須在同一臺主機上;WAL 不能在網路檔案系統上作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/519848.html
