<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Pg on Wilson Wu</title><link>https://wilsonwu.me/tags/pg/</link><description>Recent content in Pg on Wilson Wu</description><generator>Hugo -- 0.127.0</generator><language>zh-CN</language><lastBuildDate>Thu, 13 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://wilsonwu.me/tags/pg/index.xml" rel="self" type="application/rss+xml"/><item><title>OpenWebUI 数据库迁移实践：从 VM 自建 PostgreSQL 平滑迁移到 Azure 托管 PostgreSQL</title><link>https://wilsonwu.me/blog/2026/migrate-openwebui-to-azure-pg/</link><pubDate>Thu, 13 Aug 2026 00:00:00 +0000</pubDate><guid>https://wilsonwu.me/blog/2026/migrate-openwebui-to-azure-pg/</guid><description>随着 OpenWebUI 中的用户、对话、文件和知识库数据不断增长，原先部署在 Azure VM 上的自建 PostgreSQL 带来了越来越多的运维工作，包括数据库补丁、备份、故障恢复、存储监控和安全维护。
为了降低维护成本并提高数据库可靠性，我将 OpenWebUI 的业务数据库从 VM 本地 PostgreSQL 迁移到了 Azure Database for PostgreSQL Flexible Server。
这次迁移采用了：
在线全量迁移 + 数据一致性验证 + 活跃对话增量同步 + 快速切换
全量数据库导出和恢复期间，OpenWebUI 始终保持在线。最终切换仅涉及一次很短的 Docker 容器重建，用户侧基本无感。
本文中的服务器地址、数据库名称、用户名、密码和资源标识均已隐藏或替换为占位符。
迁移背景 OpenWebUI 以 Docker 容器形式运行在 Azure VM 中，最初使用安装在同一台 VM 上的 PostgreSQL。
迁移前的架构如下：
用户 │ ▼ Azure VM ├── OpenWebUI Docker 容器 │ └── 连接 VM 宿主机 PostgreSQL │ └── PostgreSQL └── 数据保存在 VM 本地磁盘 这种部署方式比较简单，但随着应用逐渐稳定运行，数据库维护也成为了新的负担。</description></item></channel></rss>