多机 OpenClaw 互联完整方案

1 台主网关 + N 台工作节点,飞书插件只跑在主节点,任务自动分发到所有机器。


一、主节点(Gateway)配置

1. 一键写入配置

bash

运行

复制代码
mkdir -p ~/.openclaw/workspaces
cat > ~/.openclaw/openclaw.json << 'EOF'
{
  "gateway": {
    "port": 18789,
    "bind": "0.0.0.0",
    "controlUi": {
      "enabled": true,
      "allowedOrigins": ["*"]
    },
    "remote": {
      "enabled": true,
      "token": "openclaw-cluster-2026"
    },
    "cluster": {
      "enabled": true,
      "loadBalance": true
    }
  },
  "channels": {
    "feishu": {
      "enabled": true,
      "connectionMode": "websocket",
      "appId": "cli_你的飞书APPID",
      "appSecret": "你的飞书APPSECRET"
    }
  },
  "agents": {
    "defaults": {
      "workspace": "~/.openclaw/workspaces"
    },
    "list": [
      {
        "id": "main",
        "name": "调度中心",
        "model": "gpt-4o-mini"
      }
    ]
  },
  "tools": {
    "agentToAgent": {
      "enabled": true
    }
  }
}
EOF

2. 启动主网关

bash

运行

复制代码
openclaw gateway restart

3. 查看主节点 IP(给其他机器用)

bash

运行

复制代码
hostname -I | awk '{print $1}'

二、所有其他机器(Worker Node)一键加入集群

每台要互联的电脑 / 服务器执行:

bash

运行

复制代码
# 替换为你主节点的IP
MASTER_IP="192.168.1.100"
TOKEN="openclaw-cluster-2026"

cat > ~/.openclaw/openclaw.json << EOF
{
  "gateway": {
    "remote": {
      "url": "ws://$MASTER_IP:18789",
      "token": "$TOKEN"
    }
  },
  "agents": {
    "defaults": {
      "workspace": "~/.openclaw/workspaces"
    },
    "list": [
      {
        "id": "worker",
        "name": "工作节点",
        "model": "gpt-4o-mini"
      }
    ]
  }
}
EOF

# 加入集群
openclaw node join --gateway ws://$MASTER_IP:18789 --token $TOKEN

# 启动节点
openclaw node start

三、验证互联是否成功

在主节点执行:

bash

运行

复制代码
openclaw node list

能看到所有机器 = 互联成功。


四、飞书消息如何在多机之间流转

  1. 飞书消息 → 主节点 WebSocket 接收
  2. 主节点 Gateway → 自动分发给最空闲的工作节点
  3. 工作节点执行 AI / 工具 / 代码 → 结果返回主节点
  4. 主节点通过飞书插件回复用户

优点:

  • 飞书连接只在主节点,稳定不重复
  • 多机算力自动叠加
  • 某台机器挂了不影响整体服务

五、常用集群命令

bash

运行

复制代码
# 查看所有节点
openclaw node list

# 查看节点状态
openclaw node status

# 给所有节点发任务
openclaw sessions send --session-key agent:worker:default "你好"

# 实时日志
openclaw logs --follow

# 重启整个集群
openclaw gateway restart
相关推荐
自动驾驶之心1 小时前
ResWorld:端到端自动驾驶的时序残差世界模型(北航&中关村实验室)
人工智能·机器学习·自动驾驶
墨染天姬1 小时前
【AI】Hermes Agent 提示词优化与闭环机制
人工智能
蓝田~2 小时前
大模型本地部署与远程调用 — 从 API 到 Agent
java·人工智能·claude·claude code
猿的天空2 小时前
AI视觉原生统一!商汤开源视觉任务大统一模型SenseNova-Vision
人工智能·计算机·ai·程序员·大模型·编程·智能体
EAIReport2 小时前
2026开源AI应用平台深度对比:Dify vs AIFlowy 企业落地选型指南
人工智能·开源
神奇小汤圆2 小时前
Loop Engineering 实战:/goal 命令让 AI 自己写完整项目
人工智能
Anova.YJ2 小时前
AI Notebook
人工智能·python·机器学习
秦先生在广东2 小时前
Agent Island:把 Claude Code / Codex 的会话状态塞进刘海儿屏
人工智能
像我这样帅的人丶你还2 小时前
🚀大文件上传的那些事
前端·javascript·架构
阿里云大数据AI技术2 小时前
EMR Serverless Daft 如何简化多模态数据处理:视频抽帧、清洗、标注全流程与具身智能实践
人工智能·spark