From 4bf93174134cf8e993aef0feff67b5b7c100a0e1 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Fri, 22 May 2020 12:39:23 +0800 Subject: [PATCH] Clarify the support of multiple mirrors in one tunasync worker. --- tunasync/conf/worker-centos.conf | 30 ------------------ tunasync/conf/worker-epel.conf | 29 ----------------- tunasync/conf/worker-pypi.conf | 29 ----------------- tunasync/conf/worker-ubuntu.conf | 30 ------------------ tunasync/conf/worker.conf | 50 ++++++++++++++++++++++++++++++ tunasync/scripts/updateTunasync.sh | 19 ++++++------ 6 files changed, 60 insertions(+), 127 deletions(-) delete mode 100644 tunasync/conf/worker-centos.conf delete mode 100644 tunasync/conf/worker-epel.conf delete mode 100644 tunasync/conf/worker-pypi.conf delete mode 100644 tunasync/conf/worker-ubuntu.conf create mode 100644 tunasync/conf/worker.conf diff --git a/tunasync/conf/worker-centos.conf b/tunasync/conf/worker-centos.conf deleted file mode 100644 index 73c25f6..0000000 --- a/tunasync/conf/worker-centos.conf +++ /dev/null @@ -1,30 +0,0 @@ -[global] -name = "centos_worker" -log_dir = "/mirrors/log/tunasync/{{.Name}}" -mirror_dir = "/mirrors" -concurrent = 10 -interval = 1440 - -[manager] -api_base = "http://localhost:14242" -token = "some_token" -ca_cert = "" - -[cgroup] -enable = false -base_path = "/sys/fs/cgroup" -group = "tunasync" - -[server] -hostname = "localhost" -listen_addr = "127.0.0.1" -listen_port = 16010 -ssl_cert = "" -ssl_key = "" - -[[mirrors]] -name = "centos" -provider = "rsync" -upstream = "rsync://mirrors.tuna.tsinghua.edu.cn/centos/" -use_ipv6 = false - diff --git a/tunasync/conf/worker-epel.conf b/tunasync/conf/worker-epel.conf deleted file mode 100644 index 3b3463a..0000000 --- a/tunasync/conf/worker-epel.conf +++ /dev/null @@ -1,29 +0,0 @@ -[global] -name = "epel_worker" -log_dir = "/mirrors/log/tunasync/{{.Name}}" -mirror_dir = "/mirrors" -concurrent = 3 -interval = 1680 - -[manager] -api_base = "http://localhost:14242" -token = "some_token" -ca_cert = "" - -[cgroup] -enable = false -base_path = "/sys/fs/cgroup" -group = "tunasync" - -[server] -hostname = "localhost" -listen_addr = "127.0.0.1" -listen_port = 16030 -ssl_cert = "" -ssl_key = "" - -[[mirrors]] -name = "epel" -provider = "rsync" -upstream = "rsync://rsync.mirrors.ustc.edu.cn/epel/" -use_ipv6 = false diff --git a/tunasync/conf/worker-pypi.conf b/tunasync/conf/worker-pypi.conf deleted file mode 100644 index e4abae4..0000000 --- a/tunasync/conf/worker-pypi.conf +++ /dev/null @@ -1,29 +0,0 @@ -[global] -name = "pypi_worker" -log_dir = "/mirrors/log/tunasync/{{.Name}}" -mirror_dir = "/mirrors" -concurrent = 5 -interval = 1920 - -[manager] -api_base = "http://localhost:14242" -token = "some_token" -ca_cert = "" - -[cgroup] -enable = false -base_path = "/sys/fs/cgroup" -group = "tunasync" - -[server] -hostname = "localhost" -listen_addr = "127.0.0.1" -listen_port = 16050 -ssl_cert = "" -ssl_key = "" - -[[mirrors]] -name = "pypi" -provider = "rsync" -upstream = "rsync://rsync.mirrors.ustc.edu.cn/pypi/" -use_ipv6 = false diff --git a/tunasync/conf/worker-ubuntu.conf b/tunasync/conf/worker-ubuntu.conf deleted file mode 100644 index 4fbc802..0000000 --- a/tunasync/conf/worker-ubuntu.conf +++ /dev/null @@ -1,30 +0,0 @@ -[global] -name = "ubuntu_worker" -log_dir = "/mirrors/log/tunasync/{{.Name}}" -mirror_dir = "/mirrors" -concurrent = 10 -interval = 540 - -[manager] -api_base = "http://localhost:14242" -token = "some_token" -ca_cert = "" - -[cgroup] -enable = false -base_path = "/sys/fs/cgroup" -group = "tunasync" - -[server] -hostname = "localhost" -listen_addr = "127.0.0.1" -listen_port = 16020 -ssl_cert = "" -ssl_key = "" - -[[mirrors]] -name = "ubuntu" -provider = "rsync" -upstream = "rsync://mirrors.yun-idc.com/ubuntu/" -use_ipv6 = false - diff --git a/tunasync/conf/worker.conf b/tunasync/conf/worker.conf new file mode 100644 index 0000000..ba03c53 --- /dev/null +++ b/tunasync/conf/worker.conf @@ -0,0 +1,50 @@ +[global] +name = "worker" +log_dir = "/mirrors/log/tunasync/{{.Name}}" +mirror_dir = "/mirrors" +concurrent = 10 +interval = 1440 + +[manager] +api_base = "http://localhost:14242" + +[cgroup] +enable = false +base_path = "/sys/fs/cgroup" +group = "tunasync" + +[server] +hostname = "localhost" +listen_addr = "127.0.0.1" +listen_port = 16020 +ssl_cert = "" +ssl_key = "" + +[[mirrors]] +name = "ubuntu" +provider = "rsync" +upstream = "rsync://mirrors.yun-idc.com/ubuntu/" +use_ipv6 = false +interval = 540 + +[[mirrors]] +name = "pypi" +provider = "rsync" +upstream = "rsync://rsync.mirrors.ustc.edu.cn/pypi/" +use_ipv6 = false +interval = 1920 + +[[mirrors]] +name = "epel" +provider = "rsync" +upstream = "rsync://rsync.mirrors.ustc.edu.cn/epel/" +use_ipv6 = false +interval = 1680 + +[[mirrors]] +name = "centos" +provider = "rsync" +upstream = "rsync://mirrors.tuna.tsinghua.edu.cn/centos/" +use_ipv6 = false +# interval is inherited from the global configuration + diff --git a/tunasync/scripts/updateTunasync.sh b/tunasync/scripts/updateTunasync.sh index d3c34aa..d417717 100644 --- a/tunasync/scripts/updateTunasync.sh +++ b/tunasync/scripts/updateTunasync.sh @@ -1,17 +1,18 @@ #! /bin/bash source ~/.bash_profile -centos_size=`du -sh /mirrors/centos/ | awk '{print $1}'` -epel_size=`du -sh /mirrors/epel/ | awk '{print $1}'` -ubuntu_size=`du -sh /mirrors/ubuntu/ | awk '{print $1}'` -pypi_size=`du -sh /mirrors/pypi/ | awk '{print $1}'` +# Not needed because sizes can be retrived directly from rsync logs +#centos_size=`du -sh /mirrors/centos/ | awk '{print $1}'` +#epel_size=`du -sh /mirrors/epel/ | awk '{print $1}'` +#ubuntu_size=`du -sh /mirrors/ubuntu/ | awk '{print $1}'` +#pypi_size=`du -sh /mirrors/pypi/ | awk '{print $1}'` -tunasynctl set-size -w centos_worker centos $centos_size -tunasynctl set-size -w epel_worker epel $epel_size -tunasynctl set-size -w ubuntu_worker ubuntu $ubuntu_size -tunasynctl set-size -w pypi_worker pypi $pypi_size +#tunasynctl set-size -w worker centos $centos_size +#tunasynctl set-size -w worker epel $epel_size +#tunasynctl set-size -w worker ubuntu $ubuntu_size +#tunasynctl set-size -w worker pypi $pypi_size -sleep 5 +#sleep 5 mv /mirrors/jobs.json /mirrors/jobs.json.bak wget -c http://localhost:14242/jobs -O /mirrors/jobs.json -o /mirrors/log/plog/wget.log