docs/gateway/multiple-gateways.md
Most setups should use one Gateway because a single Gateway can handle multiple messaging connections and agents. If you need stronger isolation or redundancy (e.g., a rescue bot), run separate Gateways with isolated profiles/ports.
For most users, the simplest rescue-bot setup is:
--profile rescue19789This keeps the rescue bot isolated from the main bot so it can debug or apply config changes if the primary bot is down. Leave at least 20 ports between base ports so the derived browser/canvas/CDP ports never collide.
Use this as the default path unless you have a strong reason to do something else:
# Rescue bot (separate Telegram bot, separate profile, port 19789)
openclaw --profile rescue onboard
openclaw --profile rescue gateway install --port 19789
If your main bot is already running, that is usually all you need.
During openclaw --profile rescue onboard:
rescue profileIf onboarding already installed the rescue service for you, the final
gateway install is not needed.
The rescue bot stays independent because it has its own:
For most setups, use a completely separate Telegram bot for the rescue profile:
--profile rescue onboard Changesopenclaw --profile rescue onboard uses the normal onboarding flow, but it
writes everything into a separate profile.
In practice, that means the rescue bot gets its own:
~/.openclaw/workspace-rescue)The prompts are otherwise the same as normal onboarding.
The rescue-bot layout above is the easiest default, but the same isolation pattern works for any pair or group of Gateways on one host.
For a more general setup, give each extra Gateway its own named profile and its own base port:
# main (default profile)
openclaw setup
openclaw gateway --port 18789
# extra gateway
openclaw --profile ops setup
openclaw --profile ops gateway --port 19789
If you want both Gateways to use named profiles, that also works:
openclaw --profile main setup
openclaw --profile main gateway --port 18789
openclaw --profile ops setup
openclaw --profile ops gateway --port 19789
Services follow the same pattern:
openclaw gateway install
openclaw --profile ops gateway install --port 19789
Use the rescue-bot quickstart when you want a fallback operator lane. Use the general profile pattern when you want multiple long-lived Gateways for different channels, tenants, workspaces, or operational roles.
Keep these unique per Gateway instance:
OPENCLAW_CONFIG_PATH — per-instance config fileOPENCLAW_STATE_DIR — per-instance sessions, creds, cachesagents.defaults.workspace — per-instance workspace rootgateway.port (or --port) — unique per instanceIf these are shared, you will hit config races and port conflicts.
Base port = gateway.port (or OPENCLAW_GATEWAY_PORT / --port).
gateway.port)browser.controlPort + 9 .. + 108If you override any of these in config or env, you must keep them unique per instance.
browser.cdpUrl to the same values on multiple instances.browser.profiles.<name>.cdpPort per instance.browser.profiles.<name>.cdpUrl (per profile, per instance).OPENCLAW_CONFIG_PATH=~/.openclaw/main.json \
OPENCLAW_STATE_DIR=~/.openclaw \
openclaw gateway --port 18789
OPENCLAW_CONFIG_PATH=~/.openclaw/rescue.json \
OPENCLAW_STATE_DIR=~/.openclaw-rescue \
openclaw gateway --port 19789
openclaw gateway status --deep
openclaw --profile rescue gateway status --deep
openclaw --profile rescue gateway probe
openclaw status
openclaw --profile rescue status
openclaw --profile rescue browser status
Interpretation:
gateway status --deep helps catch stale launchd/systemd/schtasks services from older installs.gateway probe warning text such as multiple reachable gateways detected is expected only when you intentionally run more than one isolated gateway.