# 快速开始 ## 要求 - 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)