バックアップと復元

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インストールを定期的にバックアップして、データ損失を防止し、迅速に回復できるようにしてください。

使用するバックアップ方法にかかわらず、現在のインストールで使用している容量の3 倍以上の空き容量が必要です。 容量が不足するとバックアップが失敗する可能性があるため、頻繁に確認してください。

1. smdbaを使用した古い方法を無効にする

SUSE Multi-Linux Manager 5.1を最初からインストールした場合は、このセクションをスキップしてください。

With the advent of the built-in solution, the old method with the smdba backup tool is deprecated. If you migrated from an old system with smdba to the new solution, you must disable the old funtionality and remove the old backup archives.

Either disable smdba before migrating (recommended) or later on the migrated SUSE Multi-Linux Manager 5.1 system.

プロシージャ: 移行前にインストール済みのsmdbaを使用した古い方法を無効にする

このプロシージャは、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=off

This will change archive_command in /var/lib/pgsql/data/postgresql.conf as follows:

archive_command = '/bin/true'

これで、古いシステムをSUSE Multi-Linux Manager 5.1に移行する準備が整いました。

プロシージャ: 移行後にSUSE Multi-Linux Manager 5.1における古い方法を無効にする

smdbaが利用できなくなっている場合は、移行後にこのプロシージャを使用します。

  1. On the container host, as root, edit /var/lib/containers/storage/volumes/var-pgsql/_data/postgresql.conf and set these options:

    archive_mode = off
    archive_command = '/bin/true'
  2. コンテナを再起動します。

    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サービスは自動的に停止されます。 このダウンタイムは長くなる可能性があります。 バックアップが完了すると、サービスは自動的に再開されます。

Procedure: Creating full backup with mgradm backup create
  1. コンテナホストで、rootとして、次のコマンドでバックアップを作成します。

    mgradm backup create $path

    Replace $path by 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サービスを停止せずにバックアップが作成され、2段階バックアップ手順の1段階として機能します。

部分バックアップはデータの一部のみを対象としており、バックアップされていない可能性のある他の部分との潜在的な依存関係を考慮していません。 したがって、バックアップ/復元の一貫性を保証できません。

プロシージャ: データベースバックアップをスキップして部分バックアップを作成する
  1. コンテナホストで、rootとして、次のコマンドでバックアップを作成します。

    mgradm backup create --skipdatabase $path

    Replace $path by the path to the backup location.

プロシージャ: ボリュームをスキップして部分バックアップを作成する
  1. コンテナホストで、rootとして、次のコマンドでバックアップを作成します。

    mgradm backup create --skipvolumes $volumes $path

    Replace $path by the path to the backup location.

    Replace $volumes by the name of the volume name to be excluded from the backup, or by a comma separated list of volumes to be excluded.

    Use all to 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.

プロシージャ: 追加のカスタムボリュームを使用したバックアップの作成
  1. コンテナホストで、rootとして、次のコマンドでバックアップを作成します。

    mgradm backup create --extravolumes $volume $path

    Replace $path by the path to the backup location.

    Replace $volumes by 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. データベースの手動バックアップの実行

プロシージャ: データベースの手動バックアップの実行
  1. バックアップ用に永続的なストレージ容量を割り当てます。

  2. 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サービスは、バックアップの復元が完了した後で、自動的に開始されません。

プロシージャ: 既存のバックアップからの復元
  1. コンテナホストで、rootとして、次のコマンドを使用してSUSE Multi-Linux Managerサーバを再配備します。

    mgradm stop
    mgradm backup restore $path
    mgradm start

    Replace $path by 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. バックアップ復元後の推奨されるステップ

プロシージャ: SUSE Multi-Linux Managerの復元後の推奨されるステップ
  1. Re-synchronize your SUSE Multi-Linux Manager repositories using either the SUSE Multi-Linux Manager Web UI, or with the mgr-sync tool at the command prompt in the container. You can choose to re-register your product, or skip the registration and SSL certificate generation sections.

  2. 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-channels
  3. Schedule the re-creation of search indexes next time the rhn-search service is started.

    このコマンドはデバッグメッセージのみを生成し、エラーメッセージを生成しません。

    コンテナホストで、次のコマンドを入力します。

    mgrctl exec -ti -- rhn-search cleanindex