TimesTenのアップグレード

TimesTenClassicオブジェクトとそのTimesTen Classicデータベースのアクティブ・スタンバイ・ペアを新しいTimesTenリリースにアップグレードできます。

TimesTenをアップグレードするには、新しいリリースのttclassicチャートを使用します。

この例では、TimesTenリリース22.1.1.19.0から22.1.1.20.0にアップグレードします。TimesTenリリースの詳細は、『Oracle TimesTen In-Memory Databaseインストレーション、移行およびアップグレード・ガイド』リリース番号の概要を参照してください。

以前にnew_kube_filesディレクトリを作成し、TimesTenオペレータ・ディストリビューションの新しいリリースをこのディレクトリに解凍したとします。

ttclassicチャートには、ネームスペースにデプロイされているTimesTen Classicデータベースのアクティブ・スタンバイ・ペアをアップグレードするために必要なすべての情報が含まれます。チャートには、TimesTenの新しいリリースをデプロイするためのデフォルト構成が含まれています。また、デフォルトのコンテナ・イメージがアップグレード先のイメージでない場合は、ttclassicのチャートのデフォルトのimage変数を変更して、新しいコンテナ・イメージを参照できます。たとえば、新しいリリースのデフォルトのコンテナ・イメージがcontainer-registry.oracle.com/timesten/timesten/22.1.1.20.0で、かわりに新しく構築されたphx.ocir.io/youraccount/tt2211200image:2コンテナ・イメージを使用する場合は、image変数を次の方法で変更します。
image: 
  repository: phx.ocir.io/youraccount/tt2211200image
  tag: "2"

TimesTenデータベースのアクティブ・スタンバイ・ペアを新しいリリースにアップグレードするttclassicチャートのアップグレード方法を示す例を順を追って説明します。この例では、phx.ocir.io/youraccount/tt2211200image:2コンテナ・イメージを使用することを前提としています。

この例では、カスタマイズされたYAMLファイルを使用して、新しいリリースを含むコンテナ・イメージを定義します。カスタマイズしたYAMLファイルのnew_kube_files/helm/customyamlディレクトリを以前に作成したとします。

ノート:

