附录 B —— Spring Boot 配置速查
属性入口为 dsm.*,绑定类是
DsmProperties。默认值用于本地起步,不是生产推荐值;部署前需要结合网络、安全、容量和故障域复核。
顶层身份
| 属性 | 作用 | 门禁 |
|---|---|---|
dsm.cluster-id |
集群身份 | 必填;空值启动失败 |
dsm.service-id |
服务家族/通信隔离 | 与 peer 保持一致;不承担租户 ID 的职责 |
dsm.node.id |
节点身份 | 默认随机 UUID;稳定诊断场景建议显式配置 |
dsm.node.host / port |
广告地址 | 需要可被目标网络中的 peer 访问 |
Membership
| 属性组 | 关键项 | 说明 |
|---|---|---|
dsm.cluster.mode |
STANDALONE / MULTICAST /
UNICAST |
决定 membership 实现 |
dsm.cluster.multicast.* |
group、port、heartbeat、failure threshold | 受网络 multicast 能力约束 |
dsm.cluster.unicast.* |
gossip port/interval、seeds/DNS、failure threshold | seed 只是发现入口,不是永久 leader |
高风险 Lease 决策还要检查 quorum 与 stability rounds;节点数量本身不足以支持所有权判断。
Runtime 与 Sync
dsm.runtime.* 管理生命周期/线程等 Runtime
行为,dsm.sync.* 管理传播、repair、batch/QoS
等同步参数。修改 timeout、queue、batch 或 repair
周期时,同时更新容量实验和故障演练,不能只改 YAML。
Security
| 属性面 | 要回答的问题 |
|---|---|
| token/challenge | 谁能加入通信域 |
| authentication/key version | 谁签名,接受的最低版本是什么 |
| encryption | 接收方是否强制密文,使用什么算法/key version |
| nonce window/senders | 重放窗口与 sender 内存上限 |
| rate limit/ban | 连续失败如何限流与恢复 |
secret 应来自部署密钥系统,不进入书稿、日志、metric tag 或仓库配置。
Collections
每个 dsm.collections[] 至少需要:
- bean-name: routeHintsCollection
tenant-id: shared
application-id: gateway
collection-id: route-hints
schema-id: route-hints/v1
type: REGISTER
consistency-tier: REGISTER
entity-type: com.example.RouteHint| 类型 | 额外要求 |
|---|---|
| Register | record 可派生 codec;非 record 需要 codec-bean |
| Lease | entity factory、Lease mode/TTL/quorum 配置 |
| CRDT | update codec、state codec、initial state 与 merger bean |
规范 bean 名为
dsmCollection:<tenant>/<application>/<collection>;bean-name
是额外业务别名。重复 locator、缺 codec/merger/factory 或非法范围会 fail
fast。
验证入口
cd submodule/dsm
mvn -q -pl dsm-spring-boot-autoconfigure -am \
-Dtest=DsmAutoConfigurationTest,DsmSpringBootSmokeTest \
-Dsurefire.failIfNoSpecifiedTests=false test