Skip to content

feat: Redis 自动故障转移 + MemoV MCP Server#1

Open
lunnynight wants to merge 7 commits intomainfrom
feat/redis-failover
Open

feat: Redis 自动故障转移 + MemoV MCP Server#1
lunnynight wants to merge 7 commits intomainfrom
feat/redis-failover

Conversation

@lunnynight
Copy link
Copy Markdown
Owner

概述

实现 Redis 自动故障转移机制,当硅谷主节点不可达时自动切换到 Mac 本地 Redis,恢复后自动切回。同时新增 MemoV MCP Server 提供记忆系统的工具化访问。

变更内容

Redis Failover(核心)

  • config/redis.ts v3 — 跨进程状态文件 /tmp/claw-redis-active-host

    • 优先级调整:状态文件 > 环境变量 > 默认值(硅谷主节点)
    • 新增 getActiveRedisHost(), switchToLocal(), switchToPrimary(), isFailoverActive()
    • 保留静态 REDIS_HOST 兼容旧代码
  • fsc/redis-failover.ts — Failover Monitor 守护进程

    • 每 10 秒 redis-cli PING 探测硅谷 Redis(3 秒超时)
    • 连续 3 次失败 → 启动本地 Redis + 切换
    • 连续 2 次成功 → 切回硅谷主节点
    • 本地 Redis 保持运行作为热备
  • fsc/memov-sync-daemon.ts — 动态 Redis 连接

    • 从静态 REDIS_HOST 改为动态 getActiveRedisHost()
    • 每 5 秒轮询状态文件,host 变化时自动重连
    • Git 操作增加 15 秒超时保护

MemoV MCP Server

  • mcp/memov/src/index.ts — stdio JSON-RPC 2.0 服务器
    • 6 个工具:list_sessions, read_session, search, timeline, read_file, write
    • 零外部依赖,直接读 .mem/ 目录 + Git 历史

运维

  • scripts/ensure-services.sh — 服务自启动脚本
    • 集成 fsc-monitor、fsc-core、redis-failover 三个服务
    • 健康检查 + 自动拉起

文档

  • CLAUDE.md — 补充服务配置、启动方式、健康检查、GitNexus 集成

测试验证

  • 状态文件写入/读取正确
  • 环境变量不再覆盖 failover 逻辑
  • memov-sync 检测 host 变更并自动重连(本地 ↔ 硅谷双向)
  • failover monitor 自动检测硅谷恢复并切回
  • TODO: 长时间运行稳定性测试
  • TODO: Windows 节点同步验证

lunnynight and others added 7 commits March 11, 2026 20:43
- Add 7 new Redis Stream event types (task_failed, heartbeat, memory_sync, etc.)
- Define three-node roles and task routing rules
- Document memory organization best practices
- Establish collaboration rules (one-card-one-node-one-branch)

Based on experience shared by 陈昭芊 from Harness Engineering project.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update node configuration (Mac/Windows/Silicon-Valley via Tailscale)
- Document shared memory system (.mem with xart git)
- Add node capabilities and task routing reference
- Update network architecture (Tailscale primary)
- Clarify memory sync mechanism

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Windows node deployment instructions
- Remove hardcoded IP addresses (reference config/nodes.ts)
- Remove Git credentials from documentation
- Add GPU configuration guidance
- Update architecture diagram with Windows node

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
## Windows Node Integration
- Deployed claw-mesh to Windows node (100.101.173.35)
- Configured MemoV sync daemon (Git-based, Windows compatible)
- Established SSH key authentication to Silicon Valley node
- End-to-end sync verified (Mac → Git central → Windows)

## Collaboration Framework (from 陈昭芊)
- Learned CICADA collaboration rules (one-card-one-node-one-branch)
- Integrated memory organization best practices (daily logs + curated memory)
- Adopted task scheduling mechanism (Redis priority queue)
- Extended Redis Stream events (8 → 15 types)

## Security Model
- Obtained complete security rules from 陈昭芊
- Integrated OpenClaw healthcheck skill
- Documented security boundaries and red lines
- Established three-node security collaboration protocol

## Documentation
- docs/SECURITY_MODEL.md - Complete security model
- docs/healthcheck-skill.md - OpenClaw security audit workflow
- docs/REDIS_EVENTS.md - Redis Stream event system
- docs/memov-cross-sync*.md - MemoV sync documentation

## Three-Node Configuration
- Mac (100.114.56.105): Development, architecture, coordination (Claude API)
- Windows (100.101.173.35): GPU tasks, heavy compute (Claude API + RTX 5070)
- Silicon Valley (100.80.67.125): Testing, automation, info collection (Doubao API)

## Tools Status (Silicon Valley Node)
- ✅ web_fetch (tested and working)
- ✅ memory_search, cron, browser, nodes (available)
- ✅ Redis (v7.0.15), Git (installed)
- ⚠️ web_search (needs Brave API key)
- ❌ Docker, GitHub CLI (not installed)

System ready for production collaboration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add OpenClaw MCP server configuration for Silicon Valley node
- Document freema/openclaw-mcp setup with Gateway URL and token
- Add Windows Claude Code MCP integration plan (steipete/claude-code-mcp)
- Include security considerations and troubleshooting guide
- Update DEPLOYMENT.md with node communication layer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Redis 自动故障转移:
- config/redis.ts v3: 跨进程状态文件 /tmp/claw-redis-active-host
  优先级: 状态文件 > 环境变量 > 默认值
- fsc/redis-failover.ts: 每 10s 探测硅谷 Redis,3 次失败切本地,2 次成功切回
- fsc/memov-sync-daemon.ts: 动态 Redis 连接,5s 轮询 host 变化自动重连
- scripts/ensure-services.sh: 集成 failover monitor 自动启动

MemoV MCP Server:
- mcp/memov/src/index.ts: stdio JSON-RPC 2.0,6 个工具
  (list_sessions, read_session, search, timeline, read_file, write)

其他:
- CLAUDE.md: 补充服务配置、启动方式、健康检查文档
- package.json: 添加 ioredis 依赖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant