跳到主要内容

代理端配置

代理端模块的配置在代理端的 plugins/CloudSync-Bungee/config.yml,改完重启代理端。用法见用代理端模块安全转服。

storage:
mysql:
host: "localhost"
port: 3306
database: "cloudsync"
username: "root"
password: "change_me"
pool-size: 4
connection-timeout-ms: 5000
keepalive-time-ms: 120000
table-prefix: "auto"

transfer:
timeout-seconds: 30

load-balancing:
enabled: true
max-players: 100
minimum-tps: 18.0
maximum-memory-percent: 90.0
heartbeat-timeout-seconds: 10
refresh-interval-millis: 1000
weights:
priority: 100.0
players: 2.0
tps-penalty: 25.0
memory-penalty: 1.0
groups:
lobby: [lobby-1, lobby-2]
survival: [survival-1, survival-2]
priority:
- lobby-1
- lobby-2
- survival-1
- survival-2

storage 和分流端填同一个数据库与同一个前缀。

transfer.timeout-seconds 是 /csp send 等来源分流存档的上限,最少 10 秒。

挑选分流​

groups 的每个名字同时要是分流端的 server.id 和代理端里那台服务器的名字。/csp send survival 只会在 survival 列出的分流里挑。

先排除不合格的:超过 heartbeat-timeout-seconds 没心跳、人数达到 max-players(或那台服务器本身的人数上限)、TPS 低于 minimum-tps、内存使用率高于 maximum-memory-percent。

剩下的算分数,分数低的优先:在 priority 里排第几 × weights.priority,加上人数 × weights.players,加上(20 − TPS)× weights.tps-penalty,加上内存百分比 × weights.memory-penalty。默认的权重让 priority 的顺序最重要,同顺位时人少的优先。不在 priority 里的分流排在最后。

load-balancing.enabled: false 时 /csp send 一律回答没有可用的分流。refresh-interval-millis 是多久从数据库读一次心跳(最少 250)。

讯息​

messages:
no-server: '&c目前没有健康且可用的分流。'
connecting: '&e正在将你安全传送至 {server}。'
transfer-pending: '&c你已经有一笔转服正在处理中。'
server-unavailable: '&c来源或目的分流目前无法使用。'
prepare-failed: '&c无法准备转服,请稍后再试。'
connect-failed: '&c你的数据已安全保存,但连接到目的分流失败,请重新连接。'
save-failed: '&c转服前存档失败,为保护数据已中断连接,请重新连接。'
timeout: '&c转服超时,你仍留在原分流。'

{server} 是被选中的分流 ID。

0:000:00