备份和恢复
This chapter contains information on the files you need to back up. With the built-in backup and restore solution (mgradm backup) you create SUSE Multi-Linux Manager backups. Information about restoring from your backups in the case of a system failure completes this chapter.
由于 SUSE Multi-Linux Manager 依赖数据库及已安装的程序和配置,因此备份安装的所有组件至关重要。请定期备份您安装的 SUSE Multi-Linux Manager 系统,以防止数据丢失并确保快速恢复。
|
无论您使用哪种备份方法,可用空间必须是当前安装使用的空间量的至少三倍。空间不足可能导致备份失败,因此请经常检查可用空间。 |
1. 借助 smdba 禁用旧方法
如果您全新安装了 SUSE Multi-Linux Manager 5.1,则可跳过该节内容。
|
With the advent of the built-in solution, the old method with the |
Either disable smdba before migrating (recommended) or later on the migrated SUSE Multi-Linux Manager 5.1 system.
本过程仅适用于仍安装有 smdba 的场景。
SUSE Manager 4.3(非容器化安装)与 SUSE Manager 5.0(容器化安装)系统中执行的命令有所不同(适用于 5.0 版本,或迁移前的 4.3 版本):
- SUSE Manager 4.3
在命令行中以 root 身份执行以下命令:
smdba backup-hot --enable=off
- SUSE Manager 5.0
在容器主机的命令行中,以 root 身份执行以下命令:
mgrctl exec -- smdba backup-hot --enable=offThis will change
archive_commandin/var/lib/pgsql/data/postgresql.confas follows:archive_command = '/bin/true'
至此,您的旧系统已准备就绪,可迁移至 SUSE Multi-Linux Manager 5.1。
请在迁移后执行此过程(此时 smdba 已不可用)。
On the container host, as root, edit
/var/lib/containers/storage/volumes/var-pgsql/_data/postgresql.confand set these options:archive_mode = off archive_command = '/bin/true'重启容器:
mgradm restart
2. 备份 SUSE Multi-Linux Manager
The most comprehensive method for backing up your SUSE Multi-Linux Manager installation is to use mgradm backup create command. This can save you time in administering your backup, and can be faster to reinstall and re-synchronize in the case of failure. However, this method requires significant disk space and could take a long time to perform the backup.
mgradm backup create command performs backup to a directory. This directory can be both local or mounted remote storage.
mgradm backup create command allows various customizations of the content of the backup. For all available options, see mgradm backup create --help.
2.1. SUSE Multi-Linux Manager 的完整备份
SUSE Multi-Linux Manager 的完整备份包含以下组件的备份:
-
SUSE Multi-Linux Manager 卷
-
数据库卷
-
podman 网络配置
-
podman 机密
-
SUSE Multi-Linux Manager systemd 服务
-
SUSE Multi-Linux Manager 容器映像
|
创建完整备份期间,SUSE Multi-Linux Manager 服务将自动停止。此期间的服务中断时间可能较长。备份完成后,服务会自动重启。 |
mgradm backup create
在容器主机上,以 root 身份执行以下命令创建备份:
mgradm backup create $pathReplace
$pathby the path to the backup location.
2.2. SUSE Multi-Linux Manager 的部分备份
mgradm backup create tool allows creating partial backups. It is possible to skip individual or all volumes, skip database backup and images.
特别是,当跳过数据库备份时,系统会创建备份而不停止 SUSE Multi-Linux Manager 服务,备份可以作为两阶段备份流程中的一个阶段运行。
|
部分备份仅针对部分数据执行,并未考量这些数据与其他未备份部分之间可能存在的依赖关系。因此,部分备份无法保障备份与恢复操作的一致性。 |
在容器主机上,以 root 身份执行以下命令创建备份:
mgradm backup create --skipdatabase $pathReplace
$pathby the path to the backup location.
在容器主机上,以 root 身份执行以下命令创建备份:
mgradm backup create --skipvolumes $volumes $pathReplace
$pathby the path to the backup location.Replace
$volumesby the name of the volume name to be excluded from the backup, or by a comma separated list of volumes to be excluded.Use
allto skip all volumes, except database volumes.
2.3. 备份额外的卷
mgradm backup command uses internal list of SUSE Multi-Linux Manager volumes. If additional volumes were configured during the installation, or additional volumes should be added to the backup, they need to be specified using --extravolumes $volumes.
在容器主机上,以 root 身份执行以下命令创建备份:
mgradm backup create --extravolumes $volume $pathReplace
$pathby the path to the backup location.Replace
$volumesby the name of the volume name to be included in the backup. or by a comma separated list of volumes to be included.
2.4. 执行手动数据库备份
请为备份分配永久存储空间。
在 SUSE Multi-Linux Manager 容器主机的命令提示符处,以 root 身份执行以下命令:
mgradm backup create --skipvolumes all --skipconfig --skipimages $path
3. 从现有备份恢复 SUSE Multi-Linux Manager
从现有备份恢复 SUSE Multi-Linux Manager 时,系统将枚举卷、映像和配置的备份以进行恢复。与创建备份的场景不同,恢复操作不使用内部卷列表,而是自动检测备份中存在的所有卷或映像。
收集待恢复项目列表后,系统会执行存在性和完整性检查。存在性检查用于确保恢复备份时不会意外覆盖现有卷、映像或配置。完整性检查通过计算备份项目的校验和完成。
两项检查均通过后,才会执行实际的备份恢复操作。
|
恢复操作完成后,SUSE Multi-Linux Manager 服务不会自动启动。 |
在容器主机上以 root 身份运行以下命令,重新部署 SUSE Multi-Linux Manager 服务器:
mgradm stop mgradm backup restore $path mgradm startReplace
$pathby the path to the backup location.
Verification of the backup can be a time-consuming operation. If backup integrity is ensured by other means, verification can be skipped by using --skipverify option.
If for some reason it is needed to skip restoring a volume present in the backup, --skipvolumes $volumes option can be used.
3.1. 恢复备份后建议执行的步骤
Re-synchronize your SUSE Multi-Linux Manager repositories using either the SUSE Multi-Linux Manager Web UI, or with the
mgr-synctool at the command prompt in the container. You can choose to re-register your product, or skip the registration and SSL certificate generation sections.On the container host, check whether you need to restore
/var/lib/containers/storage/volumes/var-spacewalk/_data/packages/. If/var/lib/containers/storage/volumes/var-spacewalk/_data/packages/was not in your backup, you need to restore it. If the source repository is available, you can restore/var/lib/containers/storage/volumes/var-spacewalk/_data/packages/with a complete channel synchronization:mgrctl exec -ti -- mgr-sync refresh --refresh-channelsSchedule the re-creation of search indexes next time the
rhn-searchservice is started.此命令仅生成调试消息,而不生成错误消息。
在容器主机上执行以下命令:
mgrctl exec -ti -- rhn-search cleanindex