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

67 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 快速开始
## 要求
- Go 1.24+(构建)
- MySQL 5.7+ / 8.0 或 MariaDB 10.x(运行)
- 源表必须有主键或唯一索引;日期分片还需要分片列上的索引(见[分片模式](sharding.md))
## 构建
```bash
go build -o archer ./cmd/archer
```
或使用打包脚本(Windows PowerShell / Linux shell):
```powershell
./scripts/build.ps1
```
```bash
./scripts/build.sh
```
产物在 `dist/` 下,版本信息通过 `-ldflags -X` 注入,`archer --version` 可查看。
## 最小示例
```bash
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`。
只写目标表:
```bash
archer --source '...' --table orders --where "id < 100000" \
--dest 'user:pass@tcp(10.0.0.9:3306)/archive' --dest-table orders
```
只删除(危险,需确认):
```bash
archer --source '...' --table orders --where "created_at < '2024-01-01'" --purge
```
先看计划,不落盘:
```bash
archer --source '...' --table orders --where "1=1" --file /tmp/out --dry-run
```
## 下一步
- [分片模式](sharding.md)
- [输出格式与导入](output-formats.md)
- [清单与断点](checkpoint-and-resume.md)
- [进度显示](progress.md)
- [安全说明](safety.md)
- [参数参考](cli-reference.md)