运维命令速查
GC 命令
gc:expired_trash(清理过期回收站)
# 清理超过 retention_days 的回收站文件(真删,不可恢复)
php think gc:expired_trash
# 预览
php think gc:expired_trash --dry-run
# 限制数量 + 间隔
php think gc:expired_trash --limit=100 --sleep=50
| 配置项 | 默认值 | 说明 |
|---|---|---|
recycle.retention_days |
30 | 保留期(天),最大 365 |
gc:orphan_chunks(检测孤儿 chunk)
# advisory only(仅报告,不物理删)
php think gc:orphan_chunks
- Type A:
storage_chunks_position有映射但storage_chunks无索引 → 保留(可能是进行中上传) - Type B:
storage_chunks有索引但storage_chunks_position无映射 → 标记properties.__corrupted=true
gc:stale_cache(清理本地缓存)
# 清理 .temp 文件缓存(默认 7 天前)
php think gc:stale_cache
# 自定义天数
php think gc:stale_cache --days=1
自愈命令
selfheal:scan(副本数扫描)
php think selfheal:scan # 执行
php think selfheal:scan --dry-run # 预览
php think selfheal:scan --limit=1000 --sleep=100
输出:scanned=N enqueued=M skipped=K batches=B
selfheal:verify(内容校验)
php think selfheal:verify # 执行
php think selfheal:verify --dry-run # 预览
php think selfheal:verify --limit=500 --sleep=200
输出:scanned=N corrupted=M skipped=K
缓存命令
cache:evict(LRU 淘汰)
php think cache:evict # 执行
php think cache:evict --dry-run # 预览
php think cache:evict --max-size=0 # 清空所有
| 配置项 | 默认值 | 说明 |
|---|---|---|
cache.enabled |
0 | 读缓存开关 |
cache.max_size_gb |
10 | 最大缓存大小(GB) |
cache.lru_ttl |
86400 | 缓存 TTL(秒) |
Worker 命令
worker:run(启动 Worker)
php think worker:run --max-tasks=1000 --sleep=1000
生产环境用 supervisord 管理,不手动运行。
webhook:dispatch(Webhook 投递)
php think webhook:dispatch # 投递 pending 日志
php think webhook:dispatch --dry-run # 预览
php think webhook:dispatch --limit=50 # 限制数量
输出:processed: N, success: M, failed: K, dead: J
节点命令
node:register
php think node:register --internal-url=http://node2:8002 --internal-token=<密钥>
node:heartbeat
php think node:heartbeat
测速命令
position:benchmark
php think position:benchmark # 测全部
php think position:benchmark --position=1 # 测指定
推荐 Cron 配置
# crontab(容器内)
* * * * * php think webhook:dispatch
0 * * * * php think cache:evict
0 3 * * * php think gc:expired_trash
0 4 * * * php think gc:stale_cache
0 */6 * * * php think selfheal:scan
0 5 * * * php think selfheal:verify
* * * * * php think node:heartbeat
仪表盘
管理后台首页提供 5 个 ECharts 图表:
- 存储用量分布(按位置)
- 文件数量趋势
- 上传/下载速率
- Worker 任务处理量
- 流量趋势(近 7 天上传/下载)
Prometheus 指标端点:
GET /api/metrics(5 核心指标 + 60s 进程内缓存)
原文标题:运维命令速查
原文文档:uldisk
原文地址:/read/augushong/ul-disk/zh-cn/1.0.0/6a3e73c598601/6a3e73d8c49d9.html
原文平台:奥宏文档
1.0.0