4. データバックアップ・リストア

4.1. 目的

本書では、Exastroシステムで利用する永続データのバックアップとリストア手順について説明します。
パブリッククラウドの仕組みにより、データバックアップの仕組みが利用可能であればそちらを利用しても問題ありません。

4.2. 前提条件

本頁で紹介するバックアップ・リストア手順では、下記の前提条件を満たしている必要があります。

4.2.1. 条件

  • 下記のコマンドが利用可能なこと
    • tar

    • kubectl

  • 作業環境のサーバで充分なディスクの空き容量があること

4.2.2. 暗号化キーのバックアップ

Exastro システムのパスワードや認証情報といった機密情報はすべて暗号化されています。
必ず、下記で取得した暗号化キーをバックアップして、適切に保管してください。

危険

暗号化キーを紛失した場合、バックアップデータからシステムを復旧した際にデータの復号ができなくなります。
リスト 4.1 コマンド
# Exastro IT Automation ENCRYPT_KEY
kubectl get secret ita-secret-ita-global -n exastro -o jsonpath='{.data.ENCRYPT_KEY}' | base64 -d
リスト 4.2 出力結果
JnIoXzJtPic2MXFqRl1yI1chMj8hWzQrNypmVn41Pk8=
リスト 4.3 コマンド
# Exastro Platform ENCRYPT_KEY
kubectl get secret platform-secret-pf-global -n exastro -o jsonpath='{.data.ENCRYPT_KEY}' | base64 -d
リスト 4.4 出力結果
bHFZe2VEVVM2PmFeQDMqNG4oZT4lTlglLjJJekxBTHE=

4.3. 概要

バックアップ・リストア対象となるデータは下記の3つです。
  • バックアップ・リストア対象
    • Exastro Platform のデータベース

    • Exastro IT Automation のデータベース

    • Exastro IT Automation の共有ファイル

これらのデータを kubectl コマンドを利用してバックアップ・リストアします。
作業の流れは、まず、ユーザからのデータの書き込みを制限するために、リバースプロキシを停止します。
次にバックヤード処理を停止し、データのバックアップを実施します。
最後に、作業前の数に Pod 数を戻します。
リストアの際の作業も同様の流れになります。

危険

本手順では、サービスの停止が発生します。

4.4. バックアップ

