按产线规范将 FOMS 单体拆分为 4 部分: 【foms 核心(保留在本仓库)】主备切换本身 表:clusters、nodes、switchover_logs、node_commands(新增) 功能:集群/节点 CRUD、Agent 心跳、故障切换/切回、仪表盘、远程命令 远程命令改用专用 node_commands 表(原借用 node_logs 的 MVP 方案,顺手修 P1 隐患) 仪表盘跨模块只读聚合(同库松耦合 SQL) 【dbbackup 模块(独立仓库)】数据库全量备份 + 日志同步(binlog复制)管理 表 dbbackup_replications(原 sync_databases)/jobs(备份任务)/records(备份记录) 新建备份执行/记录/清理逻辑 【filesync 模块(独立仓库)】运行文件同步(rsync) 表 filesync_directories(原 sync_directories) 【hostwatch 模块(独立仓库)】日志监控+日志分析+主机指标 表 hostwatch_logs(原 node_logs)/metrics(原 node_metrics)/rules/events 新建日志归类、规则匹配告警、聚合分析逻辑 设计(松耦合方案 A): · 拆出模块表加模块名前缀,cluster_id/node_id 仅存字符串不建外键 · 拆出模块不 import foms 核心代码,可独立部署测试 · 单 Agent 多端点:心跳→foms、指标日志→hostwatch、复制→dbbackup、rsync→filesync · 模块 wwwroot 软链到主 wwwroot/<模块名>(URL 前缀隔离) Agent 端点拆分:report_health 拆为 report_db_health/report_dir_health, metrics 上报改 /hostwatch/api/,_api_post/_api_get 支持完整路径。
28 lines
1.2 KiB
JSON
28 lines
1.2 KiB
JSON
{
|
|
"summary": [
|
|
{
|
|
"name": "node_commands",
|
|
"title": "节点远程命令",
|
|
"primary": ["id"],
|
|
"catelog": "entity"
|
|
}
|
|
],
|
|
"fields": [
|
|
{"name": "id", "title": "命令ID", "type": "str", "length": 32, "nullable": "no"},
|
|
{"name": "node_id", "title": "节点ID", "type": "str", "length": 32, "nullable": "no"},
|
|
{"name": "command", "title": "命令内容", "type": "text", "nullable": "no"},
|
|
{"name": "status", "title": "状态", "type": "str", "length": 16, "nullable": "no", "default": "pending"},
|
|
{"name": "exit_code", "title": "退出码", "type": "int"},
|
|
{"name": "output", "title": "执行输出", "type": "text"},
|
|
{"name": "created_at", "title": "下发时间", "type": "datetime", "nullable": "no"},
|
|
{"name": "executed_at", "title": "执行时间", "type": "datetime"}
|
|
],
|
|
"indexes": [
|
|
{"name": "idx_ncmd_node", "idxtype": "index", "idxfields": ["node_id"]},
|
|
{"name": "idx_ncmd_status", "idxtype": "index", "idxfields": ["status"]}
|
|
],
|
|
"codes": [
|
|
{"field": "status", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='cmd_status'"}
|
|
]
|
|
}
|