フェイルオーバー

これで、アクティブ・データベースからスタンバイ・データベースへのフェイルオーバーを開始する準備ができました。

ノート:

フェイルオーバー中、TimesTenオペレータはアクティブ・データベースを停止し、スタンバイにすぐにフェイルオーバーします。本番日の最も忙しい時間にこの手順を実行しないでください。スケジュール済の本番停止時にこの操作の実行を検討することをお薦めします。

フェイルオーバーする前に、アクティブ・データベースでアプリケーションを停止します。TimesTen ttAdmin -closeおよびttAdmin -disconnectコマンドを使用できます。『Oracle TimesTen In-Memory Databaseオペレーション・ガイド』ユーザー接続のためのデータベースのオープンとクローズおよびデータベースの接続の切断を参照してください。

データ損失の可能性をなくすために、TimesTen ttRepAdmin -waitコマンドを使用して、レプリケーションの遅れが回復されるまで待機し、アクティブ・データベースで実行されたトランザクションがスタンバイ・データベースに確実にレプリケートされるようにします。Oracle TimesTen In-Memory DatabaseリファレンスttRepAdminを参照してください

スタンバイの遅れが回復されたら、アクティブ・ポッドを削除して、アクティブ・データベースからスタンバイにフェイルオーバーします。アクティブ・ポッドを削除すると、TimesTenオペレータによって自動的に障害が検出され、スタンバイ・データベースがアクティブに昇格されます。アクティブ・データベースを使用しているクライアント/サーバー・アプリケーションは、新しいアクティブ・データベースに自動的に再接続されます。処理中のトランザクションはロールバックされます。準備したSQL文は、アプリケーションで再準備する必要があります。詳細は、「フェイルオーバーおよびリカバリの処理について」を参照してください。

フェイルオーバーを開始します。

  1. アクティブなポッドを削除します。
    kubectl delete pod manrepsample-0

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

    pod "manrepsample-0" deleted

    削除されたポッドを置き換えるために、Kubernetesは新しいmanrepsample-0ポッドを自動的に作成します。TimesTenオペレータは、新しいmanresample-0ポッドをスタンバイ・ポッドとして構成します。この新しいポッドは、アップグレードされたTimesTenイメージを実行します。

  2. アップグレードの進行状況を監視し、状態遷移を監視します。
     kubectl get events -w
    出力は、次のようになります。
    LAST SEEN   TYPE      REASON                   OBJECT                         MESSAGE
    ...
    37m         Warning   Upgrade                  timestenclassic/manrepsample   Image updated, automatic upgrade disabled
    26m         Warning   Failed                   timestenclassic/manrepsample   Pod manrepsample-1 was replaced
    26m         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 is Not Ready
    26m         Warning   StateChange              timestenclassic/manrepsample   TimesTenClassic was Normal, now ActiveTakeover
    26m         Normal    StateChange              timestenclassic/manrepsample   TimesTenClassic was ActiveTakeover, now StandbyDown
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Agent Up
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Instance Exists
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Daemon Down
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Daemon Up
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Database Unloaded
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Database None
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Database Loaded
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 RepAgent Not Running
    24m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 RepScheme Exists
    24m         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 RepState IDLE
    23m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Database Loaded
    23m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 RepAgent Running
    23m         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 RepScheme Exists
    23m         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 RepState STANDBY
    23m         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 is Ready
    23m         Normal    StateChange              timestenclassic/manrepsample   TimesTenClassic was StandbyDown, now Normal
    3m50s       Warning   Failed                   timestenclassic/manrepsample   Pod manrepsample-0 was replaced
    3m44s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-0 is Not Ready
    3m44s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-0 is Not Active Ready
    3m44s       Warning   StateChange              timestenclassic/manrepsample   TimesTenClassic was Normal, now ActiveDown
    3m43s       Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-1 Database Updatable
    3m43s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 RepState ACTIVE
    3m43s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 is Not Ready
    3m43s       Normal    StateChange              timestenclassic/manrepsample   TimesTenClassic was ActiveDown, now ActiveTakeover
    3m38s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 is Ready
    3m38s       Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-1 is Active Ready
    3m38s       Normal    StateChange              timestenclassic/manrepsample   TimesTenClassic was ActiveTakeover, now StandbyDown
    119s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Agent Up
    119s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Instance Exists
    119s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Daemon Down
    118s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Daemon Up
    118s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Database Unloaded
    111s        Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Database None
    90s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Database Loaded
    90s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 RepAgent Not Running
    90s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 RepScheme Exists
    90s         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-0 RepState IDLE
    84s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 Database Loaded
    84s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 RepAgent Running
    84s         Normal    Info                     timestenclassic/manrepsample   Pod manrepsample-0 RepScheme Exists
    84s         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-0 RepState STANDBY
    84s         Normal    StateChange              timestenclassic/manrepsample   Pod manrepsample-0 is Ready
    84s         Normal    StateChange              timestenclassic/manrepsample   TimesTenClassic was StandbyDown, now Normal

    アップグレード・プロセスが完了します。

  3. どのポッドがアクティブであるかを確認します。
    kubectl get ttc manrepsample

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

    NAME           STATE    ACTIVE           AGE
    manrepsample   Normal   manrepsample-1   3h21m

    TimesTenオペレータにより、スタンバイmanrepsample-1データベースがアクティブ・データベースに昇格しました。manrepsample-0データベースに接続されたアプリケーションは、TimesTenによってmanrepsample-1データベースに自動的に再接続されます。短時間の停止後、アプリケーションは引き続きデータベースを使用できます。

  4. アクティブ・データベースとスタンバイ・データベースで正しいリリースが実行されていることを確認します。
    1. アクティブなポッドにシェルを設定します。
      kubectl exec -it manrepsample-1 -c tt -- /bin/bash
    2. TimesTen ttVersionユーティリティを実行します。
      ttVersion
      出力は、次のようになります。
      TimesTen Release 22.1.1.28.0 (64 bit Linux/x86_64) (instance1:6624) 2024-05-17T15:16:01Z
        Instance admin: timesten
        Instance home directory: /tt/home/timesten/instances/instance1
        Group owner: timesten
        Daemon home directory: /tt/home/timesten/instances/instance1/info
        PL/SQL enabled.
      
    3. シェルを終了します。
    4. スタンバイ・ポッドにシェルを設定します。
      kubectl exec -it manrepsample-0 -c tt -- /bin/bash
    5. TimesTen ttVersionユーティリティを実行します。
      ttVersion
      出力は、次のようになります。
      TimesTen Release 22.1.1.28.0 (64 bit Linux/x86_64) (instance1:6624) 2024-05-17T15:16:01Z
        Instance admin: timesten
        Instance home directory: /tt/home/timesten/instances/instance1
        Group owner: timesten
        Daemon home directory: /tt/home/timesten/instances/instance1/info
        PL/SQL enabled.
      
    6. シェルを終了します。
    アクティブ・データベースおよびスタンバイ・データベースで正しいリリースのTimesTenが実行されています。

おめでとうございます。レプリケートされたTimesTenClassicオブジェクトの手動アップグレードが正常に実行されました。アクティブ・データベースとスタンバイ・データベースがアップグレードされ、稼働中であり、完全に動作しています。