120 lines
5.7 KiB
Markdown
120 lines
5.7 KiB
Markdown
# rpctl
|
||
|
||
`rpctl` 是五款 RP 本地控制 CLI,用于在实验服务器本地独立启动、停止和观察单个 RP/profile 的 all5 实验。一个实验可包含一次 snapshot 和多次复用 state 的子 run。
|
||
|
||
## 部署
|
||
|
||
```bash
|
||
mkdir -p /data/rpki_4rp_ctl
|
||
rsync -a rpki_2/rpki/scripts/rpctl/ root@47.251.127.231:/data/rpki_4rp_ctl/
|
||
rsync -a artifacts/rpki-prover/rpki-prover-6857d4bf-linux-amd64.docker.tar.gz root@47.251.127.231:/data/
|
||
ssh root@47.251.127.231 'cd /data/rpki_4rp_ctl && ./rpctl init \
|
||
--bundle /data/rpki_4rp_ctl_runtime_bundle \
|
||
--rpki-prover-image /data/rpki-prover-6857d4bf-linux-amd64.docker.tar.gz'
|
||
```
|
||
|
||
`--bundle` 目录需要包含 #100 runtime bundle 的 `bin/`、`lib/`、`fixtures/`、`scripts/` 和 `versions.json`。不要使用早期 precheck 目录作为标准 bundle,因为它可能缺少 FORT 运行所需动态库。
|
||
|
||
`--rpki-prover-image` 是可选项;不配置时原有四款 RP 仍可运行,但启动 rpki-prover 会明确报错。配置后 `init` 会复制并加载离线镜像,校验宿主机和镜像均为 `amd64`,确认 tag 为 `rpki-prover:6857d4bf`、版本为 `rpki-prover-0.10.1`,并将 image ID 与 archive SHA-256 写入 `config.json`。运行时不会在线拉取镜像。
|
||
|
||
## ours RP 默认同步并发
|
||
|
||
`ours` 和 `ours-no-cache` 两个 profile 都会显式传入 `--parallel-max-repo-sync-workers-global 8`,即默认使用 8 个全局仓库同步 worker。此设置只作用于 ours RP;Routinator、rpki-client 与 FORT 的运行参数保持不变。`show` 与 `view --command` 会在参数摘要中显示 `sync-workers=8`。
|
||
|
||
## 常用命令
|
||
|
||
```bash
|
||
./rpctl list
|
||
./rpctl status
|
||
./rpctl start --rp ours-pp-object-cache --interval 10m --runs 6 --rirs all5
|
||
./rpctl start --rp routinator --interval 0 --runs 1 --rirs apnic
|
||
./rpctl start --rp rpki-prover --interval 0 --runs 2 --rirs all5
|
||
./rpctl start --rp rpki-prover-full --interval 0 --runs 1 --rirs all5
|
||
./rpctl continue --exp-id <successful-exp-id> --runs 3 --interval 10m
|
||
./rpctl tail
|
||
./rpctl show
|
||
./rpctl show --failed
|
||
./rpctl view --exp-id 20260709T081122Z_ours-pp-object-cache_2runs_600s
|
||
./rpctl delete --exp-id <old-exp-id> --dry-run
|
||
./rpctl paths
|
||
./rpctl stop
|
||
./rpctl stop --force
|
||
```
|
||
|
||
## Profile
|
||
|
||
| 输入别名 | 实际 profile |
|
||
|---|---|
|
||
| `ours`, `ours-rp`, `ours-cached` | `ours-pp-object-cache` |
|
||
| `ours-baseline` | `ours-no-cache` |
|
||
| `routinator` | `routinator-latest-release` |
|
||
| `rpki-client` | `rpki-client-latest-release` |
|
||
| `fort` | `fort-latest-release` |
|
||
| `rpki-prover`, `rpki-prover-incremental` | `rpki-prover-incremental` |
|
||
| `rpki-prover-full`, `rpki-prover-no-incremental` | `rpki-prover-full` |
|
||
|
||
`rpki-prover-incremental` 使用上游默认增量算法;`rpki-prover-full` 显式传入 `--no-incremental-validation`。两者的 state 位于各自实验/profile 目录,互不复用。首轮显示为 `snapshot`;后续和 `continue` 追加轮显示为 `warm`,表示保留了上轮 state,实际 RRDP snapshot/delta 决策仍由 rpki-prover 自身完成。
|
||
|
||
## 数据目录
|
||
|
||
默认部署根目录就是 `rpctl` 所在目录,例如 `/root/rpki_4rp_ctl`。
|
||
|
||
```text
|
||
/root/rpki_4rp_ctl/
|
||
bin/ lib/ fixtures/ scripts/
|
||
state/current.json
|
||
logs/runner-*.log
|
||
runs/<profile>/<exp-id>/profiles/<profile>/runs/run_0001/
|
||
```
|
||
|
||
每个子 run 目录包含 `stdout.log`、`stderr.log`、`exit-code.txt`、`run-meta.json` 以及各 RP 产物。传统四 RP 使用 `process-time.txt`;rpki-prover 额外保存 `container-inspect.json`、`rss-samples.tsv` 和 `vrps.csv`。
|
||
|
||
rpki-prover 的 `run-meta.json` 和 `view` 同时记录 VRP 原始行数与按 `(ASN, prefix, maxLength)` 去重数。其当前 CLI 不输出 VAP,所以统一显示 `n/a`,不是 `0`。max RSS 是容器全部相关 PID 的 RSS 峰值汇总,不是短暂 Docker client 进程的 RSS。
|
||
|
||
## 历史查看与删除
|
||
|
||
```bash
|
||
./rpctl show
|
||
./rpctl show --failed
|
||
./rpctl show --rp ours --limit 20
|
||
./rpctl show --json
|
||
```
|
||
|
||
`show` 会扫描 `runs/<profile>/<exp-id>/`,展示历史 `exp_id`、状态、start/end 时间、失败子 run 列表、运行参数、产物数量和目录路径。
|
||
|
||
默认表格为了可读性不显示完整路径;需要路径时使用:
|
||
|
||
```bash
|
||
./rpctl show --paths
|
||
```
|
||
|
||
```bash
|
||
./rpctl view --exp-id <exp-id>
|
||
./rpctl view --rp ours --exp-id <exp-id>
|
||
./rpctl view --exp-id <exp-id> --command
|
||
./rpctl view --exp-id <exp-id> --json
|
||
```
|
||
|
||
`view` 用于查看指定历史实验的摘要和每一轮子 run 明细,包括运行耗时、max RSS、VRP/VAP 数量、同步模式、exit code 和目录路径。
|
||
|
||
```bash
|
||
./rpctl delete --exp-id <old-exp-id> --dry-run
|
||
./rpctl delete --exp-id <old-exp-id> --yes
|
||
./rpctl delete --rp ours --exp-id <duplicated-exp-id> --yes
|
||
```
|
||
|
||
`delete` 只能删除非 running 的实验。建议先用 `--dry-run` 确认路径;真实删除必须显式加 `--yes`。删除内容包括 `runs/<profile>/<exp-id>/` 和匹配的 `logs/runner-<exp-id>*.log`。
|
||
|
||
如果历史实验中最后一个子 run 中途停止,且没有 `run-meta.json`、normalized 文件或原始输出文件,则 VRP/VAP、wall、RSS 会显示为 `-`,表示该子 run 没有可统计产物。
|
||
|
||
## 续跑已有成功实验
|
||
|
||
```bash
|
||
./rpctl continue --exp-id <successful-exp-id> --runs 3 --interval 10m
|
||
./rpctl continue --rp routinator --exp-id <successful-exp-id> --runs 1 --interval 0
|
||
```
|
||
|
||
`continue` 只接受已经成功结束的历史实验 `exp_id`,并在原目录下追加 `run_000N`。它不会清理 profile state,也不会给 RP 强制传 snapshot-only 参数;后续子 run 是 delta 还是 snapshot 由各 RP 根据自身持久状态决定。
|
||
|
||
续跑会复用原实验的 RIR 集合,避免在同一个 state 目录里混用不同 scope。若同一个 `exp-id` 在多个 profile 下存在,需要加 `--rp` 消歧。
|