アップグレードが実行されると、スタンバイが最初に終了します。スタンバイが稼働状態に戻るまでには時間がかかります。この待ち時間の間に、スタンバイが新しいリリースにアップグレードされます。スタンバイのアップグレードの間に、レプリケーション構成によっては、アクティブ・データベースが中断される場合があります。これは、アプリケーションに影響を与える可能性があります。次に、アクティブからスタンバイへのフェイルオーバーが行われます。アクティブが終了されます。以前のアクティブが稼働状態に戻るまでには待ち時間があります。この待ち時間の間に、アクティブが新しいリリースにアップグレードされます。スタンバイ・データベースがアクティブに昇格され、以前のアクティブがスタンバイになります。

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

  1. TimesTenClassicオブジェクトがデプロイされており、Normal状態であることを確認します。
    kubectl get ttc samplettc

    出力。

    NAME        STATE    ACTIVE        AGE
    samplettc   Normal   samplettc-0   20h
  2. TimesTenClassicオブジェクトが必要なイメージを実行していることを確認します。
    kubectl get ttc samplettc -o yaml | grep image

    出力。

        image: phx.ocir.io/youraccount/tt2211190image:1
        imagePullPolicy: Always
        imagePullSecret: sekret
        imageUpdatePending: false
    

    TimesTenClassicオブジェクトは、必要なイメージを実行しています。

  3. 開発ホストで、新しいリリースのhelmディレクトリに変更します。
    cd new_kube_files/helm

    このディレクトリには、チャートの新しいリリースが含まれます。helmディレクトリの詳細は、「環境の設定」を参照してください。

  4. 新しいコンテナ・イメージを参照するYAMLファイルを作成します。
    vi customyaml/samplettc.yaml
    
    image:
      repository: phx.ocir.io/youraccount/tt2211200image
      tag: "2"
    imagePullSecret: sekret
    カスタマイズは次のとおりです。
    • 構築してアップグレードに使用するコンテナ・イメージはphx.ocir.io/youraccount/tt2211200image:2であるため、repository変数の値はphx.ocir.io/youraccount/tt2211200imageで、tag変数の値は2です。

    • イメージ・プル・シークレットはsekretです。

  5. ttclassicチャートのリリースの名前を確認します。
    helm list
    出力。
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
    samplettc       mynamespace     1               2023-10-23 23:18:03.740512897 +0000 UTC deployed        ttclassic-2211190.1.0   22.1.1.19.0
    samplettop      mynamespace     2               2023-10-24 16:15:24.896107706 +0000 UTC deployed        ttoperator-2211200.1.0  22.1.1.20.0
    ttcrd           mynamespace     2               2023-10-24 16:10:21.530832896 +0000 UTC deployed        ttcrd-2211200.1.0       22.1.1.20.0

    helm listコマンドは、samplettcリリースが存在し、ネームスペースにインストールされていることを示します。

  6. TimesTenClassicオブジェクトとそのデータベースのアクティブ・スタンバイ・ペアを新しいリリースにアップグレードします。アップグレードするには、新しいリリースのttclassicチャートを使用し、新しいイメージを参照するカスタマイズされたYAMLファイルを使用します。
    helm get values samplettc --all > prev-values-ttc.yaml && helm upgrade -f prev-values-ttc.yaml -f customyaml/upgradettc.yaml  samplettc ./ttclassic
    
    次のhelm upgradeコマンドを見てみましょう。
    • get values samplettc Helmコマンドは、既存のカスタマイズを含む現在のリリースの値を取得します。このコマンドの結果は、prev-values-ttc.yamlファイルにパイプされます。このファイルには任意の名前を選択できます。

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

    ノート:

    この構文をお薦めします。これにより、既存のカスタマイズが保持されます。

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

    Release "samplettc" has been upgraded. Happy Helming!
    NAME: samplettc
    LAST DEPLOYED: Tue Oct 24 19:55:45 2023
    NAMESPACE: mynamespace
    STATUS: deployed
    REVISION: 2
    NOTES:
    Version 2211200.1.0 of the ttclassic chart has been installed.
    
    This release is named "samplettc".
    
    To learn more about the release, try:
    
      $ helm status samplettc
      $ helm get all samplettc
      $ helm history samplettc
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback samplettc <REVISION>
        - run 'helm history samplettc' for a list of revisions.
    次の点に注目してください。
    • samplettcリリースはアップグレードされます。リリース・リビジョンは2です。

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

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

    • TimesTenClassicオブジェクトは、新しいイメージを使用しているオブジェクトに置き換えられます。これにより、TimesTenオペレータは、アクティブ・スタンバイ・ペアの両方のデータベースを新しいリリースに自動的にアップグレードします。

  7. 自動アップグレードを確認します。
     kubectl describe ttc samplettc

    出力。

    Name:         samplettc
    Namespace:    mynamespace
    Labels:       app.kubernetes.io/managed-by=Helm
    Annotations:  meta.helm.sh/release-name: samplettc
                  meta.helm.sh/release-namespace: mynamespace
    ...
    Events:
      Type     Reason       Age    From      Message
      ----     ------       ----   ----      -------
      Normal   Upgrade      7m44s  timesten  Image updated, automatic upgrade started
      Normal   Upgrade      7m44s  timesten  Deleted standby pod samplettc-1 during upgrade
      Normal   Info         6m43s  timesten  Pod samplettc-1 Agent Down
      Normal   Info         6m42s  timesten  Pod samplettc-1 Agent Up
      Normal   Info         6m42s  timesten  Pod samplettc-1 Instance Exists
      Normal   Info         6m42s  timesten  Pod samplettc-1 Daemon Down
      Normal   StateChange  6m42s  timesten  Pod samplettc-1 is Not Ready
      Warning  StateChange  6m42s  timesten  TimesTenClassic was Normal, now ActiveTakeover
      Normal   StateChange  6m42s  timesten  TimesTenClassic was ActiveTakeover, now StandbyDown
      Normal   Info         6m42s  timesten  Pod samplettc-1 Agent Down
      Normal   Info         6m37s  timesten  Pod samplettc-1 Agent Up
      Normal   Info         6m37s  timesten  Pod samplettc-1 Instance Exists
      Normal   Info         6m37s  timesten  Pod samplettc-1 Daemon Down
      Normal   Info         6m37s  timesten  Pod samplettc-1 Daemon Up
      Normal   Info         6m37s  timesten  Pod samplettc-1 Database Unloaded
      Normal   Info         6m35s  timesten  Pod samplettc-1 Database None
      DEBUG    Info         6m32s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 597 secs
      DEBUG    Info         6m29s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 594 secs
      DEBUG    Info         6m26s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 591 secs
      DEBUG    Info         6m23s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 588 secs
      Normal   Info         6m20s  timesten  Pod samplettc-1 Database Loaded
      Normal   Info         6m19s  timesten  Pod samplettc-1 RepAgent Not Running
      Normal   Info         6m19s  timesten  Pod samplettc-1 RepScheme Exists
      Normal   StateChange  6m19s  timesten  Pod samplettc-1 RepState IDLE
      Normal   Info         6m14s  timesten  Pod samplettc-1 RepAgent Running
      Normal   StateChange  6m14s  timesten  TimesTenClassic was StandbyDown, now StandbyStarting
      Normal   StateChange  6m13s  timesten  TimesTenClassic was StandbyStarting, now StandbyCatchup
      Normal   StateChange  5m36s  timesten  Pod samplettc-1 RepState STANDBY
      Normal   Upgrade      5m36s  timesten  Upgrade of standby complete
      Normal   StateChange  5m36s  timesten  TimesTenClassic was StandbyCatchup, now Normal
      Normal   Upgrade      5m4s   timesten  Deleted active pod samplettc-0 during upgrade
      Normal   Info         5m4s   timesten  Pod samplettc-0 Agent Down
      Normal   StateChange  4m59s  timesten  Pod samplettc-0 is Not Ready
      Normal   StateChange  4m59s  timesten  Pod samplettc-0 is Not Active Ready
      Normal   StateChange  4m59s  timesten  Pod samplettc-1 is Ready
      Warning  StateChange  4m59s  timesten  TimesTenClassic was Normal, now ActiveDown
      Normal   Info         4m57s  timesten  Pod samplettc-1 Database Updatable
      Normal   StateChange  4m57s  timesten  Pod samplettc-1 RepState ACTIVE
      Normal   StateChange  4m57s  timesten  Pod samplettc-1 is Not Ready
      Normal   StateChange  4m57s  timesten  TimesTenClassic was ActiveDown, now ActiveTakeover
      Normal   StateChange  4m56s  timesten  Pod samplettc-1 is Ready
      Normal   StateChange  4m56s  timesten  Pod samplettc-1 is Active Ready
      Normal   StateChange  4m56s  timesten  TimesTenClassic was ActiveTakeover, now StandbyDown
      Normal   Info         4m6s   timesten  Pod samplettc-0 Agent Up
      Normal   Info         4m6s   timesten  Pod samplettc-0 Instance Exists
      Normal   Info         4m6s   timesten  Pod samplettc-0 Daemon Down
      Normal   Info         4m6s   timesten  Pod samplettc-0 Daemon Up
      Normal   Info         4m6s   timesten  Pod samplettc-0 Database Unloaded
      Normal   Info         4m4s   timesten  Pod samplettc-0 Database None
      DEBUG    Info         4m1s   timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 597 secs
      DEBUG    Info         3m58s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 594 secs
      DEBUG    Info         3m55s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 591 secs
      DEBUG    Info         3m52s  timesten  pollAsyncStatus: Async polling for RepDuplicate, timeout in 588 secs
      Normal   Info         3m48s  timesten  Pod samplettc-0 Database Loaded
      Normal   Info         3m48s  timesten  Pod samplettc-0 RepAgent Not Running
      Normal   Info         3m48s  timesten  Pod samplettc-0 RepScheme Exists
      Normal   StateChange  3m48s  timesten  Pod samplettc-0 RepState IDLE
      Normal   Info         3m43s  timesten  Pod samplettc-0 RepAgent Running
      Normal   StateChange  3m43s  timesten  TimesTenClassic was StandbyDown, now StandbyStarting
      Normal   StateChange  3m42s  timesten  TimesTenClassic was StandbyStarting, now StandbyCatchup
      Normal   StateChange  2m56s  timesten  Pod samplettc-0 RepState STANDBY
      Normal   Upgrade      2m56s  timesten  Upgrade of active complete
      Normal   Upgrade      2m56s  timesten  Upgrade completed in 288 secs
      Normal   StateChange  2m56s  timesten  TimesTenClassic was StandbyCatchup, now Normal
  8. TimesTenClassicオブジェクトがNormal状態であることを確認します。
    kubectl get ttc samplettc

    出力。

    NAME        STATE    ACTIVE        AGE
    samplettc   Normal   samplettc-1   20h
    

    TimesTenClassicオブジェクトはNormal状態です。samplettc-1がアクティブになりました。

  9. TimesTenClassicオブジェクトが新しいイメージを実行していることを確認します。
    kubectl get ttc samplettc -o yaml | grep image

    出力。

        image: phx.ocir.io/youraccount/tt2211200image:2
        imagePullPolicy: Always
        imagePullSecret: sekret
        imageUpdatePending: false
    

    TimesTenClassicオブジェクトは、新しいイメージを実行しています。

  10. (オプション): ttclassicリリースをテストします。
     helm test samplettc

    出力。

    NAME: samplettc
    LAST DEPLOYED: Tue Oct 24 19:55:45 2023
    NAMESPACE: mynamespace
    STATUS: deployed
    REVISION: 2
    TEST SUITE:     samplettc-ttclassic-test
    Last Started:   Tue Oct 24 20:12:30 2023
    Last Completed: Tue Oct 24 20:12:35 2023
    Phase:          Succeeded
    NOTES:
    Version 2211200.1.0 of the ttclassic chart has been installed.
    
    This release is named "samplettc".
    
    To learn more about the release, try:
    
      $ helm status samplettc
      $ helm get all samplettc
      $ helm history samplettc
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback samplettc <REVISION>
        - run 'helm history samplettc' for a list of revisions.

    samplettcリリースのリビジョン2のテストに成功しました。

  11. samplettcリリースがアップグレードされていることを確認します。
    helm list

    出力。

    
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
    samplettc       mynamespace     2               2023-10-24 19:55:45.303709067 +0000 UTC deployed        ttclassic-2211200.1.0   22.1.1.20.0
    samplettop      mynamespace     2               2023-10-24 16:15:35.896107706 +0000 UTC deployed        ttoperator-2211200.1.0  22.1.1.20.0
    ttcrd           mynamespace     2               2023-10-24 16:00:21.530832896 +0000 UTC deployed        ttcrd-2211200.1.0       22.1.1.20.0

    ttclassicチャートのversionは、22.1.1.20.0 TimesTenリリースに対応する2211200.1.0です。

おめでとうございます。アップグレードを正常に実行しました。TimesTenClassicオブジェクトはアップグレードされており、Normal状態です。TimesTen Classicデータベースの関連するアクティブ・スタンバイ・ペアがアップグレードされています。どちらのデータベースも稼働中です。