1414 字
7 分钟
OpenClaw 全栈运维手册:从安装到生产级监控的20+核心命令
2026-03-09

📦 一、基础运维命令#

1. 网关生命周期管理#

Terminal window
# 安装为系统服务
openclaw gateway install [--port <port>] [--runtime] [--token <token>] [--force] [--json]
# 启动/停止/重启网关服务
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway run # 前台运行(临时)
# 卸载服务
openclaw gateway uninstall

2. 状态与健康检查#

Terminal window
# 总体状态(含守护进程 + RPC 探测)
openclaw status
openclaw status --all # 查看所有组件状态
openclaw status --deep # 深度扫描所有服务
openclaw status --usage # 查看使用统计
# 网关专用健康命令
openclaw gateway health [--url ws://127.0.0.1:18789]
openclaw gateway probe [--json] # 调试模式探测
openclaw gateway probe --ssh <user@gateway-host> # SSH 远程探测
# 系统事件与心跳
openclaw system event
openclaw system heartbeat last
openclaw system heartbeat enable|disable

3. 诊断工具集#

Terminal window
openclaw doctor # 基础诊断(推荐日常使用)
openclaw security audit # 安全审计
openclaw security audit --deep # 深度探针检查
openclaw security audit --fix # 自动修复
openclaw plugins doctor # 插件加载错误报告

📋 二、日志与监控#

1. 日志查看#

Terminal window
# 网关日志(支持实时跟踪)
openclaw logs [--follow] # -f 等同于 follow
openclaw gateway logs # 仅查看网关日志
openclaw channels logs # 频道日志

🔄 三、配置管理#

1. 配置读写#

Terminal window
# 交互式向导(推荐新手)
openclaw configure # 启动 wizard
openclaw onboard # 完整 onboarding 流程
# 命令行方式设置
openclaw config get <key> # 读取配置值
openclaw config set --set "key=value" # 设置单个值
openclaw config unset <key> # 删除配置项
# 导出/导入(部分支持)
openclaw backup create # 创建备份
openclaw backup verify # 验证备份

2. Secrets 管理#

Terminal window
openclaw secrets reload # 重新加载密钥引用
openclaw secrets audit # 扫描明文残留/未解析引用
openclaw secrets configure # 交互式设置 SecretRef 映射
openclaw secrets apply --from <plan.json> [--dry-run] # 应用配置计划

📡 四、频道(Channels)管理#

Terminal window
# 频道状态与探测
openclaw channels status # 基础状态
openclaw channels status --probe # 带健康探针检查
openclaw channels logs # 查看频道日志
# 频道配对/登录
openclaw channels list # 列出已配对的频道
openclaw channels add # 添加新频道(向导模式)
openclaw channels login # WhatsApp QR 配对登录
openclaw channels logout # 登出当前频道
# 移除频道
openclaw channels remove <channel-name>

🤖 五、模型与 AI 管理#

1. 模型配置#

Terminal window
# 查看/设置默认模型
openclaw models list # 列出可用模型
openclaw models status # 检查认证状态
openclaw models set <model-name> # 设置默认模型
openclaw models scan # 扫描可用模型
# 图像模型回退链配置
openclaw models aliases list|add|remove # 别名管理
openclaw models fallbacks list|add|remove|clear # 降级策略

2. 模型认证#

Terminal window
openclaw models auth add <model> --token "<API_KEY>"
openclaw models auth setup-token <model> # 交互式设置 Token
openclaw models auth paste-token <model> # 粘贴已有 token
openclaw models auth order get|set|clear # 管理认证优先级

🧠 六、记忆与 ACP 系统#

1. Memory(向量检索)#

Terminal window
openclaw memory status # 显示索引统计
openclaw memory index # 重新索引记忆文件
openclaw memory search "<query>" # 语义搜索记忆库

2. ACP(线程绑定代理状态)#

Terminal window
openclaw acp status # 查看 ACP 运行状态

📅 七、定时任务(Cron)管理#

Terminal window
# Cron 调度器命令
openclaw cron list # 列出所有定时任务
openclaw cron status # 查看任务执行状态
openclaw cron add <command> --schedule "*/5 * * * *" # 添加任务
openclaw cron edit <id> # 编辑任务配置
openclaw cron rm <id> # 删除任务
openclaw cron enable|disable # 启用/禁用任务

🔌 八、插件管理(Plugins)#

Terminal window
# 插件发现与操作
openclaw plugins list --json # 列出所有插件
openclaw plugins info <id> # 查看插件详情
openclaw plugins install <path|tgz|npm-spec> # 安装插件
openclaw plugins enable <id> | disable <id> # 启用/禁用
# 诊断与更新
openclaw plugins doctor # 报告加载错误

🔐 九、安全审计(Security)#

Terminal window
openclaw security audit # 基础配置审计
openclaw security audit --deep # 深度探针检查
openclaw security audit --fix # 自动修复问题

📱 十、节点与设备管理(Nodes & Devices)#

Nodes#

Terminal window
openclaw nodes list # 列出所有配对节点
openclaw node run <id> # 启动特定节点
openclaw node status <id> # 查看节点状态
openclaw node install # 安装新节点服务
openclaw node uninstall # 卸载节点服务

Devices(iOS/Android)#

Terminal window
openclaw devices list # 列出配对设备
openclaw device status <id> # 查看设备状态

🧪 十一、沙箱与调试工具#

Terminal window
# Sandbox CLI(临时测试环境)
openclaw sandbox list # 列出沙箱实例
openclaw sandbox recreate # 重建沙箱
openclaw sandbox explain # 解释运行状态
# TUI 界面交互模式
openclaw tui # 启动图形化终端界面

🌐 十二、远程访问(SSH/Bonjour)#

SSH 穿透访问(Mac App 等效功能)#

Terminal window
# 远程网关探测
openclaw gateway probe --ssh <user@host> [--ssh-identity <path>]
openclaw gateway probe --ssh-auto # 自动发现 LAN/WAB 中的网关

Bonjour 服务发现#

Terminal window
openclaw gateway discover # 扫描 _openclaw-gw._tcp 广播信标

🧹 十三、系统维护命令#

Reset & Cleanup#

Terminal window
# 重置配置与状态
openclaw reset # 清除工作空间/凭证(需 --dev)
openclaw setup # 重新初始化配置 + 工作区

Uninstall & Update#

Terminal window
# 完全卸载
openclaw uninstall # 移除所有组件
# 更新 CLI
openclaw update # 更新到最新版本(仅源安装)

🎯 十四、运维常用组合命令速查表#

任务推荐命令
日常健康检查openclaw doctor && openclaw status --all
查看实时日志openclaw logs --follow -f
重启网关服务openclaw gateway restart
完整状态诊断openclaw status --deep
安全加固检查openclaw security audit --fix
频道连接探测openclaw channels status --probe
查看记忆库使用openclaw memory status

⚙️ 全局参数说明#

Terminal window
--dev # 隔离状态到 ~/.openclaw-dev(开发环境)
--profile <name> # 使用独立配置 profile
--json # 机器可读 JSON 格式输出
--no-color # 禁用 ANSI 颜色显示
-V, --version # 查看版本号并退出

以上就是 OpenClaw 的所有运维命令,涵盖了从安装、监控、诊断到维护的全生命周期管理。

OpenClaw 全栈运维手册:从安装到生产级监控的20+核心命令
https://blog.wlens.top/posts/openclaw-全栈运维手册从安装到生产级监控的20核心命令/
作者
Lao Wang
发布于
2026-03-09
许可协议
CC BY-NC-SA 4.0