Chuyển tới nội dung chính

Lưu trữ SQLite

Libre WebUI lưu chat, message, user, cài đặt, document, chunk, persona, credentials plugin, memory và metadata trong một cơ sở dữ liệu SQLite local.

Vị trí

Thứ tự:

  1. DATA_DIR nếu đặt; path tương đối được resolve từ directory backend.
  2. Nếu không, backend/data.

Để tương thích, backend/backend/data được dùng nếu đó là storage durable duy nhất. Nếu state có ở cả hai nơi, startup yêu cầu chọn rõ và không merge/copy.

Launcher npm/Homebrew mặc định dùng ~/.libre-webui. Docker/Kubernetes đặt path tuyệt đối. File tên data.sqlite.

DATA_DIR=/var/lib/libre-webui

SQLite lưu gì

User/role, session/message, UI preference, document/chunk, persona/memory/mutation, credentials plugin và routing/auth binding, variable, activation, approval, model catalog, setting; cùng ownership Work, route, run, message, tool activity, status và ID Docker. Giá trị nhạy cảm được mã hóa ở application layer.

Work tách riêng

Conversation/metadata Work ở SQLite; file ở volume Docker có tên riêng tại /workspace. Container thay thế được, volume durable.

Backup database không có volume là chưa đủ. Backup volume có label ai.libre-webui.managed=true và task ID. Xóa task xóa record và volume vĩnh viễn; cancel run, stop preview hoặc restart backend không xóa file.

Tương thích JSON

Cài đặt cũ lưu một phần data trong JSON; SQLite nay là đường chính. Backup toàn directory trước upgrade. Activation .status.json migrate một lần chỉ cho built-in chính xác; definition custom/shadow bị quarantine đến khi import lại; account mới bắt đầu không plugin active.

Backup

Dừng backend:

cp -R backend/data backend/data.backup
cp -R "$DATA_DIR" "$DATA_DIR.backup"

Backup cả mọi volume Work được quản lý; database, key và volume phải cùng thời điểm.

Khôi phục

Dừng backend, thay directory rồi start với ENCRYPTION_KEY cũ. Restore volume Work bằng exact name trước startup. Libre có thể recreate container, không tạo lại file mất.

Ghi chú vận hành

SQLite dùng WAL. Directory phải writable và DATA_DIR Docker/Kubernetes phải persistent. Backup ENCRYPTION_KEY và volume Work.

Tài liệu liên quan