Files
archer/docs/getting-started.md
T
voidandClaude Sonnet 4.6 366d61ca25 Add archer import and allow date-mode bulk delete
archer import replays a sealed archive into an existing table: shard
selection (`--select`), SHA-256 pre-verification, idempotent modes
(`ignore`/`insert`/`replace`), and both LOAD DATA and batched-INSERT
engines. It reads manifest.jsonl strictly so corruption is reported
instead of skipped, and supports --dry-run, --allow-partial, and
per-shard workers.

--bulk-delete no longer rejects --shard-by date. Range deletion now
derives its bounds from the chunk's actual keys (date scanners rewrite
LastKey into a resumption cursor) and keeps safe-auto-increment
semantics by excluding the current max key. A startup warning documents
the monotonic-shard-column assumption.

Also splits CLI/format/sharding/progress/safety reference docs out of
the README, and adds the corresponding OpenSpec change artifacts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-11-08 21:14:23 +08:00

1.4 KiB
Raw Blame History

快速开始

要求

  • Go 1.24+(构建)
  • MySQL 5.7+ / 8.0 或 MariaDB 10.x(运行)
  • 源表必须有主键或唯一索引;日期分片还需要分片列上的索引(见分片模式)

构建

go build -o archer ./cmd/archer

或使用打包脚本(Windows PowerShell / Linux shell):

./scripts/build.ps1
./scripts/build.sh

产物在 dist/ 下,版本信息通过 -ldflags -X 注入,archer --version 可查看。

最小示例

archer \
  --source 'user:pass@tcp(10.0.0.5:3306)/app' \
  --table orders \
  --where "created_at < '2025-01-01'" \
  --file ./export \
  --format dump

结果:./export/000001.<首主键>-<尾主键>.dump、manifest.jsonl、state.json。

只写目标表:

archer --source '...' --table orders --where "id < 100000" \
      --dest 'user:pass@tcp(10.0.0.9:3306)/archive' --dest-table orders

只删除(危险,需确认):

archer --source '...' --table orders --where "created_at < '2024-01-01'" --purge

先看计划,不落盘:

archer --source '...' --table orders --where "1=1" --file /tmp/out --dry-run

下一步