Add UUID/FK channel checks, agent whitelist/push APIs, bindings, super-admin LWW audit with rollback, reconcile rate limits, and sync docs. Default customers stay opt-in; company conflict UI is removed. Co-authored-by: Cursor <cursoragent@cursor.com>
1.9 KiB
1.9 KiB
数据同步 · 开通说明(管理员)
依据:
松离线-dbsync方案-最终版.md
默认客户无感:未显式开通时,终端保存与自增表行为与现网一致。
三分模式(客户端配置,智建通道为表白名单源)
| 模式 | 含义 | 谁改 |
|---|---|---|
local_only |
仅本地,无同步 | 默认之一 |
online_primary |
HTTP 双写 / 离线 pending(旧路径) | 已配线上 API 且未写 MODE 时兼容升 |
local_dbsync |
松离线 + 表白名单 + 本机 agent | 仅显式配置,禁止自动升 |
智建控制台「数据同步」配的是通道 + 表白名单 + 线上 DSN;是否走 local_dbsync 由客户端环境变量决定,平台不会替全员切默认。
开通步骤(增值)
- 公司管理员在「数据同步」建通道:
local(本机 B 描述)+remote(线上 A DSN),表白名单须 UUID TEXT PK + FK 闭包。 - 默认方向 本地 → 线上,冲突策略 源端覆盖(lww_source)。
- 客户端显式设
YXD_SYNC_MODE=local_dbsync,并配置通道 ID / token(见同步表约定.md)。 - 装本机 sync agent 后变更才会上云;未装 agent:本地可保存,文案须为「需 agent 才上云」。
- Binding(可选):登记
local_database_id → online_db_id,见 API/api/v1/admin/sync/bindings。
谁能看什么
| 角色 | 可见 |
|---|---|
| 公司管理员 | 通道配置、对账(同步修复)、统计;无冲突台 / LWW 覆盖明细 |
| 平台超级管理员 | LWW 覆盖审计(平台工作台) |
| 未开通终端用户 | 零同步文案,无强制状态条 |
相关文档
- 同步表约定.md
- 数据同步-迁移手册.md(旧客从 HTTP 双写迁入)
- 数据同步-中间件.md