4.4.1. サービス停止

  1. Pod 起動数の確認

    作業前の Pod 起動数の確認をし、状態を記録します。
    リスト 4.5 コマンド
    RS_AE=`kubectl get deploy ita-by-ansible-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ALRV=`kubectl get deploy ita-by-ansible-legacy-role-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ATS=`kubectl get deploy ita-by-ansible-towermaster-sync -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CS=`kubectl get deploy ita-by-conductor-synchronize -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_MC=`kubectl get deploy ita-by-menu-create -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_PA=`kubectl get deploy platform-auth -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    RS_ALV=`kubectl get deploy ita-by-ansible-legacy-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_APV=`kubectl get deploy ita-by-ansible-pioneer-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CFI=`kubectl get deploy ita-by-cicd-for-iac -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CR=`kubectl get deploy ita-by-conductor-regularly -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_COL=`kubectl get deploy ita-by-collector -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_EEI=`kubectl get deploy ita-by-excel-export-import -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_HS=`kubectl get deploy ita-by-hostgroup-split -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_MEI=`kubectl get deploy ita-by-menu-export-import -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCE=`kubectl get deploy ita-by-terraform-cli-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCV=`kubectl get deploy ita-by-terraform-cli-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCEE=`kubectl get deploy ita-by-terraform-cloud-ep-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCEV=`kubectl get deploy ita-by-terraform-cloud-ep-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    
  2. リバースプロキシの停止

    リバースプロキシ (platform-auth) の Pod 起動数を 0 に変更し、エンドユーザーからのアクセスを制限します。
    リスト 4.6 コマンド
    kubectl scale deployment platform-auth -n exastro --replicas=0
    
  3. バックヤード処理の停止

    バックヤード処理 (ita-by-***) の Pod 起動数を 0 に変更し、データベースの更新を停止します。
    リスト 4.7 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=0
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=0
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=0
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    kubectl scale deployment ita-by-ansible-legacy-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-pioneer-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-cicd-for-iac -n exastro --replicas=0
    kubectl scale deployment ita-by-collector -n exastro --replicas=0
    kubectl scale deployment ita-by-conductor-regularly -n exastro --replicas=0
    kubectl scale deployment ita-by-excel-export-import -n exastro --replicas=0
    kubectl scale deployment ita-by-hostgroup-split -n exastro --replicas=0
    kubectl scale deployment ita-by-menu-export-import -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cli-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cli-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cloud-ep-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cloud-ep-vars-listup -n exastro --replicas=0
    
  4. Pod 起動数の確認

    上記で停止した対象の Pod 数が 0 になっていることを確認
    リスト 4.8 コマンド
    kubectl get deployment -n exastro
    
    リスト 4.9 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    mariadb                                  1/1     1            1           3h41m
    ita-web-server                           1/1     1            1           3h41m
    platform-web                             1/1     1            1           3h41m
    ita-api-admin                            1/1     1            1           3h41m
    ita-api-organization                     1/1     1            1           3h41m
    platform-api                             1/1     1            1           3h41m
    keycloak                                 1/1     1            1           3h41m
    ita-by-menu-create                       0/0     0            0           3h41m
    ita-by-ansible-execute                   0/0     0            0           3h41m
    ita-by-ansible-legacy-role-vars-listup   0/0     0            0           3h41m
    ita-by-ansible-towermaster-sync          0/0     0            0           3h41m
    ita-by-conductor-synchronize             0/0     0            0           3h41m
    platform-auth                            0/0     0            0           3h41m
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に確認してください。
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    ita-by-ansible-legacy-vars-listup        0/0     0            0           3h41m
    ita-by-ansible-pioneer-vars-listup       0/0     0            0           3h41m
    ita-by-cicd-for-iac                      0/0     0            0           3h41m
    ita-by-collector                         0/0     0            0           3h41m
    ita-by-conductor-regularly               0/0     0            0           3h41m
    ita-by-excel-export-import               0/0     0            0           3h41m
    ita-by-hostgroup-split                   0/0     0            0           3h41m
    ita-by-menu-export-import                0/0     0            0           3h41m
    ita-by-terraform-cli-execute             0/0     0            0           3h41m
    ita-by-terraform-cli-vars-listup         0/0     0            0           3h41m
    ita-by-terraform-cloud-ep-execute        0/0     0            0           3h41m
    ita-by-terraform-cloud-ep-vars-listup    0/0     0            0           3h41m
    

4.4.2. バックアップ

