【问题标题】:How do I synchronize my gluster replicated volumes?如何同步我的 gluster 复制卷?
【发布时间】:2022-10-24 14:30:25
【问题描述】:

我想为 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 中比较相同的文件 compare on windows

【问题讨论】:

    标签: sqlite glusterfs


    【解决方案1】:

    我的 sqlite db 设置为 WAL 模式 所以 wal 文件正在更新,.db 文件没有立即同步。 我使用以下命令取消了 WAL 模式,并确认它已立即同步。

    PRAGMA journal_mode=DELETE;
    

    根据 Sqlite 文档,它不适用于网络文件系统 https://sqlite.org/wal.html

    所有使用数据库的进程必须在同一台主机上; WAL 不能在网络文件系统上工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 2013-10-18
      相关资源
      最近更新 更多