备份
为 Paper 服务器提供增量世界备份。仅复制世界中实际发生更改的部分。
问题所在
大多数备份插件会按固定间隔将整个世界文件夹压缩打包。对于小型生存服来说这没问题,但对于一个 50 GB 的世界,这意味着每晚都要写入 50 GB 的数据——其中绝大部分与昨晚的副本逐字节相同——同时还会与服务器争夺磁盘 I/O。备份成了导致服务器卡顿的元凶,于是人们选择关闭备份,直到某天真正需要时却为时已晚。
工作原理
基于内容的存储。 每个文件都以其内容 SHA-256 哈希值作为存储标识。两个相同的区域文件(无论是在不同快照中,还是在不同世界里)只存储一份并共享。
真正的增量备份。 每次运行时,如果文件的文件大小和修改时间与上一快照匹配,则保留其现有哈希值且不会被读取。未更改的世界只需遍历目录,而非完整复制。仅写入发生变化的部分。
恢复过程经过验证。 每个文件在写回之前都会进行哈希校验。损坏的备份会报错失败,而不是悄悄给你一个损坏的世界;/backup verify 会在你真正需要恢复的那一天之前,检查快照是否可完全恢复。
不占用主线程。 自动保存在主线程上暂停并将每个世界刷入磁盘——这部分短暂且不可避免——然后所有的目录遍历、哈希计算和复制操作都在后台进行。无论备份成功还是失败,自动保存最终都会被重新开启。
捕获正在写入的文件时会重试。 如果在读取过程中服务器重写了一个区域文件,该文件会被重新捕获,而不是存储半写入状态。一个看起来完好无损但实际损坏的区域文件是最糟糕的结果,因此对此类情况会进行特殊处理。
命令
| 命令 |
功能说明 |
/backup now |
备份所有配置好的世界 |
/backup list [world] |
显示快照列表,最新者排在前面 |
/backup verify <snapshot> |
对快照中的每个文件重新计算哈希并报告任何损坏 |
/backup restore <snapshot> |
将快照重建到独立文件夹中 |
/backup status |
查看是否有备份正在运行,以及存在多少个快照 |
权限:backup.admin(默认为 op)。
恢复
恢复操作永远不会触碰你的在线世界。 它会将快照重建到 plugins/Backup/restored/<snapshot>/ 目录下即停止。你需要手动停止服务器并替换文件夹。
这是有意为之。如果在原位覆盖式恢复中途失败,你将既失去旧世界也失去备份。
配置
# 备份间隔,单位为分钟。设置为 0 表示仅通过 /backup now 进行备份。
interval-minutes: 120
# 在服务器启动一分钟后立即执行一次备份,而不是等待完整的间隔时间。
run-on-startup: false
# 要包含的世界列表。留空则备份所有已加载的世界。
worlds: []
依赖要求
本版本不包含的功能
在此列出而非事后发现:
- 无自动清理。 旧快照会一直保留直到你手动删除它们,因此存储空间会随时间增长。
- 无异地上传。 备份写入服务器自身的磁盘。磁盘故障会导致备份一同丢失——请将其复制到其他位置。
- 无单文件或单区块恢复。 恢复仅限整个世界。
- 未经 Folia 测试。
存储结构
快照是纯文本清单,列出每个文件的哈希值、大小、时间戳和路径,旁边是与哈希值同名的二进制数据块。没有任何专有容器格式。即使此插件停止维护,你的备份仍然是磁盘上的普通文件,可以手动恢复。
Backup
Incremental world backups for Paper servers. Only the parts of your world that actually changed get copied.
The problem
Most backup plugins zip the whole world folder on a schedule. On a small survival world that's fine. On a 50 GB world it means writing 50 GB every single night — most of it byte-for-byte identical to last night's copy — while competing with the server for disk I/O. Backups become the thing that makes your server stutter, so people turn them off, and then one day they need one.
How this one works
Content-addressed storage. Every file is stored under the SHA-256 of its contents. Two identical region files — in different snapshots, or in different worlds — are stored once and shared.
Genuinely incremental. On each run, a file whose size and modification time match the previous snapshot keeps its existing hash and is never read. An unchanged world costs a directory walk, not a full copy. Only what changed gets written.
Restores are verified. Every file is hash-checked before it is written back. A damaged backup fails loudly instead of quietly handing you a broken world, and /backup verify checks a snapshot is fully restorable before the day you need it.
Stays off the main thread. Auto-save is paused and each world flushed to disk on the main thread — that part is brief and unavoidable — and then all the walking, hashing and copying happens in the background. Auto-save is always turned back on, including when a backup fails.
Files caught mid-write are retried. If the server rewrites a region file while it is being read, the file is captured again rather than stored half-written. A corrupt region file that looks like a perfectly good backup is the worst possible outcome, so it is treated as one.
Commands
| Command |
What it does |
/backup now |
Back up every configured world |
/backup list [world] |
Show snapshots, newest first |
/backup verify <snapshot> |
Re-hash every file in a snapshot and report any damage |
/backup restore <snapshot> |
Rebuild a snapshot into its own folder |
/backup status |
Whether a backup is running, and how many snapshots exist |
Permission: backup.admin (defaults to op).
Restoring
A restore never touches your live world. It rebuilds the snapshot into plugins/Backup/restored/<snapshot>/ and stops there. You then stop the server and swap the folder in yourself.
That is deliberate. A restore that overwrites in place and fails halfway leaves you with neither your old world nor your backup.
Configuration
# How often to back up, in minutes. Set to 0 to only ever back up via /backup now.
interval-minutes: 120
# Take a backup a minute after startup instead of waiting a full interval.
run-on-startup: false
# Which worlds to include. Leave empty to back up every loaded world.
worlds: []
Requirements
- Paper 26.2 or newer
- Java 25
Not in this version
Listed here rather than discovered later:
- No automatic pruning. Old snapshots are kept until you delete them, so the store grows over time.
- No off-site upload. Backups are written to your server's own disk. A disk failure takes the backups with it — copy them somewhere else.
- No single-file or single-chunk restore. Restore is whole-world only.
- Not tested against Folia.
Storage layout
Snapshots are plain text manifests listing a hash, size, timestamp and path per file, next to a store of hash-named blobs. Nothing is in a proprietary container. If this plugin ever stops being maintained, your backups are still ordinary files on disk that you can recover by hand.
评论 0
登录后参与评分
还没有评论,来抢沙发吧