跳到內容
主控台

12/12 TREM Lite 檢知重複觸發說明

嚴重程度:中狀態:已結案
發生時間
2025/12/12 04:24:28 (UTC+8)
觸發條件
地震後
問題描述
TREM Lite 出現檢知重複觸發的問題
根本原因
upstream 資料不一致污染 cache,導致系統異常

2025/12/12 04:24:28(臺灣時間)地震之後,TREM Lite 的檢知重複觸發。我們向當時看到重複檢知的 TREM Lite 使用者道歉。經觀察後,這次的故障應該已經排除。

Balance Server 上的 Nginx 當時把兩台 upstream 放在一起,並用一致性雜湊分配請求:

終端機視窗
upstream core_servers {
server tnn.exptech.dev:80;
server tpe.exptech.dev:80;
hash $remote_addr consistent;
}

tnn.exptech.dev 和 tpe.exptech.dev 的資料不一致。hash $remote_addr consistent 仍可能把請求分到不同的 upstream。請求落到不同 upstream 時,不一致的資料寫進 cache,後面的請求讀到這份 cache,TREM Lite 的檢知就重複觸發。

之前:一致性雜湊,兩台資料不一致之後:主備Balance Server 的 Nginxhash $remote_addr consistent請求可能落到不同的 upstreamtnn.exptech.devtpe.exptech.devcache寫進不一致的資料TREM-Lite 檢知重複觸發後面的請求讀到這份 cacheNginx移除一致性雜湊tnn.exptech.dev主伺服器max_fails=1fail_timeout=10stpe.exptech.devbackup主伺服器不可用時才用主伺服器正常時主伺服器不可用時

改善前,Balance Server 的 Nginx 把 tnn.exptech.dev 與 tpe.exptech.dev 兩台 upstream 放在一起,用 hash $remote_addr consistent 分配請求,請求仍可能落到不同的 upstream。兩台的資料不一致,不一致的資料寫進 cache,後面的請求讀到這份 cache,TREM-Lite 的檢知就重複觸發。改善後改成主備,並移除一致性雜湊:tnn.exptech.dev 是主伺服器(max_fails=1、fail_timeout=10s),主伺服器正常時請求都走這台;tpe.exptech.dev 設為 backup,只在主伺服器不可用時使用。

改善前後的 upstream

Nginx 的 upstream 改成主備。主伺服器不可用時才走備援:

終端機視窗
upstream core_servers {
server tnn.exptech.dev:80 max_fails=1 fail_timeout=10s;
server tpe.exptech.dev:80 backup;
}
  1. tnn.exptech.dev 設為主伺服器,max_fails=1(最多 1 次失敗),fail_timeout=10s(故障後 10 秒內不再連這台)。

  2. tpe.exptech.dev 設為 backup,只在主伺服器不可用時使用。

  3. 移除一致性雜湊。主伺服器正常時,請求都走 tnn.exptech.dev。