我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们
文章版本: Enterprise Server 2.15

此版本的 GitHub Enterprise 将停止服务 此版本的 GitHub Enterprise 已停止服务 2019-10-16. 即使针对重大安全问题,也不会发布补丁。 For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

在设备上配置备份

作为灾难恢复计划的一部分,您可以通过配置自动备份的方式保护 您的 GitHub Enterprise Server 实例 中的生产数据。

本文内容

关于 GitHub Enterprise Server 备份实用程序

GitHub Enterprise Server 备份实用程序 是在单独主机上安装的备份系统,会通过安全的 SSH 网络连接定期生成 您的 GitHub Enterprise Server 实例 的备份快照。 您可以使用快照将现有的 GitHub Enterprise Server 实例从备份主机还原为上一个状态。

只有自上一个快照之后添加的数据将通过网络传输并占用额外的物理存储空间。 要最大限度地减小对性能的影响,会以最低 CPU/IO 优先级在线执行备份。 您不需要排定维护窗口来执行备份。

更多关于功能、要求和高级用法的详细信息,请参阅 GitHub Enterprise Server 备份实用程序 自述文件

基本要求

要使用 GitHub Enterprise Server 备份实用程序,您必须将 Linux 或 Unix 主机系统与 您的 GitHub Enterprise Server 实例 分开。

您还可以将 GitHub Enterprise Server 备份实用程序 集成到现有环境中,以便长期、永久地存储重要数据。

建议将备份主机和 您的 GitHub Enterprise Server 实例 放置在相距较远的位置。 这样可以确保在主要站点发生重大事故或网络故障的情况下通过备份进行还原。

物理存储要求将因 Git 仓库磁盘使用情况以及预计的增长情况而异:

硬件 建议
vCPU 2
内存 2 GB
存储器 等于为主要实例分配的存储空间的五倍

根据您的使用情况(例如用户活动和选定的集成),可能需要更多资源。

安装 GitHub Enterprise Server 备份实用程序

:为确保还原的设备立即可用,即使采用 Geo-replication 配置,也应针对主要实例执行备份。

  1. 下载最新的 GitHub Enterprise Server 备份实用程序 版本并使用 tar 命令解压文件。

    $ tar -xzvf /path/to/github-backup-utils-vMAJOR.MINOR.PATCH.tar.gz   
  2. Copy the included backup.config-example file to backup.config and open in an editor.
  3. Set the GHE_HOSTNAME value to your primary GitHub Enterprise Server instance's hostname or IP address.
  4. Set the GHE_DATA_DIR value to the filesystem location where you want to store backup snapshots.
  5. Open your primary instance's settings page at https://HOSTNAME/setup/settings and add the backup host's SSH key to the list of authorized SSH keys. For more information, see Accessing the administrative shell (SSH).
  6. Verify SSH connectivity with 您的 GitHub Enterprise Server 实例 with the ghe-host-check command.

    $ bin/ghe-host-check        
  7. To create an initial full backup, run the ghe-backup command.

    $ bin/ghe-backup        

For more information on advanced usage, see the GitHub Enterprise Server 备份实用程序 README.

排定备份

You can schedule regular backups on the backup host using the cron(8) command or a similar command scheduling service. 配置的备份频率将决定您的恢复计划中的最坏情况恢复点目标 (RPO)。 例如,如果您已排定在每天午夜运行备份,则在发生灾难的情况下,可能丢失长达 24 小时的数据。 建议在开始时采用每小时备份日程,从而确保在主要站点数据受到破坏时,最坏情况下最多会丢失一小时的数据。

If backup attempts overlap, the ghe-backup command will abort with an error message, indicating the existence of a simultaneous backup. 如果出现这种情况,建议降低已排定的备份的频率。 For more information, see the "Scheduling backups" section of the GitHub Enterprise Server 备份实用程序 README.

还原备份

In the event of prolonged outage or catastrophic event at the primary site, you can restore 您的 GitHub Enterprise Server 实例 by provisioning another GitHub Enterprise appliance and performing a restore from the backup host. 在还原设备之前,您必须将备份主机的 SSH 密钥作为已授权 SSH 密钥添加到目标 GitHub Enterprise 设备。

To restore 您的 GitHub Enterprise Server 实例 from the last successful snapshot, use the ghe-restore command. 您看到的输出应类似于:

$ ghe-restore -c 169.154.1.1
> Checking for leaked keys in the backup snapshot that is being restored ...
> * No leaked keys found
> Connect 169.154.1.1:122 OK (v2.9.0)

> WARNING: All data on GitHub Enterprise appliance 169.154.1.1 (v2.9.0)
>          will be overwritten with data from snapshot 20170329T150710.
> Please verify that this is the correct restore host before continuing.
> Type 'yes' to continue: yes
> Starting restore of 169.154.1.1:122 from snapshot 20170329T150710
# ...output truncated
> Completed restore of 169.154.1.1:122 from snapshot 20170329T150710
> Visit https://169.154.1.1/setup/settings to review appliance configuration.

:网络设置不包含在备份快照中。 您必须根据环境的要求在目标 GitHub Enterprise Server 设备上手动配置网络。

您可以将以下附加选项与 ghe-restore 命令结合使用:

问问别人

找不到要找的内容?

联系我们