Skip to main content

了解快照文件结构

了解备份快照目录的结构和内容,包括存储的内容以及硬链接的使用方法。

每个备份快照都存储在一个带有时间戳的目录中(例如 YYYYMMDDTHHMMSS),该目录位于备份目标路径下(例如 /data/backup/data)。 快照包括密钥数据存储的完整导出。 Git 仓库、GitHub Pages 和其他组件通过硬链接的方式进行存储,以优化存储空间并实现高效的时间点还原。

注意

如果对备份快照进行存档,则必须保留符号链接。 取消引用或排除符号链接,或者将快照存储在不支持符号链接的文件系统上,都可能导致还原失败。

符号链接 current 始终指向最近一次成功的快照目录。

快照目录的内容 (<SNAPSHOT_TIMESTAMP>/)

每个快照目录包含与实例配置、数据存储和操作元数据相关的文件和文件夹。 下面是一个典型的结构。

设置和配置

settings.json             # Main appliance settings
manage-password           # Management console password hash
uuid                      # Appliance UUID
version                   # GHES version at backup time
strategy                  # Backup strategy used (e.g., rsync, cluster)
cluster.conf              # Cluster configuration (if applicable)

数据存储导出

mysql.sql.gz              # Logical database dump (default) OR
xtrabackup_checkpoints    # Binary backup metadata (if binary backups used)
xtrabackup-export.log     # Log snippet from binary backup
mysql-binary-backup-sentinel # Indicates binary backup type
# May include other files related to logical or binary MySQL backups

Redis

redis.rdb                 # Redis database dump

Elasticsearch

audit-log/                # Audit log indices (uses hard links)
elasticsearch/            # Search indices (if not skipped, uses hard links)

GitHub 数据

repositories/             # Git repositories (uses hard links)
pages/                    # GitHub Pages content (uses hard links)
storage/                  # Alambic-managed storage: avatars, attachments, etc. (uses hard links)

GitHub Actions 和 CI/CD

actions/                  # GitHub Actions blob storage (uses hard links)
mssql/                    # MS SQL Server backups (.bak, .diff, .log) (uses hard links)
minio/                    # MinIO object storage (if Actions or Packages enabled, uses hard links)

机密和凭据

authorized-keys.json      # SSH keys authorized for administrative access
github-secrets.tar        # Tarball of various exported instance secrets
saml-keys.tar             # SAML IdP keys (if applicable)
ssh-host-keys.tar         # SSH host keys
ssl-ca-certificates.tar   # Custom CA certificates (if applicable)
# Includes other internal secrets and keys necessary for instance operation.

挂钩和交付数据

git-hooks/                # Custom Git hooks (uses hard links)
hookshot/                 # Webhook delivery data (uses hard links)

杂项

enterprise.ghl            # License file (often restored separately)
live-upgrade/             # Data for live upgrades or migrations (uses hard links)
benchmarks/               # Performance logs for backup steps

备份根目录内容 (/data/backup/data/)

备份根目录中包含所有快照文件夹以及用于增量备份跟踪和清理的元数据。

YYYYMMDDTHHMMSS/          # Snapshot directory (one per backup)
...                       # Other snapshot directories
current                   # Symlink to the most recent successful snapshot
inc_full_backup           # Tracks base for MySQL incremental backups
inc_snapshot_data         # Tracks incremental MySQL snapshots
prune_*                   # Temporary directories marked for deletion
inc_previous_*            # Renamed snapshot directories during pruning cycle