zerotier + rclone 异地同步minio文件

场景说明

生产minio部署在内网环境,外网无法访问,现在另外一个办公室也要使用同一个系统,因网络不通致使minio无法使用。

解决方案

使用zerotier打通内网
使用rclone同步数据

部署zerotier私有化服务

系统:centos7

docker部署zerotier

docker run --name moon --restart always -ti -d -e ZU_SECURE_HEADERS=false -e ZU_CONTROLLER_ENDPOINT=http://127.0.0.1:9993/ -e ZU_DEFAULT_USERNAME=admin -e ZU_DEFAULT_PASSWORD=123456 -p 14000:4000 -p 13000:3000 -p 19993:9993 -p 19993:9993/udp sbilly/zerotier-controller:latest

ZU_DEFAULT_USERNAME:登录账号
ZU_DEFAULT_PASSWORD:登陆密码
端口14000为web控制台访问入口
部署成功
在这里插入图片描述
访问web控制台
使用账号密码登录
创建虚拟网络创建虚拟网络
7cfbacfa021aef6b:网络id后面要用的在这里插入图片描述

zerotier客户端下载

客户端下载地址:https://www.zerotier.com/download/
一直点Next安装完成就好了
安装位置默认在:C:\Program Files (x86)\ZeroTier\One
在这里插入图片描述

加入虚拟网络

右键客户端图标
在这里插入图片描述
点击Join New Network
在这里插入图片描述
输入之前web控制台的网络id,点join就可以了
在这里插入图片描述

web控制台设置

private模式需要手动授权
授权后刷新会自动分配ip
在这里插入图片描述

测试网络连通性

在3栋ping5栋(本地ipv4shi是无法访问的)
在这里插入图片描述
本地虚拟ip
在这里插入图片描述
连接成功
在这里插入图片描述

使用rclone同步minio数据

下载地址:https://rclone.org/downloads/

解压后文件结构

在这里插入图片描述

使用cmd配置rclone

本地minio配置

D:\rclone-v1.64.2-windows-amd64>rclone.exe config
Current remotes:

Name                 Type
====                 ====
minio                s3
oldminio             s3

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n

Enter name for new remote.
name> 3_minio

Storage> s3

provider> Minio

env_auth> false

access_key_id> LX5bRMuiFh1X77v2

secret_access_key> onE68UOufq4PoVSDsjsOGfyhuGmms74b

region>

endpoint> http://127.0.0.1:9000

location_constraint>

acl> 3

server_side_encryption>

sse_kms_key_id>

Edit advanced config?
y) Yes
n) No (default)
y/n> n

Keep this "3_minio" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

远程minio配置

步骤跟本地一样,只是密钥要替换成远程minio的密钥,ip需要使用虚拟局域网的ip

D:\rclone-v1.64.2-windows-amd64>rclone.exe config
Current remotes:

Name                 Type
====                 ====
minio                s3
oldminio             s3

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n

Enter name for new remote.
name> 3_minio

Storage> s3

provider> Minio

env_auth> false

access_key_id> LX5bRMuiFh1X77v2

secret_access_key> onE68UOufq4PoVSDsjsOGfyhuGmms74b

region>

endpoint> http://10.147.17.112:9000

location_constraint>

acl> 3

server_side_encryption>

sse_kms_key_id>

Edit advanced config?
y) Yes
n) No (default)
y/n> n

Keep this "3_minio" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

查看配置

D:\rclone-v1.64.2-windows-amd64>rclone.exe config show
[minio]
type = s3
provider = Minio
access_key_id = SK0y9ylz0ykrx40yfrK1
secret_access_key = sAfAVTWlddWu2S5ZyKdDTMtDfFqsRzCL504OyCwE
endpoint = http://10.147.17.73:9000
acl = c

[oldminio]
type = s3
provider = Minio
access_key_id = kmTkpssaMOVpVY5IkGry
secret_access_key = rqphVnVPJVZiRUVMgKn2Zgg1NuJLvUhVRsVgyCyc
endpoint = http://127.0.0.1:9000
acl = c
server_side_encryption = aws:kms

同步文件

D:\rclone-v1.64.2-windows-amd64>rclone.exe copy oldminio:/xxx minio:/zzz

copy:同步本地文件夹到远程文件夹,远程文件夹存在的不同步
/xxx:本地minio对应文件地址
/zzz:远程桶,没有则会新建

还有sync等其他指令可以自己研究
同步方案有很多,例如定时同步

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值