服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - 编程技术 - GitHub标星14K!程序员人手必备的开源备份工具

GitHub标星14K!程序员人手必备的开源备份工具

2021-11-26 22:12开源最前线猿妹综合整理 编程技术

备份软件已经是一个老生常谈的话题了,今天,猿妹要和大家分享一个备份工具——restic。

GitHub标星14K!程序员人手必备的开源备份工具

备份软件已经是一个老生常谈的话题了,今天,猿妹要和大家分享一个备份工具——restic。

Restic是一种快速、高效、免费和开源的备份应用程序,它通过AES-256加密保护你的数据,Restic 还利用重复数据删除来帮助节省备份空间。此外,Restic 与大多数主要的云提供商兼容,支持三大操作系统(Linux、macOS、Windows)和一些较小的操作系统(FreeBSD、OpenBSD)。

GitHub标星14K!程序员人手必备的开源备份工具

目前,Restic已经在Github上标星 14.6K,累计分支 999 个(Github地址:https://github.com/restic/restic)

首先,你可以从源代码编译restic或从发布页面下载它。一旦安装好restic,就可以开始备份:

  1. $ restic init --repo /tmp/backup
  2. enter password for new backend:
  3. enter password again:
  4. created restic backend 085b3c76b9 at /tmp/backup
  5. Please note that knowledge of your password is required to access the repository.
  6. Losing your password means that your data is irrecoverably lost.

并添加一些数据:

  1. $ restic --repo /tmp/backup backup ~/work
  2. enter password for repository:
  3. scan [/home/user/work]
  4. scanned 764 directories, 1816 files in 0:00
  5. [0:29] 100.00% 54.732 MiB/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00
  6. duration: 0:29, 54.47MiB/s
  7. snapshot 40dc1520 saved

接下来,你可以restic restore用于恢复文件,要获取所有备份快照的列表,可以使用以下的命令:

  1. restic -r b2:bucketname:/ snapshots

例如:

  1. $ restic -r b2:g534fbucket:/ snapshots
  2. enter password for repository:
  3. ID Date Host Tags Directory
  4. ----------------------------------------------------------------------
  5. d864c465 2018-03-27 15:20:42 client /home/curt/Documents

如果你要恢复整个快照,就运行以下命令:

  1. restic -r b2:bucketname:/ restore snapshotID --target restoreDirectory

例如:

  1. $ restic -r b2:g534fbucket:/ restore d864c465 --target ~
  2. enter password for repository:
  3. restoring <Snapshot d864c465 of [/home/curt/Documents] at 2018-03-27 15:20:42.833131988 -0400 EDT by curt@client> to /home/curt

如果该目录仍然存在于你的系统上,请确保为restoreDirectory指定不同的位置。例如:

  1. restic -r b2:g534fbucket:/ restore d864c465 --target /tmp

要恢复单个文件,请运行如下命令:

  1. $ restic -r b2:g534fbucket:/restore snapshotID --target restoreDirectory --include filename

例如:

  1. $ restic -r b2:g534fbucket:/ restore d864c465 --target /tmp --include file1.txt
  2. enter password for repository:
  3. restoring <Snapshot d864c465 of [/home/curt/Documents] at 2018-03-27 15:20:42.833131988 -0400 EDT by curt@client> to /tmp

原文链接:https://mp.weixin.qq.com/s?__biz=MjM5NzA1MTcyMA==&mid=2651179077&idx=2&sn=ceb75b4a9ca3b1bf63c7b35929b6e922&chksm=bd2e84628a590d745ee3f5413d6b1b61393ad948f92bd08d93151f81d1267883aed38474daa9&mpshare=1&s

延伸 · 阅读

精彩推荐