Exastro システム内で、Exastro Platform と Exastro IT Automation でデータベースを共有するか、分離するかによって手順が異なります。
  1. メンテナンス用コンテナの作成

    バックアップ作業用コンテナの作成をします。
    リスト 4.10 コマンド
     1cat <<_EOF_ | kubectl apply -f - -n exastro
     2apiVersion: v1
     3kind: Pod
     4metadata:
     5  name: exastro-maintenance
     6  namespace: exastro
     7spec:
     8  containers:
     9  - command:
    10    - sh
    11    - -c
    12    args:
    13    - |
    14      #!/bin/bash
    15      sleep 3600
    16    env:
    17    - name: PF_DB_DATABASE
    18      valueFrom:
    19        configMapKeyRef:
    20          key: DB_DATABASE
    21          name: platform-params-pf-database
    22    - name: PF_DB_HOST
    23      valueFrom:
    24        configMapKeyRef:
    25          key: DB_HOST
    26          name: platform-params-pf-database
    27    - name: PF_DB_PORT
    28      valueFrom:
    29        configMapKeyRef:
    30          key: DB_PORT
    31          name: platform-params-pf-database
    32    - name: PF_DB_ADMIN_PASSWORD
    33      valueFrom:
    34        secretKeyRef:
    35          key: DB_ADMIN_PASSWORD
    36          name: platform-secret-pf-database
    37    - name: PF_DB_ADMIN_USER
    38      valueFrom:
    39        secretKeyRef:
    40          key: DB_ADMIN_USER
    41          name: platform-secret-pf-database
    42    - name: ITA_DB_DATABASE
    43      valueFrom:
    44        configMapKeyRef:
    45          key: DB_DATABASE
    46          name: ita-params-ita-database
    47    - name: ITA_DB_HOST
    48      valueFrom:
    49        configMapKeyRef:
    50          key: DB_HOST
    51          name: ita-params-ita-database
    52    - name: ITA_DB_PORT
    53      valueFrom:
    54        configMapKeyRef:
    55          key: DB_PORT
    56          name: ita-params-ita-database
    57    - name: ITA_STORAGEPATH
    58      valueFrom:
    59        configMapKeyRef:
    60          key: STORAGEPATH
    61          name: ita-params-ita-global
    62    - name: ITA_DB_ADMIN_PASSWORD
    63      valueFrom:
    64        secretKeyRef:
    65          key: DB_ADMIN_PASSWORD
    66          name: ita-secret-ita-database
    67    - name: ITA_DB_ADMIN_USER
    68      valueFrom:
    69        secretKeyRef:
    70          key: DB_ADMIN_USER
    71          name: ita-secret-ita-database
    72    image: mariadb:10.9
    73    imagePullPolicy: IfNotPresent
    74    name: exastro-maintenance
    75    resources: {}
    76    securityContext:
    77      allowPrivilegeEscalation: false
    78      readOnlyRootFilesystem: false
    79      runAsGroup: 1000
    80      runAsNonRoot: true
    81      runAsUser: 1000
    82    volumeMounts:
    83    - mountPath: /storage
    84      name: volume-ita-backup-storage
    85  volumes:
    86  - name: volume-ita-backup-storage
    87    persistentVolumeClaim:
    88      claimName: pvc-ita-global
    89  restartPolicy: Always
    90  securityContext: {}
    91  serviceAccount: default
    92  serviceAccountName: default
    93_EOF_
    
  2. データベースのバックアップ取得

    データベースに対して mysqldump バックアップを取得します。
    Exastro Platform と Exastro IT Automation でデータベースサーバを共有するか、分離するかによって手順が異なります。
    リスト 4.11 アプリケーション用データベースバックアップコマンド
    kubectl exec -it exastro-maintenance -n exastro -- sh -c 'mysqldump -h ${PF_DB_HOST} -P ${PF_DB_PORT} -u ${PF_DB_ADMIN_USER} -p${PF_DB_ADMIN_PASSWORD} --all-databases --add-drop-table' | gzip > exastro_mysqldump_platform_db_`date +"%Y%m%d-%H%M%S"`.sql.gz
    
    リスト 4.12 ユーザ用データベースバックアップコマンド
    kubectl exec -it exastro-maintenance -n exastro -- sh -c 'mysqldump -h ${PF_DB_HOST} -P ${PF_DB_PORT} -u ${PF_DB_ADMIN_USER} -p${PF_DB_ADMIN_PASSWORD} --allow-keywords mysql' | gzip > exastro_mysqldump_platform_user_`date +"%Y%m%d-%H%M%S"`.sql.gz
    
  3. ファイルのバックアップ取得

    Exastro IT Automation のファイルのバックアップを取得します。
    リスト 4.17 コマンド
    kubectl exec -i exastro-maintenance -n exastro -- sh -c 'tar zcvf - ${ITA_STORAGEPATH}' > exastro_storage_backup_ita_`date +"%Y%m%d-%H%M%S"`.tar.gz
    
  4. メンテナンス用コンテナの削除

    バックアップ作業用コンテナの作成をします。
    リスト 4.18 コマンド
    kubectl delete pod exastro-maintenance -n exastro
    

