ページの先頭行へ戻る
Enterprise Postgres 15 オペレーターユーザーズガイド

5.11.2 ディザスタリカバリの実行

オブジェクトストレージに格納されたバックアップデータを利用して、リストア元と異なるOCP環境にリストアする手順を説明します。

5.11.2.1 リソースの事前作成

5.11.2.1.1 CAファイル(ルート証明書)の格納

オブジェクトストレージの接続でデフォルト以外のルート証明書を利用する場合、ConfigMap に登録します。

$ oc create configmap storage-cacert --from-file=ca.crt=storage-ca.pem -n my-namespace
5.11.2.1.2 GCSレポジトリキーの格納

pgBackRestのパラメータ(repo-gcs-key)を使用する場合、GCSリポジトリキーをSecretに登録します。

$ oc create secret generic storage-key-secret --from-file=key.json=storage-key.json -n my-namespace

5.11.2.2 FEPClusterカスタムリソースの定義

FEPClusterの設定に加えて、下記のRestoreの設定を記載します。

FEPClusterカスタムリソースの定義例

apiVersion: fep.fujitsu.io/v1
kind: FEPCluster
metadata:
  …
spec:
  fepChildCrVal:
    restore: 
      pgbackrestParams: |
        repo1-type=s3
        repo1-path=/backup/cluster1
        repo1-s3-bucket=sample-bucket
        repo1-s3-endpoint=s3.ap-northeast-1.amazonaws.com
        repo1-s3-region=ap-northeast-1
        repo1-storage-ca-file=/pgbackrest/storage-certs/ca.crt
      pgbackrestKeyParams: |
        repo1-s3-key=SAMPLEKEY
        repo1-s3-key-secret=SAMPLESECRET
      caName:
       - storage-cacert
        
…

オブジェクトストレージGCSをバックアップリポジトリに利用する場合は下記のように指定します。

5.11.2.1.2 GCSレポジトリキーの格納”で作成したSecretをrepoKeySecretNameに指定します。

また、gcs-key-typeにはserviceを指定してください。

apiVersion: fep.fujitsu.io/v1
kind: FEPCluster
metadata:
  …
spec:
  fepChildeCrVal:
    backup: 
      pgbackrestParams: |
        repo1-type=gcs
        repo1-path=/backup-ct/test2
        repo1-gcs-bucket=dbaas-gcs
        repo1-gcs-endpoint=localhost
        repo1-storage-ca-file=/pgbackrest/storage-certs/ca.crt
        repo1-gcs-key=/pgbackrest/storage-key/key.json
        repo1-gcs-key-type=service
      caName:
       - storage-cacert
      repoKeySecretName:
       - storage-key-secret
…

設定値

フィールド

省略

詳細

spec.fepChildCrVal.restore

オブジェクトストレージに格納されているバックアップデータを指定してリストアする場合に定義します。

spec.fepChildCrVal.restore.pgbackrestParams

オプション

“|” 固定とし、その下の行よりpgbackrest.confで設定するパラメータを記載します。

バックアップデータが格納されているオブジェクトストレージを指定します。

デフォルト以外のルート証明書の利用が必要な場合は、下記を指定します。
repo1-storage-ca-path=/pgbackrest/storage-certs/<ファイル名>

CAファイルはConfigMapに登録し、spec.fepChildCrVal.restore.caNameにConfigMap名を記載します。

spec.fepChildCrVal.restore.pgbackrestKeyParams

オプション

“|” 固定とし、その下の行よりpgbackrest.confで設定するパラメータを記載します。このパラメータで記載された値は*****でマスクされます。パスワードなどマスクしたいパラメータを指定します。

spec.fepChildCrVal.restore.caName

オプション

システムのデフォルト以外のCAファイルを使用する場合に設定します。

作成したConfigMapの名前をリスト形式で指定します。

指定されたConfigMapは/pgbackrest/storage-certsにマウントされます。

spec.fepChildCrVal.restore.mcSpec.limits

cpu: 200m

memory: 300Mi

オプション

リストアを実行するコンテナに割り当てるCPUとメモリ

spec.fepChildCrVal.restore.mcSpec.requests

cpu: 100m

memory: 200Mi

オプション

リストアを実行するコンテナに割り当てるCPUとメモリ

spec.fepChildCrVal.restore.restoretype

latest

オプション

リストアのタイプ(latest or PITR)

spec.fepChildCrVal.restore.restoredate

オプション

spec.fepChildCrVal.restore.restoretypeが"PITR"の場合に、復元する日付を指定します。

spec.fepChildCrVal.restore.restoretime

オプション

spec.fepChildCrVal.restore.restoretypeが"PITR"の場合に、復元する時間を指定します。

spec.fepChildCrVal.restore.image

オプション

リストアを実行するコンテナのイメージ

デフォルトでは省略されています。この場合、オペレーターコンテナ環境からimageのURLが取得されます。

spec.fepChildCrVal.restore.imagePullPolicy

IfNotPresent

オプション