レプリケートされたTimesTenデータベースのアップグレード

TimesTenデータベースのアクティブ・スタンバイ・ペアで構成される、レプリケートされたTimesTen構成をアップグレードできます。

アップグレード・プロセスでは、次のステップを実行する必要があります:
  • YAMLファイルを作成します。このファイルでは、TimesTenの新しいリリースを含むコンテナ・イメージを指定します。

  • アップグレードにhelm valuesコマンドを使用します。この例は、この方法を示しています。

この例では、new_kube_files/helm/customyamlディレクトリが作成されていることを前提としています。

ノート:

アップグレード時に、次の処理が実行されます:
  • 最初にスタンバイが終了されます。スタンバイが稼働状態に戻るまでには時間がかかります。スタンバイが再起動すると、新しいリリースにアップグレードされます。スタンバイのアップグレードの間に、レプリケーション構成によっては、アクティブ・データベースが中断される場合があります。

  • 次に、アクティブからスタンバイへのフェイルオーバーが実行されます:

    • アクティブが終了されます。前のアクティブが回復するまでに時間がかかります。アクティブが再起動すると、新しいリリースにアップグレードされます。

    • スタンバイ・データベースがアクティブに昇格され、以前のアクティブがスタンバイになります。

TimesTenがTimesTenデータベースのアクティブ・スタンバイ・ペアのアップグレードを実行する方法の詳細は、『Oracle TimesTen In-Memory Databaseインストレーション、移行およびアップグレード・ガイド』アクティブ・スタンバイ・ペア・レプリケーションを使用したアップグレードの実行を参照してください。

