HA stage 2: DB-shared rate limiting + second server unit + monitor both-servers check (#52)

Co-authored-by: host <host@test.local>
This commit is contained in:
openqjandhost authored and GitHub committed 2026-10-27 00:15:16 +08:00
1 parent fc8e337d0f
commit 06b9fd12fd
4 files changed
+170 -19

No files matched your search

+6 -2
View File
@@ -6,7 +6,8 @@
# sh /opt/codex-app-server/deploy/monitor.sh --self-test
#
# 检查项(全部不需要密码、不读 env 文件):
# server:systemctl is-active codex-cloud-server 为 active
# server:systemctl is-active codex-cloud-server 与
# codex-cloud-server-2 均为 active(HA 阶段 2 双机)
# worker:codex-autoscaler 或 codex-cloud-worker 任一为 active
# (autoscaler 接管后静态 worker 故意停用,只查静态会误报:
# 2026-10-26 07:02:55 静态 worker 停用后每 5 分钟 worker fail,
@@ -41,7 +42,10 @@ DISK_PATH=${MONITOR_DISK_PATH:-/var/lib/codex-app-server}
if [ ! -d "$DISK_PATH" ]; then DISK_PATH="/"; fi
check_server() {
if systemctl is-active codex-cloud-server >/dev/null 2>&1; then
# HA 阶段 2:两台 server 都必须 active,任一挂了都算 fail
# (单台 active 时 API 还能用,但冗余已丢,必须可见)。
if systemctl is-active codex-cloud-server >/dev/null 2>&1 \
&& systemctl is-active codex-cloud-server-2 >/dev/null 2>&1; then
echo pass
else
echo fail