4.4.3. サービス再開

  1. サービス再開

    サービス停止時に取得した各 Deployment の Pod 起動数を元に戻します。
    リスト 4.19 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=${RS_AE}
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=${RS_ALRV}
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=${RS_ATS}
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=${RS_CS}
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=${RS_MC}
    kubectl scale deployment platform-auth -n exastro --replicas=${RS_PA}
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    kubectl scale deployment ita-by-ansible-legacy-vars-listup -n exastro --replicas=${RS_ALV}
    kubectl scale deployment ita-by-ansible-pioneer-vars-listup -n exastro --replicas=${RS_APV}
    kubectl scale deployment ita-by-cicd-for-iac -n exastro --replicas=${RS_CFI}
    kubectl scale deployment ita-by-conductor-regularly -n exastro --replicas=${RS_CR}
    kubectl scale deployment ita-by-collector -n exastro --replicas=${RS_COL}
    kubectl scale deployment ita-by-excel-export-import -n exastro --replicas=${RS_EEI}
    kubectl scale deployment ita-by-hostgroup-split -n exastro --replicas=${RS_HS}
    kubectl scale deployment ita-by-menu-export-import -n exastro --replicas=${RS_MEI}
    kubectl scale deployment ita-by-terraform-cli-execute -n exastro --replicas=${RS_TCE}
    kubectl scale deployment ita-by-terraform-cli-vars-listup -n exastro --replicas=${RS_TCV}
    kubectl scale deployment ita-by-terraform-cloud-ep-execute -n exastro --replicas=${RS_TCEE}
    kubectl scale deployment ita-by-terraform-cloud-ep-vars-listup -n exastro --replicas=${RS_TCEV}
    
  2. Pod 起動数の確認

    上記で起動した対象の Pod 数が元に戻りすべて READY になっていることを確認
    リスト 4.20 コマンド
    kubectl get deployment -n exastro
    
    リスト 4.21 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    ita-api-admin-7c78cc475-xt8kh                             1/1     Running     0             47m
    ita-api-organization-f4bccc5c4-8txpj                      1/1     Running     0             47m
    ita-by-ansible-execute-666d5bdf86-bt94w                   1/1     Running     0             47m
    ita-by-ansible-legacy-role-vars-listup-79c5cfdf7c-wntg5   1/1     Running     0             47m
    ita-by-ansible-legacy-vars-listup-7b7f5fb88c-nqzrd        1/1     Running     0             47m
    ita-by-ansible-pioneer-vars-listup-5d5f5b589-d4hn9        1/1     Running     0             47m
    ita-by-ansible-towermaster-sync-548bd8c867-2vp9z          1/1     Running     0             47m
    ita-by-cicd-for-iac-558986b4c5-fk7bh                      1/1     Running     0             47m
    ita-by-collector-59ff796d8c-xc4dx                         1/1     Running     0             47m
    ita-by-conductor-regularly-b5c5dd6dc-7t8km                1/1     Running     0             47m
    ita-by-conductor-synchronize-787f9fd8f7-mxsw6             1/1     Running     0             47m
    ita-by-excel-export-import-66db589589-xv5zz               1/1     Running     0             47m
    ita-by-hostgroup-split-8459fb48fc-ltrtb                   1/1     Running     0             47m
    ita-by-menu-create-5bc6849cd5-xkm6r                       1/1     Running     0             47m
    ita-by-menu-export-import-84ccc5467-9fnb8                 1/1     Running     0             47m
    ita-by-terraform-cli-execute-695ffbd4c-pqkwj              1/1     Running     0             47m
    ita-by-terraform-cli-vars-listup-6dcccf9585-nxbkj         1/1     Running     0             47m
    ita-by-terraform-cloud-ep-execute-7bbfcd6f6c-fkqpd        1/1     Running     0             47m
    ita-by-terraform-cloud-ep-vars-listup-5d4c7c94ff-7gmsk    1/1     Running     0             47m
    ita-migration-1.0.5-iql5                                  0/1     Completed   0             47m
    ita-web-server-75f8c85f7c-vvkp5                           1/1     Running     0             47m
    keycloak-9d464565b-zwq6b                                  1/1     Running     0             47m
    platform-api-57bff76cc-fmdcn                              1/1     Running     0             47m
    platform-auth-54c7f8bcc8-lmgv6                            1/1     Running     0             47m
    platform-migration-1.4.3-gs4x                             0/1     Completed   0             47m
    platform-web-7d74bb98d-srtdp                              1/1     Running     0             47m
    

4.5. リストア

