12-04 更新 实时
首页/ 技术栈/ 正文

sqlite3_rsync:SQLite 远程复制工具

技术栈 来源:Simon Willison 2026-11-26 14:08 2 阅读 机器翻译

2026年11月26日 - 链接博客

sqlite3_rsync:SQLite 的数据库远程复制工具。这个额外的 SQLite 工具已经出现一段时间了——它在 2024 年 10 月作为“实验性”功能被加入 SQLite 3.47.0,并在 2025 年 5 月的 SQLite 3.50.0 中得到增强。直到今天,我才理解它最具吸引力的特性之一。

通常,如果你想获取 SQLite 数据库的快照副本,需要使用 backup API 或 VACUUM INTO。无论哪种情况,你都需要足够的磁盘空间来创建数据库的副本,因此如果你在一个小型实例上,并且已经使用了可用磁盘空间的一半以上,那就完全没辙了。

sqlite3_rsync 可以通过 SSH 连接将数据库快照复制到另一台机器,而无需先在本地创建完整副本!

它也适合同步数据库的现有副本,而无需通过网络重新传输整个数据库。它的工作方式与常规 rsync 类似:

该协议的核心思想是,副本端将页面或页面组的密码学哈希发送给源端。源端返回有差异的页面内容,或者如果多页哈希不匹配,则请求更细粒度的哈希。如果源端和副本端一开始差异极大,由于交换哈希的开销,总网络带宽可能会超过整个数据库的大小,但超出带宽并不大——最多几个百分点。

更新:哈哈!原来我在 2024 年 10 月该工具首次发布时,就写过 sqlite_rsync 的这种用法。

发布于 2026 年 11 月 26 日上午 6:08

Ladybird 的首个 alpha 版本发布——2026 年 11 月 23 日

这是 Simon Willison 发布的链接帖,发布于 2026 年 11 月 26 日。

每月赞助我 10 美元,即可收到当月最重要 LLM 进展的精选邮件摘要。

付钱给我,让我少给你发点!

译文由英文原文机器翻译,术语按行业惯例统一,可在文末展开原文核对。

查看英文原文(sqlite3_rsync: Database Remote-Copy Tool For SQLite)

26th November 2026 - Link Blog

sqlite3_rsync: Database Remote-Copy Tool For SQLite. This additional SQLite tool has been around for a while now - it was added as "experimental" in SQLite 3.47.0 in October 2024 and enhanced in SQLite 3.50.0 in May 2025. It was only today that I understood one of its most attractive characteristics.

Normally, if you want to grab a snapshot copy of a SQLite database, you need to use either the backup API or VACUUM INTO. In both cases you need enough disk space to create a duplicate copy of your database, so if you're on a small instance and you already use more than half of the available disk you are plain out of luck.

sqlite3_rsync can copy a snapshot of your database over an SSH connection to another machine, without first needing to create a full local copy!

It's also good for synchronizing an existing copy of a database without re-transmitting the entire thing over the network. It works in a similar way to regular rsync:

The core idea behind the protocol is that the replica sends cryptographic hashes for pages or groups of pages over to the origin side. The origin sends back page content that differs, or requests finer-grain hashes if a multi-page hash does not match. If the origin and replica start out being vastly different, the total network bandwidth can exceed the size of the entire database, due to the overhead of exchanging hashes, but the excess bandwidth is not great - a few percent at most.

Update: Hah! Turns out I wrote about this application of sqlite_rsync back in October 2024 when the tool was first released.

Posted 26th November 2026 at 6:08 am

Ladybird's first alpha release - 23rd November 2026

This is a link post by Simon Willison, posted on 26th November 2026.

Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.

Pay me to send you less!

原文为英文,正文由自动抓取并保留原文。

本文由采集器自动同步

原文发布于 Simon Willison(sqlite3_rsync: Database Remote-Copy Tool For SQLite),标题、摘要与正文由机器翻译,术语按行业惯例统一,未经人工逐句校订。

阅读原文 ↗