|
@@ -1,4 +1,5 @@
|
|
|
# tunasync 上手指南
|
|
|
+
|
|
|
date: 2016-10-31 00:50:00
|
|
|
|
|
|
[tunasync](https://github.com/tuna/tunasync) 是[清华大学 TUNA 镜像源](https://mirrors.tuna.tsinghua.edu.cn)目前使用的镜像方案。
|
|
@@ -7,32 +8,32 @@ date: 2016-10-31 00:50:00
|
|
|
|
|
|
本例中:
|
|
|
|
|
|
- - 只镜像[elvish](https://elvish.io)项目
|
|
|
- - 禁用了https
|
|
|
- - 禁用了cgroup支持
|
|
|
+- 只镜像[elvish](https://elvish.io)项目
|
|
|
+- 禁用了https
|
|
|
+- 禁用了cgroup支持
|
|
|
|
|
|
## 获得tunasync
|
|
|
|
|
|
### 二进制包
|
|
|
|
|
|
-到 [Github Releases](https://github.com/tuna/tunasync/releases/latest) 下载 `tunasync-linux-bin.tar.gz` 即可。
|
|
|
+到 [Github Releases](https://github.com/tuna/tunasync/releases/latest) 下载 `tunasync-linux-amd64-bin.tar.gz` 即可。
|
|
|
|
|
|
### 自行编译
|
|
|
|
|
|
-```
|
|
|
-$ make
|
|
|
+```shell
|
|
|
+> make
|
|
|
```
|
|
|
|
|
|
## 配置
|
|
|
|
|
|
-```
|
|
|
-$ mkdir ~/tunasync_demo
|
|
|
-$ mkdir /tmp/tunasync
|
|
|
+```shell
|
|
|
+> mkdir ~/tunasync_demo
|
|
|
+> mkdir /tmp/tunasync
|
|
|
```
|
|
|
|
|
|
-`~/tunasync_demo/worker.conf`:
|
|
|
+编辑 `~/tunasync_demo/worker.conf`:
|
|
|
|
|
|
-```
|
|
|
+```conf
|
|
|
[global]
|
|
|
name = "test_worker"
|
|
|
log_dir = "/tmp/tunasync/log/tunasync/{{.Name}}"
|
|
@@ -64,9 +65,9 @@ upstream = "rsync://rsync.elvish.io/elvish/"
|
|
|
use_ipv6 = false
|
|
|
```
|
|
|
|
|
|
-`~/tunasync_demo/manager.conf`:
|
|
|
+编辑 `~/tunasync_demo/manager.conf`:
|
|
|
|
|
|
-```
|
|
|
+```conf
|
|
|
debug = false
|
|
|
|
|
|
[server]
|
|
@@ -83,26 +84,26 @@ ca_cert = ""
|
|
|
|
|
|
### 运行
|
|
|
|
|
|
-```
|
|
|
-$ tunasync manager --config ~/tunasync_demo/manager.conf
|
|
|
-$ tunasync worker --config ~/tunasync_demo/worker.conf
|
|
|
+```shell
|
|
|
+> tunasync manager --config ~/tunasync_demo/manager.conf
|
|
|
+> tunasync worker --config ~/tunasync_demo/worker.conf
|
|
|
```
|
|
|
|
|
|
-本例中,镜像的数据在`/tmp/tunasync/`
|
|
|
+本例中,镜像的数据在 `/tmp/tunasync/`。
|
|
|
|
|
|
### 控制
|
|
|
|
|
|
查看同步状态
|
|
|
|
|
|
-```
|
|
|
-$ tunasynctl list -p 12345 --all
|
|
|
+```shell
|
|
|
+> tunasynctl list -p 12345 --all
|
|
|
```
|
|
|
|
|
|
tunasynctl 也支持配置文件。配置文件可以放在 `/etc/tunasync/ctl.conf` 或者 `~/.config/tunasync/ctl.conf` 两个位置,后者可以覆盖前者的配置值。
|
|
|
|
|
|
配置文件内容为:
|
|
|
|
|
|
-```
|
|
|
+```conf
|
|
|
manager_addr = "127.0.0.1"
|
|
|
manager_port = 12345
|
|
|
ca_cert = ""
|
|
@@ -118,13 +119,13 @@ worker 和 manager 之间用 http(s) 通信,如果你 worker 和 manager 都
|
|
|
|
|
|
可以参看
|
|
|
|
|
|
-```
|
|
|
-$ tunasync manager --help
|
|
|
-$ tunasync worker --help
|
|
|
+```shell
|
|
|
+> tunasync manager --help
|
|
|
+> tunasync worker --help
|
|
|
```
|
|
|
|
|
|
可以看一下 log 目录
|
|
|
|
|
|
-一些 worker 配置文件示例 [workers.conf](workers.conf)
|
|
|
+一些 worker 配置文件示例 [workers.conf](workers.conf)。
|
|
|
|
|
|
-你可能会用到的操作 [tips.md](tips.md)
|
|
|
+你可能会用到的操作 [tips.md](tips.md)。
|