KV 备份和迁移脚本 #266
outlook84
started this conversation in
Show and tell
KV 备份和迁移脚本
#266
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
昨天折腾了一下把服务迁移到其它 cf 账户,workers 很简单,重新 fork 一个库绑定就行。
R2 迁移也简单,cf 网页管理面板就提供了迁移工具,给源账户有添加读取 r2 桶权限的 api token,然后目标账户那边设置源是 s3 兼容就行。也可以用 rclone 备份/迁移。
KV 就比较麻烦,cf 网页管理面板没有提供导入导出功能,得使用
wrangler命令行工具。我把折腾过程写了一篇博文,提供脚本一次把键值对和 metadata 都提取出来:
https://revolt.ovh/posts/2025-07-27/cloudflare-kv/
实测,可以完整的迁移,包括上传和登陆口令以及图片的 metadata。
没有迁移需求,定期备份一下也可以防不测。
Beta Was this translation helpful? Give feedback.
All reactions