Documentation survey

バックアップと復元

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.

Because SUSE Multi-Linux Manager relies on a database as well as the installed program and configurations, it is important to back up all components of your installation. Back up your SUSE Multi-Linux Manager installation regularly to prevent data loss and enable quick recovery.

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

1. Disable old method with smdba

Skip this section if you installed SUSE Multi-Linux Manager 5.1 from scratch.

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.

Procedure: Disabling old method with installed smdba before migration

This procedure only works when smdba is still installed.

Commands are different on SUSE Manager 4.3 (non-containerized installation) or SUSE Manager 5.0 (containerized installation) present (so 5.0 or on 4.3 before migration):

SUSE Manager 4.3

On the command line, as root, execute:

smdba backup-hot --enable=off
SUSE Manager 5.0

On the command line of the container host, as root, execute:

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'

Now your old system is ready to be migrated to SUSE Multi-Linux Manager 5.1.

Procedure: Disabling old method on SUSE Multi-Linux Manager 5.1 after migration

Use this procedure after migration, when smdba is no longer available.

  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. Restart the container:

    mgradm restart

2. SUSE Multi-Linux Managerのバックアップ

SUSE Multi-Linux Managerのインストールをバックアップする最も包括的な方法は、mgradm backup createコマンドを使用することです。 これにより、バックアップの管理にかかる時間を節約でき、障害発生時に再インストールと再同期をより速く実行できます。 ただし、この方法ではディスク領域がかなり必要になるため、バックアップの実行に時間がかかることがあります。

mgradm backup createコマンドは、ディレクトリへのバックアップを実行します。 このディレクトリは、ローカルストレージでもマウントされたリモートストレージでも構いません。

mgradm backup createコマンドは、バックアップの内容をさまざまな方法でカスタマイズできます。 利用可能なすべてのオプションについては、mgradm backup create --helpを参照してください。

2.1. Full backup of SUSE Multi-Linux Manager

SUSE Multi-Linux Managerのフルバックアップは、次のコンポーネントのバックアップで構成されます。

  • SUSE Multi-Linux Managerボリューム

  • データベースボリューム

  • podmanネットワーク設定

  • podmanシークレット

  • SUSE Multi-Linux Manager systemdサービス

  • SUSE Multi-Linux Managerコンテナイメージ

The SUSE Multi-Linux Manager service is automatically stopped for the time it takes to create a full backup. The downtime can be significant. After backup is done, service is automatically restarted.

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

    mgradm backup create $path

    $pathをバックアップ場所へのパスで置き換えます。

2.2. Partial backup of SUSE Multi-Linux Manager

mgradm backup createツールを使用すると部分バックアップを作成できます。 個々のボリュームまたはすべてのボリュームをスキップしたり、データベースのバックアップやイメージをスキップしたりすることができます。

特にデータベースのバックアップがスキップされた場合、SUSE Multi-Linux Managerサービスを停止せずにバックアップが作成され、2段階バックアップ手順の1段階として機能します。

Partial backups are only considering a part of the data, and do not take potential dependencies with other parts which may not have been backed up in consideration. Therefore they cannot guarantee backup/restore consistency.

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

    mgradm backup create --skipdatabase $path

    $pathをバックアップ場所へのパスで置き換えます。

Procedure: Creating partial backup by skipping a volume
  1. コンテナホストで、rootとして、次のコマンドでバックアップを作成します。

    mgradm backup create --skipvolumes $volumes $path

    $pathをバックアップ場所へのパスで置き換えます。

    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.

    allを使用すると、データベースボリュームを除くすべてのボリュームをスキップします。

2.3. 追加ボリュームのバックアップ

mgradm backupコマンドは、SUSE Multi-Linux Managerボリュームの内部リストを使用します。 インストール中に追加のボリュームが設定された場合、またはバックアップに追加のボリュームを追加する必要がある場合は、--extravolumes $volumesを使用して指定する必要があります。

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

    mgradm backup create --extravolumes $volume $path

    $pathをバックアップ場所へのパスで置き換えます。

    $volumesを、バックアップに含めるボリュームの名前、または含めるボリュームのカンマ区切りのリストで置き換えます。

2.4. Perform a manual database backup

Procedure: Performing a manual database backup
  1. バックアップ用に永続的なストレージ容量を割り当てます。

  2. SUSE Multi-Linux Managerコンテナホストのコマンドプロンプトで、rootとして次のコマンドを使用します。

    mgradm backup create --skipvolumes all --skipconfig --skipimages $path

3. Restore SUSE Multi-Linux Manager from the existing backup

SUSE Multi-Linux Managerを既存のバックアップから復元すると、復元対象のボリューム、イメージ、および設定のバックアップが列挙されます。バックアップの作成シナリオとは異なり、復元操作では内部のボリュームリストを使用せず、バックアップ内に存在するすべてのボリュームまたはイメージが自動的に検出されます。

復元対象の項目のリストが収集された後で、存在と整合性のチェックが実行されます。存在チェックにより、バックアップの復元によって既存のボリューム、イメージ、または設定が誤って上書きされることが防止されます。整合性チェックは、バックアップ項目のチェックサムを計算することで実行されます。

両方のチェックが成功すると、実際のバックアップの復元が実行されます。

SUSE Multi-Linux Managerサービスは、バックアップの復元が完了した後で、自動的に開始されません。

Procedure: Restoring from an existing backup
  1. コンテナホストで、rootとして、次のコマンドを使用してSUSE Multi-Linux Managerサーバを再配備します。

    mgradm stop
    mgradm backup restore $path
    mgradm start

    $pathをバックアップ場所へのパスで置き換えます。

バックアップの検証は時間がかかる操作になる可能性があります。バックアップの整合性が他の手段で確保されている場合、--skipverifyオプションを使用することで検証をスキップできます。

何らかの理由でバックアップに存在するボリュームの復元をスキップする必要がある場合は、--skipvolumes $volumesオプションを使用できます。

Procedure: Recommended steps after SUSE Multi-Linux Manager restore
  1. SUSE Multi-Linux Manager Web UIを使用するか、コンテナ内のコマンドプロンプトでmgr-syncツールを使用して、SUSE Multi-Linux Managerリポジトリを再同期します。 製品を再登録するか、登録およびSSL証明書生成セクションをスキップするかを選択できます。

  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.

    This command produces only debug messages, it does not produce error messages.

    On the container host, enter:

    mgrctl exec -ti -- rhn-search cleanindex