先在副本走完遷移與回復
這次把 2.5.53 教學 Lab 的 MariaDB 備份還原到全新的 Docker 專案,用 3.0_wip 固定提交 76dc5858bc2a0bb9fb9729de1b9ef6b16e14257d 執行官方遷移 CLI。另以同一份備份啟動一套 2.5.53,驗證回復後仍能登入、呼叫 API 和讀回樣本。
使用 Apple Silicon arm64、MariaDB 10.11.20 與 PHP CLI 8.4.28。3.0 僅驗證離線資料庫遷移與資料讀回;正式 Web 服務、Worker、附件、GPG 與整套環境的切換需各自驗收。
先建立回復點和查核基準
停止對演練資料寫入
先跑完
verify.py。在開始讀取備份前,結束會新增樣本的腳本與匯入工作。保護來源資料庫與設定
用
mariadb-dump --single-transaction產生獨立備份,保留相同版本的 Compose、.env與設定檔。這些檔案可能含金鑰,留在受保護的本機目錄。正式實例還要涵蓋附件、簽章與加密金鑰。記錄會比對的欄位
使用手冊的固定 Event UUID,記錄公開狀態、Distribution、六筆 Attribute(含 Object 內欄位)的型別、值、
to_ids,以及 Object UUID。
在隔離副本執行 3.0 遷移
把 2.5 備份匯入新的 MariaDB,固定目標 Git 提交及 CakePHP 子模組,安裝該提交的 Composer 相依套件。以目標版本的 bootstrap.default.php 和 core.default.php 建立 CLI 設定,再接到副本的 DB 和 Redis。演練停用目標的背景工作,只讓 3.0 CLI 連上資料庫。
Console/cake Admin schemaDiagnostics
Console/cake Admin runUpgrade
Console/cake Admin schemaDiagnostics
Console/cake AttributeValue verify實測一開始有 132 筆待處理遷移。執行後看到 Upgrade complete.,診斷為 Pending: 0 和 Failed: 0。獨立驗證檢查值字典的七筆值及其雜湊。
比較升級前後的資料
3.0 將值移入 attribute_values,使用 value1_id、value2_id 取用。遷移移除舊文字欄位後,不能只靠 AttributeValue verify 認定內容與舊版相同。
把升級後查回的值和從同一份備份還原的 2.5 資料逐筆比對。這次固定 Event 的公開狀態、Distribution、六筆 Attribute 的 UUID、型別、值、to_ids,以及一個 Object 的 UUID 都一致。
另開 2.5 環境驗證回復
保留 3.0 副本供對照,將原始備份還原到第三個專案,再啟動固定版本 2.5.53。用登入檢查和 Auth key 查詢確認會話、平台版本、Event UUID、Attribute 值及 Object 還在。
正式回復時,應把同一回復點的資料庫、程式版本、設定、檔案與金鑰一起接回。官方指引也要求遷移後重啟 PHP,並驗收 Worker 與重新關聯的結果。
MISP database migration rehearsal · 2026-12-02 (Asia/Taipei)
Source: MISP 2.5.53 | MariaDB 10.11.20
Target: MISP 3.0_wip @ 76dc5858bc2a0bb9fb9729de1b9ef6b16e14257d | PHP 8.4.28
Evidence excerpts from isolated database and CLI projects
Before: Console/cake Admin schemaDiagnostics
# Database
db_version: 159
# Migrations
Applied: 10
Failed: 0
Deferred: 0
Pending: 132
Console/cake Admin runUpgrade
Upgrade complete.
After: Console/cake Admin schemaDiagnostics
# Database
db_version: 159
# Migrations
Applied: 142
Failed: 0
Deferred: 0
Pending: 0
Console/cake AttributeValue verify
attributes: no text columns left to check the ids against.
shadow_attributes: no text columns left to check the ids against.
dictionary: 7 rows, 0 not matching their hash, 0.0 s.
All rows verified.
Independent 2.5 restore and before/after comparison
PASS 2.5.53 web login, authenticated session and API read after SQL restore.
PASS 2.5 restore and 3.0 converted copy match for Event metadata, 6 Attribute UUIDs/types/to_ids/values, and 1 Object.
學習紀錄儲存在目前瀏覽器。
無法儲存,重新整理後可能會遺失這次的紀錄。