Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 3.14 KB

cli.md

File metadata and controls

61 lines (48 loc) · 3.14 KB

命令行参考

全部功能经单一二进制 thingboot 的子命令提供。 全局参数:-config <path> 指定配置文件(默认依次查找 ./configs/config.yaml、./config.yaml)。

运行

命令 说明
thingboot serve 生产模式:supervisor 拉起全部模块 + Web 管理界面(systemd/系统服务运行的就是它)
thingboot run all supervisor 拉起全部模块(无 Web 管理面),崩溃自动重启(退避 1s 起、封顶 30s)
thingboot run <module> 前台运行单个模块,用于调试/隔离

模块名(run <module> 与 Web 界面一致): router(消息路由中枢)、appgateway(APP/小程序接入)、pushgateway(控制台接入)、 openapi(开放平台接口)、webhook(HTTP 回调发送)、connwatch(上下线事件)、 monitor(broker+主机监控)、shadow(设备影子)、devconfig(配置下发)、 event(事件上报)、devapi(设备调平台 API)、ota(OTA 确认)、ntp(对时)、 topology(主从关系)、cachesync(缓存同步)、debug(消息调试转发)。

运维

命令 说明
thingboot doctor 一键体检:配置 → broker 连接认证/版本 → openbroker 连通 → Redis Ping → 平台 HTTP 可达 → 端口占用 → license,逐项 ✓/✗
thingboot logs [-n N] <module> 查看模块日志尾部 N 行(默认 50)
thingboot version 打印版本
thingboot service install|uninstall|start|stop|restart|status 注册/管理系统服务(Windows 需管理员,Linux 需 root;Linux 上推荐用 install.sh)

排障

命令 说明
thingboot broker setup 交互式配置 broker 地址/账号/密码,写回配置文件后自动测试
thingboot broker test 用当前配置实测 broker 连接/认证/版本/耗时,失败给排查建议
thingboot redis setup 交互式配置 Redis 地址/密码,写回配置文件后自动测试
thingboot redis test Ping + 临时 key 读写删往返实测
thingboot platform test GET 平台 URL,报告状态码与耗时
thingboot mqtt pub <topic> <payload> 以管理身份注入消息(模拟设备上行/手动下发)
thingboot mqtt sub <topic> 监听消息,Ctrl+C 退出

授权

命令 说明
thingboot license status 查看授权类型/客户/到期/设备上限/当前在线数/机器指纹
thingboot license install <file> 验签并导入授权文件

Web 管理 API

serve 模式下 http://<host>:8899。除登录外均需 Authorization: Bearer <token>:

POST /api/login                            登录({"password": "..."})获取 token
GET  /api/status                           总览:版本/license/连通性
GET  /api/services                         模块状态:state/pid/启动时间/重启次数
POST /api/services/{name}/{start|stop|restart}
GET  /api/services/{name}/logs?tail=200    模块日志
GET  /api/license                          license 详情
GET  /api/config                           生效配置(密钥脱敏)