加入收藏 | 设为首页 | 会员中心 | 我要投稿 辽源站长网 (https://www.0437zz.com/)- 云专线、云连接、智能数据、边缘计算、数据安全!
当前位置: 首页 > 站长资讯 > 外闻 > 正文

Linux服务器数据定期同步和备份方式

发布时间:2018-09-25 22:07:18 所属栏目:外闻 来源:生信宝典
导读:【新品产上线啦】51CTO播客,随时随地,碎片化学习 数据安全是做数据分析的人需要关注的一大问题。对于我们分析的关键数据、使用的关键脚本都需要定期备份。 scp 最简单的备份方式,就是使用cp (本地硬盘)或scp (远程硬盘)命令,给自己的结果文件新建一个拷

Use rdiff-backup

  • Start backup

rdiff-backup --no-compression --print-statistics user@host::/home/user/source_dir destination_dir

If the destination_dir exists, please add --force like rdiff-backup --no-compression --force --print-statistics user@host::/home/user/source_dir destination_dir. All things in original destination_dir will be depleted.

If you want to exclude or include special files or dirs please specify like --exclude '**trash' or --include /home/user/source_dir/important.

  • Timely backup your data

Add the above command into crontab (hit 'crontab -e' in terminal to open crontab) in the format like 5 22 */1 * * command which means executing the command at 22:05 everyday.

  • Restore data

Restore the latest data by running rdiff-backup -r now destination_dir user@host::/home/user/source_dir.restore. Add --force if you want to restore to source_dir.

Restore files 10 days ago by running rdiff-backup -r 10D destination_dir user@host::/home/user/source_dir.restore. Other acceptable time formats include 5m4s (5 minutes 4 seconds) and 2014-01-01 (January 1st, 2014).

Restore files from an increment file by running rdiff-backup destination_dir/rdiff-backup-data/increments/server_add.2014-02-21T09:22:45+08:00.missing user@host::/home/user/source_dir.restore/server_add. Increment files are stored in destination_dir/rdiff-backup-data/increments/server_add.2014-02-21T09:22:45+08:00.missing.

  • Remove older records to save space

Deletes all information concerning file versions which have not been current for 2 weeks by running rdiff-backup --remove-older-than 2W --force destination_dir. Note that an existing file which has not changed for a year will still be preserved. But a file which was deleted 15 days ago can not be restored after this command. Normally one should use --force since it is used to delete multiple increments at the same time which --remove-older-thanrefuses to do by default.

Only keeps the last n rdiff-backup sessions by running rdiff-backup --remove-older-than 20B --force destination_dir.

  • Statistics

Lists increments in given golder by rdiff-backup --list-increments destination_dir/.

Lists of files changed in last 5 days by rdiff-backup --list-changed-since 5D destination_dir/.

Compare the difference between source and bak by rdiff-backup --compare user@host::source-dir destination_dir

Compare the sifference between source and bak (as it was two weeks ago) by rdiff-backup --compare-at-time 2W user@host::source-dir destination_dir.

(编辑:辽源站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读