4.5.1. サービス停止

  1. Pod 起動数の確認

    作業前の Pod 起動数の確認をし、状態を記録します。
    リスト 4.22 コマンド
    RS_AE=`kubectl get deploy ita-by-ansible-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ALRV=`kubectl get deploy ita-by-ansible-legacy-role-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ATS=`kubectl get deploy ita-by-ansible-towermaster-sync -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CS=`kubectl get deploy ita-by-conductor-synchronize -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_MC=`kubectl get deploy ita-by-menu-create -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_PA=`kubectl get deploy platform-auth -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    RS_ALV=`kubectl get deploy ita-by-ansible-legacy-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_APV=`kubectl get deploy ita-by-ansible-pioneer-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CFI=`kubectl get deploy ita-by-cicd-for-iac -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CR=`kubectl get deploy ita-by-conductor-regularly -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_COL=`kubectl get deploy ita-by-collector -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_EEI=`kubectl get deploy ita-by-excel-export-import -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_HS=`kubectl get deploy ita-by-hostgroup-split -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_MEI=`kubectl get deploy ita-by-menu-export-import -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCE=`kubectl get deploy ita-by-terraform-cli-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCV=`kubectl get deploy ita-by-terraform-cli-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCEE=`kubectl get deploy ita-by-terraform-cloud-ep-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_TCEV=`kubectl get deploy ita-by-terraform-cloud-ep-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    
  2. リバースプロキシの停止

    リバースプロキシ (platform-auth) の Pod 起動数を 0 に変更し、エンドユーザーからのアクセスを制限します。
    リスト 4.23 コマンド
    kubectl scale deployment platform-auth -n exastro --replicas=0
    
  3. バックヤード処理の停止

    バックヤード処理 (ita-by-***) の Pod 起動数を 0 に変更し、データベースの更新を停止します。
    リスト 4.24 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=0
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=0
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=0
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    kubectl scale deployment ita-by-ansible-legacy-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-pioneer-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-cicd-for-iac -n exastro --replicas=0
    kubectl scale deployment ita-by-collector -n exastro --replicas=0
    kubectl scale deployment ita-by-conductor-regularly -n exastro --replicas=0
    kubectl scale deployment ita-by-excel-export-import -n exastro --replicas=0
    kubectl scale deployment ita-by-hostgroup-split -n exastro --replicas=0
    kubectl scale deployment ita-by-menu-export-import -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cli-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cli-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cloud-ep-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-terraform-cloud-ep-vars-listup -n exastro --replicas=0
    
  4. Pod 起動数の確認

    上記で停止した対象の Pod 数が 0 になっていることを確認
    リスト 4.25 コマンド
    kubectl get deployment -n exastro
    
    リスト 4.26 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    mariadb                                  1/1     1            1           3h41m
    ita-web-server                           1/1     1            1           3h41m
    platform-web                             1/1     1            1           3h41m
    ita-api-admin                            1/1     1            1           3h41m
    ita-api-organization                     1/1     1            1           3h41m
    platform-api                             1/1     1            1           3h41m
    keycloak                                 1/1     1            1           3h41m
    ita-by-menu-create                       0/0     0            0           3h41m
    ita-by-ansible-execute                   0/0     0            0           3h41m
    ita-by-ansible-legacy-role-vars-listup   0/0     0            0           3h41m
    ita-by-ansible-towermaster-sync          0/0     0            0           3h41m
    ita-by-conductor-synchronize             0/0     0            0           3h41m
    platform-auth                            0/0     0            0           3h41m
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に確認してください。
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    ita-by-ansible-legacy-vars-listup        0/0     0            0           3h41m
    ita-by-ansible-pioneer-vars-listup       0/0     0            0           3h41m
    ita-by-cicd-for-iac                      0/0     0            0           3h41m
    ita-by-collector                         0/0     0            0           3h41m
    ita-by-conductor-regularly               0/0     0            0           3h41m
    ita-by-excel-export-import               0/0     0            0           3h41m
    ita-by-hostgroup-split                   0/0     0            0           3h41m
    ita-by-menu-export-import                0/0     0            0           3h41m
    ita-by-terraform-cli-execute             0/0     0            0           3h41m
    ita-by-terraform-cli-vars-listup         0/0     0            0           3h41m
    ita-by-terraform-cloud-ep-execute        0/0     0            0           3h41m
    ita-by-terraform-cloud-ep-vars-listup    0/0     0            0           3h41m
    

4.5.2. リストア