必ず、適切なタイミングでアップグレードを実行してください。本番の1日のうち最もビジーな時間にはアップグレードを実行しないことをお薦めします。アップグレード手順の結果として、短期間停止され、パフォーマンスが低下する場合もあります。

  1. 開発ホストで、新しいHelmチャートを含むhelmディレクトリに移動します。
    cd new_kube_files/helm
  2. YAMLファイルを作成し、そのファイルにアップグレードに使用するTimesTenイメージの名前を指定します。
    vi customyaml/upgradereplicated.yaml
    
    image:
      repository: container-registry.oracle.com/timesten/timesten
      tag: "22.1.1.28.0"
  3. アップグレードの前に、次の手順を実行します:
    1. レプリケートされたTimesTenClassicオブジェクトがネームスペースに存在することを確認します。
      kubectl get ttc 
      出力は、次のようになります。
      NAME              STATE              ACTIVE            AGE
      norepsamplehelm   AllReplicasReady   N/A               8h
      repsamplehelm     Normal             repsamplehelm-0   11h

      repsamplehelm TimesTenClassicオブジェクトが存在し、Normal状態です。

    2. イメージを確認します。
      kubectl describe ttc repsamplehelm | grep Image
      出力は、次のようになります。
      Image:       container-registry.oracle.com/timesten/timesten:22.1.1.27.0
      ...
  4. ttclassicチャートのリリースを確認します。
    helm list
    出力は、次のようになります。
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
    repsamplehelm   default         1               2024-08-04 14:58:40.109402333 +0000 UTC deployed        ttclassic-2211270.1.0   22.1.1.27.0
  5. 新しいリリースにアップグレードします。新しいリリースのttclassicチャートを使用し、新しいイメージを参照するカスタマイズされたYAMLファイルを使用します。

    ノート:

    次の構文をお薦めします。これにより、既存のカスタマイズが保持されます。
    helm get values repsamplehelm --all > prev-values-repttc.yaml
    helm upgrade -f prev-values-repttc.yaml -f customyaml/upgradereplicated.yaml  repsamplehelm ./ttclassic
    次のhelm upgradeコマンドを見てみましょう。
    • get values repsamplehelm Helmコマンドは、既存のカスタマイズを含む現在のリリースの値を取得します。このコマンドの結果は、prev-values-repttc.yamlファイルにパイプされます。このファイルには任意の名前を選択できます。

    • helm upgradeコマンドは、カスタマイズされたupgradereplicated.yamlファイルとともにprev-values-repttc.yamlファイルを使用してアップグレードを実行します。

    helm upgradeコマンドの出力を見てみましょう。

    Release "repsamplehelm" has been upgraded. Happy Helming!
    NAME: repsamplehelm
    LAST DEPLOYED: Mon Aug  5 02:25:13 2024
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    NOTES:
    Version 2211280.1.0 of the ttclassic chart has been installed.
    
    This release is named "repsamplehelm".
    
    To learn more about the release, try:
    
      $ helm status repsamplehelm
      $ helm get all repsamplehelm
      $ helm history repsamplehelm
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback repsamplehelm <REVISION>
        - run 'helm history repsamplehelm' for a list of revisions.
    次の点に注目してください。
    • repsamplehelmチャート・リリースがアップグレードされています。リリース・リビジョンは2です。

    • リリースのステータスはdeployedです。

    • ttclassicチャートのバージョンは、TimesTenリリース22.1.1.28.0に対応する2211280.1.0です。

  6. 自動アップグレードと、TimesTenClassicオブジェクトの様々な状態への遷移を確認します。
     kubectl get events -w

    出力は、次のようになります。

    11m         Normal    Upgrade                  timestenclassic/repsamplehelm   Image updated, automatic upgrade started
    11m         Normal    Upgrade                  timestenclassic/repsamplehelm   Deleted standby pod repsamplehelm-1 during upgrade
    11m         Warning   Failed                   timestenclassic/repsamplehelm   Pod repsamplehelm-1 was replaced
    11m         Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 is Not Ready
    11m         Warning   StateChange              timestenclassic/repsamplehelm   TimesTenClassic was Normal, now ActiveTakeover
    11m         Normal    StateChange              timestenclassic/repsamplehelm   TimesTenClassic was ActiveTakeover, now StandbyDown
    9m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Agent Up
    9m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Instance Exists
    9m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Daemon Down
    9m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Daemon Up
    9m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Database Unloaded
    9m24s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Database None
    9m21s       Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 597 secs
    9m18s       Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 594 secs
    9m15s       Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 591 secs
    9m12s       Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 588 secs
    9m9s        Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 585 secs
    9m6s        Normal    Info                     timestenclassic/repsamplehelm   RepDuplicate completed in 16 secs
    9m5s        Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Database Loaded
    9m5s        Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepAgent Not Running
    9m5s        Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepScheme Exists
    9m5s        Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepState IDLE
    9m          Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Database Loaded
    9m          Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepAgent Running
    9m          Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepScheme Exists
    9m          Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepState STANDBY
    9m          Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 is Ready
    8m59s       Normal    Upgrade                  timestenclassic/repsamplehelm   Upgrade of standby complete
    8m59s       Normal    StateChange              timestenclassic/repsamplehelm   TimesTenClassic was StandbyDown, now Normal
    8m28s       Normal    Upgrade                  timestenclassic/repsamplehelm   Deleted active pod repsamplehelm-0 during upgrade
    7m27s       Warning   Error                    timestenclassic/repsamplehelm   Pod repsamplehelm-0 Unreachable for 119 seconds
    7m27s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-0 is Not Ready
    7m27s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-0 is Not Active Ready
    7m27s       Warning   StateChange              timestenclassic/repsamplehelm   TimesTenClassic was Normal, now ActiveDown
    7m27s       Warning   Failed                   timestenclassic/repsamplehelm   Pod repsamplehelm-0 was replaced
    7m26s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-1 Database Updatable
    7m26s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 RepState ACTIVE
    7m26s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 is Not Ready
    7m26s       Normal    StateChange              timestenclassic/repsamplehelm   TimesTenClassic was ActiveDown, now ActiveTakeover
    7m21s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 is Ready
    7m21s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-1 is Active Ready
    7m21s       Normal    StateChange              timestenclassic/repsamplehelm   TimesTenClassic was ActiveTakeover, now StandbyDown
    6m17s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Agent Up
    6m17s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Instance Exists
    6m17s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Daemon Down
    6m16s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Daemon Up
    6m16s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Database Unloaded
    6m14s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Database None
    6m11s       Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 597 secs
    6m8s        Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 594 secs
    6m5s        Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 591 secs
    6m2s        Normal    Info                     timestenclassic/repsamplehelm   pollAsyncStatus: Async polling for RepDuplicate, timeout in 588 secs
    5m59s       Normal    Info                     timestenclassic/repsamplehelm   RepDuplicate completed in 13 secs
    5m58s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Database Loaded
    5m58s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepAgent Not Running
    5m58s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepScheme Exists
    5m58s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepState IDLE
    5m53s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 Database Loaded
    5m53s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepAgent Running
    5m53s       Normal    Info                     timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepScheme Exists
    5m53s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-0 RepState STANDBY
    5m53s       Normal    StateChange              timestenclassic/repsamplehelm   Pod repsamplehelm-0 is Ready
    5m52s       Normal    Upgrade                  timestenclassic/repsamplehelm   Upgrade of active complete
    5m52s       Normal    Upgrade                  timestenclassic/repsamplehelm   Upgrade completed in 350 secs
    5m52s       Normal    StateChange              timestenclassic/repsamplehelm   TimesTenClassic was StandbyDown, now Normal

    自動アップグレード・プロセスが完了します。TimesTenClassicオブジェクトはNormal状態です。TimesTenデータベースは稼働中であり、正しく機能しています。アクティブ・スタンバイ・ペア・レプリケーションは、それらの間に構成されます。

  7. アップグレード後、次の手順を実行します:
    1. レプリケートされたTimesTenClassicオブジェクトがNormal状態であり、アクティブがrepsamplehelm-1であることを確認します。
      kubectl get ttc 
      出力は、次のようになります。
      NAME            STATE    ACTIVE            AGE
      repsamplehelm   Normal   repsamplehelm-1   11h
    2. イメージを確認します。
      kubectl describe ttc repsamplehelm | grep Image
      出力は、次のようになります。
      Image:       container-registry.oracle.com/timesten/timesten:22.1.1.28.0
      ...
  8. (オプション): helm testを使用して、TimesTenをテストします。
     helm test repsamplehelm

    出力は、次のようになります。

    NAME: repsamplehelm
    LAST DEPLOYED: Mon Aug  5 02:25:13 2024
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    TEST SUITE:     repsamplehelm-ttclassic-test
    Last Started:   Mon Aug  5 02:49:22 2024
    Last Completed: Mon Aug  5 02:49:26 2024
    Phase:          Succeeded
    NOTES:
    Version 2211280.1.0 of the ttclassic chart has been installed.
    
    This release is named "repsamplehelm".
    
    To learn more about the release, try:
    
      $ helm status repsamplehelm
      $ helm get all repsamplehelm
      $ helm history repsamplehelm
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback repsamplehelm <REVISION>
        - run 'helm history repsamplehelm' for a list of revisions.

    テストは成功しました。

おめでとうございます。レプリケートされたTimesTenClassicオブジェクトの自動アップグレードが正常に完了しました。TimesTenClassicオブジェクトはアップグレードされており、Normal状態です。TimesTenデータベースのレプリケートされたアクティブ・スタンバイ・ペアは新しいリリースを実行しており、完全に動作しています。