如何将国外的ftp气象大数据下载回来(by quqi99)

作者:张华 发表于:2020-10-22
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

由于运营商对non-http流量限速,从国外ftp下载大数据将变得异常艰难.目前采用的方法如下:

1, 国外虚机上安装curlftpfs将ftp站点镜像到/mnt/ftp

sudo apt install curlftpfs -y
#sudo fusermount -zu /mnt/ftp
sudo mkdir -p /mnt/ftp && sudo chown -R $USER /mnt/ftp
sudo bash -c 'cat >>/etc/fstab' <<EOF
curlftpfs#@ftp.hycom.org/datasets/global/GLBa0.08_rect/data /mnt/ftp fuse defaults,rw,allow_other,uid=1000,gid=1000,_netdev 0 0
EOF
sudo mount -a

2, 安装nginx指向/mnt/ftp将ftp变http

sudo apt install nginx -y
sudo vim /etc/nginx/sites-available/default
        #root /var/www/html;
        root /mnt/ftp;
        location / {
                try_files $uri $uri/ =404;
                autoindex on;
                autoindex_exact_size off;
                autoindex_localtime on;
        }

3, 国内采用下列命令下载.

wget -c -m http://3.18.xx.xx
#rsync -avztur -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.aws/xxx.pem" --progress ubuntu@3.18.xx.xx:/mnt/ftp .

但还是很快报了404错误,但通过下列方法debug curlftpfs显示是虚机和ftp.hycom.org之前的网络不通,重启虚机问题一样,但新建虚机可以telent ftp.hycom.org 21


#debug curlftpfs
sudo fusermount -zu /mnt/ftp/2d
sudo curlftpfs -f -v -o debug,ftpfs_debug=3,rw,allow_other,uid=1000,gid=1000 ftp://ftp.hycom.org/datasets/global/GLBa0.08_rect/data/2d /mnt/ftp/2d

难道是curlftpfs使用passive mode时遇到了防火墙问题, 这个网页(https://serverfault.com/questions/144266/allow-curlftpfs-though-iptables-firewall-how)提到了使用" -oftp_port=- "化解,但我没有试.
目前直接新开虚机,新建了一个6T的大硬盘,然后在虚机上运行

sudo mkfs.ext4 /dev/xvdb
#sudo parted /dev/xvdb  #print
sudo mount /dev/xvdb /mnt/
cd /mnt
wget -c -m ftp://ftp.hycom.org/datasets/global/GLBa0.08_rect/data/

然后nginx的目录指向: /mnt/ftp.hycom.org/datasets/global/GLBa0.08_rect/data
国内机器可以同时通过: wget -c -m http://xxx命令下载

另外,若要内网远程连接,简单地:

curl -s https://install.zerotier.com | sudo bash
zerotier-cli join e4da7455b283ffb8
systemctl enable zerotier-one
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

quqi99

你的鼓励就是我创造的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值