Exastro システム内で、Exastro Platform と Exastro IT Automation でデータベースを共有するか、分離するかによって手順が異なります。
  1. メンテナンス用コンテナの作成

    リストア作業用コンテナの作成をします。
    リスト 4.27 コマンド
     1cat <<_EOF_ | kubectl apply -f - -n exastro
     2apiVersion: v1
     3kind: Pod
     4metadata:
     5  name: exastro-maintenance
     6  namespace: exastro
     7spec:
     8  containers:
     9  - command:
    10    - sh
    11    - -c
    12    args:
    13    - |
    14      #!/bin/bash
    15      sleep 3600
    16    env:
    17    - name: PF_DB_DATABASE
    18      valueFrom:
    19        configMapKeyRef:
    20          key: DB_DATABASE
    21          name: platform-params-pf-database
    22    - name: PF_DB_HOST
    23      valueFrom:
    24        configMapKeyRef:
    25          key: DB_HOST
    26          name: platform-params-pf-database
    27    - name: PF_DB_PORT
    28      valueFrom:
    29        configMapKeyRef:
    30          key: DB_PORT
    31          name: platform-params-pf-database
    32    - name: PF_DB_ADMIN_PASSWORD
    33      valueFrom:
    34        secretKeyRef:
    35          key: DB_ADMIN_PASSWORD
    36          name: platform-secret-pf-database
    37    - name: PF_DB_ADMIN_USER
    38      valueFrom:
    39        secretKeyRef:
    40          key: DB_ADMIN_USER
    41          name: platform-secret-pf-database
    42    - name: ITA_DB_DATABASE
    43      valueFrom:
    44        configMapKeyRef:
    45          key: DB_DATABASE
    46          name: ita-params-ita-database
    47    - name: ITA_DB_HOST
    48      valueFrom:
    49        configMapKeyRef:
    50          key: DB_HOST
    51          name: ita-params-ita-database
    52    - name: ITA_DB_PORT
    53      valueFrom:
    54        configMapKeyRef:
    55          key: DB_PORT
    56          name: ita-params-ita-database
    57    - name: ITA_STORAGEPATH
    58      valueFrom:
    59        configMapKeyRef:
    60          key: STORAGEPATH
    61          name: ita-params-ita-global
    62    - name: ITA_DB_ADMIN_PASSWORD
    63      valueFrom:
    64        secretKeyRef:
    65          key: DB_ADMIN_PASSWORD
    66          name: ita-secret-ita-database
    67    - name: ITA_DB_ADMIN_USER
    68      valueFrom:
    69        secretKeyRef:
    70          key: DB_ADMIN_USER
    71          name: ita-secret-ita-database
    72    image: mariadb:10.9
    73    imagePullPolicy: IfNotPresent
    74    name: exastro-maintenance
    75    resources: {}
    76    securityContext:
    77      allowPrivilegeEscalation: false
    78      readOnlyRootFilesystem: false
    79      runAsGroup: 1000
    80      runAsNonRoot: true
    81      runAsUser: 1000
    82    volumeMounts:
    83    - mountPath: /storage
    84      name: volume-ita-backup-storage
    85  volumes:
    86  - name: volume-ita-backup-storage
    87    persistentVolumeClaim:
    88      claimName: pvc-ita-global
    89  restartPolicy: Always
    90  securityContext: {}
    91  serviceAccount: default
    92  serviceAccountName: default
    93_EOF_
    
  2. データベースのリストア実施

    データベースに対して mysqldump リストアを実施します。
    Exastro Platform と Exastro IT Automation でデータベースサーバを共有するか、分離するかによって手順が異なります。
    リスト 4.28 ユーザ用データベースリストアコマンド
    gzip -dc exastro_mysqldump_platform_user_YYYYMMDD-HHmmss.sql.gz | kubectl exec -i exastro-maintenance -n exastro -- sh -c 'mysql -h ${PF_DB_HOST} -P ${PF_DB_PORT} -u ${PF_DB_ADMIN_USER} -p${PF_DB_ADMIN_PASSWORD} mysql'
    
    リスト 4.29 アプリケーション用データベースリストアコマンド
    gzip -dc exastro_mysqldump_platform_db_YYYYMMDD-HHmmss.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/'| kubectl exec -i exastro-maintenance -n exastro -- sh -c 'mysql -h ${PF_DB_HOST} -P ${PF_DB_PORT} -u ${PF_DB_ADMIN_USER} -p${PF_DB_ADMIN_PASSWORD}'
    
  3. ファイルのリストア実施

    Exastro IT Automation のファイルのバックアップを取得します。
    リスト 4.34 コマンド
    kubectl exec -i exastro-maintenance -n exastro -- sh -c 'tar zxvf - -C ${ITA_STORAGEPATH}' < exastro_storage_backup_ita_YYYYMMDD-HHmmss.tar.gz
    
  4. メンテナンス用コンテナの削除

    バックアップ作業用コンテナの作成をします。
    リスト 4.35 コマンド
    kubectl delete pod exastro-maintenance -n exastro
    

