Blog.wlens.top
1414 字
7 分钟
OpenClaw 全栈运维手册:从安装到生产级监控的20+核心命令
📦 一、基础运维命令
1. 网关生命周期管理
# 安装为系统服务openclaw gateway install [--port <port>] [--runtime] [--token <token>] [--force] [--json]
# 启动/停止/重启网关服务openclaw gateway startopenclaw gateway stopopenclaw gateway restartopenclaw gateway run # 前台运行(临时)
# 卸载服务openclaw gateway uninstall2. 状态与健康检查
# 总体状态(含守护进程 + RPC 探测)openclaw statusopenclaw 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 eventopenclaw system heartbeat lastopenclaw system heartbeat enable|disable3. 诊断工具集
openclaw doctor # 基础诊断(推荐日常使用)openclaw security audit # 安全审计openclaw security audit --deep # 深度探针检查openclaw security audit --fix # 自动修复
openclaw plugins doctor # 插件加载错误报告📋 二、日志与监控
1. 日志查看
# 网关日志(支持实时跟踪)openclaw logs [--follow] # -f 等同于 followopenclaw gateway logs # 仅查看网关日志openclaw channels logs # 频道日志🔄 三、配置管理
1. 配置读写
# 交互式向导(推荐新手)openclaw configure # 启动 wizardopenclaw onboard # 完整 onboarding 流程
# 命令行方式设置openclaw config get <key> # 读取配置值openclaw config set --set "key=value" # 设置单个值openclaw config unset <key> # 删除配置项
# 导出/导入(部分支持)openclaw backup create # 创建备份openclaw backup verify # 验证备份2. Secrets 管理
openclaw secrets reload # 重新加载密钥引用openclaw secrets audit # 扫描明文残留/未解析引用openclaw secrets configure # 交互式设置 SecretRef 映射openclaw secrets apply --from <plan.json> [--dry-run] # 应用配置计划📡 四、频道(Channels)管理
# 频道状态与探测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. 模型配置
# 查看/设置默认模型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. 模型认证
openclaw models auth add <model> --token "<API_KEY>"openclaw models auth setup-token <model> # 交互式设置 Tokenopenclaw models auth paste-token <model> # 粘贴已有 tokenopenclaw models auth order get|set|clear # 管理认证优先级🧠 六、记忆与 ACP 系统
1. Memory(向量检索)
openclaw memory status # 显示索引统计openclaw memory index # 重新索引记忆文件openclaw memory search "<query>" # 语义搜索记忆库2. ACP(线程绑定代理状态)
openclaw acp status # 查看 ACP 运行状态📅 七、定时任务(Cron)管理
# 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)
# 插件发现与操作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)
openclaw security audit # 基础配置审计openclaw security audit --deep # 深度探针检查openclaw security audit --fix # 自动修复问题📱 十、节点与设备管理(Nodes & Devices)
Nodes
openclaw nodes list # 列出所有配对节点openclaw node run <id> # 启动特定节点openclaw node status <id> # 查看节点状态openclaw node install # 安装新节点服务openclaw node uninstall # 卸载节点服务Devices(iOS/Android)
openclaw devices list # 列出配对设备openclaw device status <id> # 查看设备状态🧪 十一、沙箱与调试工具
# Sandbox CLI(临时测试环境)openclaw sandbox list # 列出沙箱实例openclaw sandbox recreate # 重建沙箱openclaw sandbox explain # 解释运行状态
# TUI 界面交互模式openclaw tui # 启动图形化终端界面🌐 十二、远程访问(SSH/Bonjour)
SSH 穿透访问(Mac App 等效功能)
# 远程网关探测openclaw gateway probe --ssh <user@host> [--ssh-identity <path>]openclaw gateway probe --ssh-auto # 自动发现 LAN/WAB 中的网关Bonjour 服务发现
openclaw gateway discover # 扫描 _openclaw-gw._tcp 广播信标🧹 十三、系统维护命令
Reset & Cleanup
# 重置配置与状态openclaw reset # 清除工作空间/凭证(需 --dev)openclaw setup # 重新初始化配置 + 工作区Uninstall & Update
# 完全卸载openclaw uninstall # 移除所有组件
# 更新 CLIopenclaw 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 |
⚙️ 全局参数说明
--dev # 隔离状态到 ~/.openclaw-dev(开发环境)--profile <name> # 使用独立配置 profile--json # 机器可读 JSON 格式输出--no-color # 禁用 ANSI 颜色显示-V, --version # 查看版本号并退出以上就是 OpenClaw 的所有运维命令,涵盖了从安装、监控、诊断到维护的全生命周期管理。
OpenClaw 全栈运维手册:从安装到生产级监控的20+核心命令
https://blog.wlens.top/posts/openclaw-全栈运维手册从安装到生产级监控的20核心命令/