OpenClawSkills
GitHub
Gateway / 运用 • TutorialHeader.readTime

复数 Gateway

Run multiple OpenClaw Gateways on one host (isolation, ports, and profiles)

大多数设置应该使用一个网关,因为单个网关可以处理多个消息连接和代理。如果您需要更强的隔离或冗余(例如,救援机器人),请运行具有隔离配置文件/端口的单独网关。

Tutorial.step

分钟離检查列表(必须)

- ''OPENCLAW_CONFIG_PATH'' — 实示例每个设置文件

- ''OPENCLAW_STATE_DIR'' — per-instance sessions, creds, caches

- ''agents.defaults.workspace'' — per-instance workspace root

- ''gateway.port'' (或 ''--port'') — 实示例每个唯一

- Derived ports (browser/canvas) must not overlap

这些但分钟享如果已被、设置的冲突和端口的冲突但発生执行。

Tutorial.step

Recommended: profiles (`--profile`)

Profiles auto-scope ''OPENCLAW_STATE_DIR'' + ''OPENCLAW_CONFIG_PATH'' and suffix service names.

Bash
openclaw --profile main setup
openclaw --profile main gateway --port 18789


openclaw --profile rescue setup
openclaw --profile rescue gateway --port 19001

Per-profile services:

Bash
openclaw --profile main gateway install
openclaw --profile rescue gateway install
Tutorial.step

Rescue-bot guide

同自主机在独自的也的持次 2 番目的网关运行执行:

- profile/config

- 状態目录

- 工作区

- base port (plus derived ports)

这可以将救援机器人与主机器人隔离,以便在主机器人宕机时可以调试或应用配置更改。

Port spacing: leave at least 20 ports between base ports so the derived browser/canvas/CDP ports never collide.

#

Tutorial.step

How to install (rescue bot)

Bash
openclaw onboard
openclaw gateway install


openclaw --profile rescue onboard





openclaw --profile rescue gateway install
Tutorial.step

Port mapping (derived)

基础端口 = ''gateway.port''(或 ''OPENCLAW_GATEWAY_PORT'' / ''--port'')。

- browser control service port = base + 2 (loopback only)

- ''canvasHost.port = base + 4''

- Browser profile CDP ports auto-allocate from ''browser.controlPort + 9 .. + 108''

如果您在配置或环境变量中覆盖其中任何一项,则必须确保每个实例的唯一性。

Tutorial.step

Browser/CDP notes (common footgun)

- Do ''not'' pin ''browser.cdpUrl'' to the same values on multiple instances.

- 每个实示例是、独自的浏览器控制端口和 CDP 範囲(网关端口从派生)需要。

- 明示的那 CDP 端口需要那場合是、每个实示例在 ''browser.profiles.''.cdpPort'' 设置执行。

- Remote Chrome: use ''browser.profiles.''.cdpUrl'' (per profile, per instance).

Tutorial.step

手动环境变量的示示例

Bash
OPENCLAW_CONFIG_PATH=~/.openclaw/main.json \
OPENCLAW_STATE_DIR=~/.openclaw-main \
openclaw gateway --port 18789

OPENCLAW_CONFIG_PATH=~/.openclaw/rescue.json \
OPENCLAW_STATE_DIR=~/.openclaw-rescue \
openclaw gateway --port 19001
Tutorial.step

Quick checks

Bash
openclaw --profile main status
openclaw --profile rescue status
openclaw --profile rescue browser status