clawstu

OpenClaw 运维手册

OpenClaw 是一个开源的 AI 代理系统,提供完整的 API 网关、渠道管理和监控 Dashboard 功能。本手册将帮助你快速部署和管理 OpenClaw 系统。

一、系统概述

OpenClaw 系统由以下核心组件组成:

  • Gateway(网关):负责 API 请求的路由、鉴权和限流
  • Dashboard(监控面板):提供可视化的系统监控和管理界面
  • Channel(渠道):管理多个 AI 服务提供商的接入

二、快速开始

1. 环境要求

  • Linux / macOS / Windows
  • Go 1.21+(如需源码编译)
  • MySQL 8.0+ 或 PostgreSQL 14+
  • Redis 6.0+(可选,用于缓存)

2. 安装部署

使用二进制安装:

# 下载最新版本
wget https://github.com/clawstu/openclaw/releases/latest/download/openclaw-linux-amd64.tar.gz

# 解压
tar -xzf openclaw-linux-amd64.tar.gz
cd openclaw

# 安装
./install.sh

3. 启动服务

# 前台启动(调试用)
openclaw gateway --port 18789

# 后台守护进程启动
openclaw gateway --port 18789 --daemon

# 安装为系统服务
openclaw gateway install

三、配置说明

配置文件路径

  • 全局配置:/etc/openclaw/config.yaml
  • 用户配置:~/.openclaw/config.yaml
  • 项目配置:./config.yaml

核心配置项

# 服务器配置
server:
  port: 18789
  host: "0.0.0.0"

# 数据库配置
database:
  type: "mysql"  # 或 "postgresql"
  host: "localhost"
  port: 3306
  username: "openclaw"
  password: "your_password"
  name: "openclaw"

# 日志配置
log:
  level: "info"  # debug, info, warn, error
  file: "/var/log/openclaw/gateway.log"

四、渠道配置

OpenClaw 支持接入多个 AI 服务提供商,通过 Channel 模块进行管理。

支持的渠道类型

  • OpenAI / Azure OpenAI
  • Anthropic Claude
  • Google Gemini
  • 百度文心一言
  • 阿里通义千问
  • 智谱 AI

添加渠道

openclaw channel add --name "openai-prod" --type openai --key "sk-xxx"

五、监控与告警

Dashboard 提供以下监控功能:

  • 实时请求量统计
  • Token 消耗监控
  • 响应时间分析
  • 错误率告警
  • 渠道健康状态

六、常见问题

Q: 如何查看服务状态?

openclaw gateway status

Q: 如何重启服务?

openclaw gateway restart

Q: 如何查看日志?

tail -f /var/log/openclaw/gateway.log

七、相关资源