4.5.3. サービス再開

  1. サービス再開

    サービス停止時に取得した各 Deployment の Pod 起動数を元に戻します。
    リスト 4.36 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=${RS_AE}
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=${RS_ALRV}
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=${RS_ATS}
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=${RS_CS}
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=${RS_MC}
    kubectl scale deployment platform-auth -n exastro --replicas=${RS_PA}
    
    以下はITA2.1.0以降からITA2.1.1以降にバージョンアップする際に実行してください。
    kubectl scale deployment ita-by-ansible-legacy-vars-listup -n exastro --replicas=${RS_ALV}
    kubectl scale deployment ita-by-ansible-pioneer-vars-listup -n exastro --replicas=${RS_APV}
    kubectl scale deployment ita-by-cicd-for-iac -n exastro --replicas=${RS_CFI}
    kubectl scale deployment ita-by-conductor-regularly -n exastro --replicas=${RS_CR}
    kubectl scale deployment ita-by-collector -n exastro --replicas=${RS_COL}
    kubectl scale deployment ita-by-excel-export-import -n exastro --replicas=${RS_EEI}
    kubectl scale deployment ita-by-hostgroup-split -n exastro --replicas=${RS_HS}
    kubectl scale deployment ita-by-menu-export-import -n exastro --replicas=${RS_MEI}
    kubectl scale deployment ita-by-terraform-cli-execute -n exastro --replicas=${RS_TCE}
    kubectl scale deployment ita-by-terraform-cli-vars-listup -n exastro --replicas=${RS_TCV}
    kubectl scale deployment ita-by-terraform-cloud-ep-execute -n exastro --replicas=${RS_TCEE}
    kubectl scale deployment ita-by-terraform-cloud-ep-vars-listup -n exastro --replicas=${RS_TCEV}
    
  2. Pod 起動数の確認

    上記で起動した対象の Pod 数が元に戻りすべて READY になっていることを確認
    リスト 4.37 コマンド
    kubectl get deployment -n exastro
    
    リスト 4.38 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    ita-api-admin-7c78cc475-xt8kh                             1/1     Running     0             47m
    ita-api-organization-f4bccc5c4-8txpj                      1/1     Running     0             47m
    ita-by-ansible-execute-666d5bdf86-bt94w                   1/1     Running     0             47m
    ita-by-ansible-legacy-role-vars-listup-79c5cfdf7c-wntg5   1/1     Running     0             47m
    ita-by-ansible-legacy-vars-listup-7b7f5fb88c-nqzrd        1/1     Running     0             47m
    ita-by-ansible-pioneer-vars-listup-5d5f5b589-d4hn9        1/1     Running     0             47m
    ita-by-ansible-towermaster-sync-548bd8c867-2vp9z          1/1     Running     0             47m
    ita-by-cicd-for-iac-558986b4c5-fk7bh                      1/1     Running     0             47m
    ita-by-collector-59ff796d8c-xc4dx                         1/1     Running     0             47m
    ita-by-conductor-regularly-b5c5dd6dc-7t8km                1/1     Running     0             47m
    ita-by-conductor-synchronize-787f9fd8f7-mxsw6             1/1     Running     0             47m
    ita-by-excel-export-import-66db589589-xv5zz               1/1     Running     0             47m
    ita-by-hostgroup-split-8459fb48fc-ltrtb                   1/1     Running     0             47m
    ita-by-menu-create-5bc6849cd5-xkm6r                       1/1     Running     0             47m
    ita-by-menu-export-import-84ccc5467-9fnb8                 1/1     Running     0             47m
    ita-by-terraform-cli-execute-695ffbd4c-pqkwj              1/1     Running     0             47m
    ita-by-terraform-cli-vars-listup-6dcccf9585-nxbkj         1/1     Running     0             47m
    ita-by-terraform-cloud-ep-execute-7bbfcd6f6c-fkqpd        1/1     Running     0             47m
    ita-by-terraform-cloud-ep-vars-listup-5d4c7c94ff-7gmsk    1/1     Running     0             47m
    ita-migration-1.0.5-iql5                                  0/1     Completed   0             47m
    ita-web-server-75f8c85f7c-vvkp5                           1/1     Running     0             47m
    keycloak-9d464565b-zwq6b                                  1/1     Running     0             47m
    platform-api-57bff76cc-fmdcn                              1/1     Running     0             47m
    platform-auth-54c7f8bcc8-lmgv6                            1/1     Running     0             47m
    platform-migration-1.4.3-gs4x                             0/1     Completed   0             47m
    platform-web-7d74bb98d-srtdp                              1/1     Running     0             47m
    

4.6. トラブルシューティング

4.6.1. リストア後に500エラーが発生する

  • 事象

リストア作業実施後に画面にて、500エラーが発生する。
  • 対処

全リソースを一度削除した後、再度 helm install コマンドによりインストールを実施してください。