Storage Gateway创建好后,需要将其挂载到Ubuntu Server上,当作一个Drive来使用。
- 分配一个Elastic IP,固定IP地址,不然服务器关机重启IP改变,会导致所有通过SSH自动连接到这部机器的远程机器需要更新IP
- EC2 默认无法使用密码登陆,进入后修改/etc/ssh/sshd_config 将PasswordAuthentication 从no改为yes,然后service ssh restart, service sshd restart
- 挂载Storage GW到服务器上, 现在服务器根目录创建文件夹作为挂载点
-先安装nfs:sudo apt install nfs-common ,不然会报这样的错误:mount: /abc-folder: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
-挂载: sudo mount -t nfs -o nolock,hard 172.x.x.x:/abc-folder/ /abc-folrt-local/
-设置ssh key自动验证登陆,参考这里:https://blog.51cto.com/helpdesk/2422329
-在远程机器上,设置rsync脚步自动同步数据到Storage GW客户机,并配置cron job自动运行
rsync -az --remove-source-files --exclude="*.csv" /shareDoc/TestLog/abc-folder/* -e "ssh -i /run/s3sync" user@15.x.x.x:/abc-folder-local/
rsync -az /shareDoc/TestLog/abc-folder/* -e "ssh -i /root/s3sync" user@15.x.x.x:/abc-folder-local/