プライマリ・コンテンツに移動
Oracle® TimesTen In-Memory Database Kubernetesオペレータ・ユーザーズ・ガイド
リリース18.1
F33742-03
  目次へ移動
目次
索引へ移動
索引

前
 
次
 

10 アップグレードの実行

この章では、オペレータおよびTimesTenの新しいパッチ(またはパッチ・セット)にアップグレードするプロセスについて説明します。これは、ダウングレードにも適用されます。TimesTenリリースの詳細は、Oracle TimesTen In-Memory Databaseインストレーション、移行およびアップグレード・ガイドのリリース番号の概要を参照してください。

内容は次のとおりです。

アップグレード・プロセスの概要

アップグレード・プロセスでは、まずオペレータをアップグレードし、次にTimesTenをアップグレードします。

オペレータを手動でアップグレードする必要があります。これには次が含まれます。

  • crd.yamlおよびservice_account.yamlファイルの更新。

  • 新しいオペレータを含む新しいイメージの作成。

  • 新しいオペレータへの切替え

オペレータのアップグレードの詳細は、オペレータのアップグレードを参照してください。

TimesTenをアップグレードするには、新しいTimesTenリリースを含む新しいコンテナ・イメージを作成します。次に、TimesTenClassicオブジェクトのimage CRD構文要素の値を変更して、アクティブ・スタンバイ・ペアに関連付けられたTimesTenClassicオブジェクトを更新します。image CRD構文要素の詳細は、TimesTenClassicSpecSpecを参照してください。

オペレータは、Kubernetes StatefulSetを作成し、各TimesTenClassicオブジェクトに関連付けます。StatefulSetは、TimesTenを実行するポッドを作成し、作成を制御します。

TimesTenClassicオブジェクトのimage CRD構文要素を変更すると、オペレータは変更を認識して、StatefulSet内の対応するimage属性を変更します。これにより、コンテナの将来の生成が制御されます。実行中のコンテナが終了すると、StatefulSetによって置換するコンテナが生成されます。この置換されたコンテナは、新しく指定されたイメージを実行します。

同様に、これらのポッドで実行されている指定した他のコンテナに対して、オペレータは各TimesTenClassicオブジェクトのimage値の値を調べます。この値は、指定したコンテナが実行するイメージを制御します。TimesTenClassicオブジェクトのimage値を変更すると、関連するStatefulSetの対応する属性がオペレータによって変更されます。

オペレータがTimesTenClassicオブジェクトから関連するStatefulSetに変更を伝播した後、オペレータによってTimesTenをアップグレードするステップを実行するか、または手動でステップを実行するかを決定する必要があります。これは、TimesTenClassicオブジェクトのimageUpgradeStrategy CRD構文要素に指定した値によって決まります。autoの値は、オペレータがアップグレードを実行する必要があることを示し、manualの値は手動でアップグレードを実行することを示します。imageUpgradeStrategyの値を指定しない場合、デフォルトはautoです。imageUpgradeStrategy CRD構文要素の詳細は、TimesTenClassicSpecSpecを参照してください。自動アップグレードの場合(imageUpgradeStrategyの値はauto)、upgradeDownPodTimeout値を設定することで、ポッドが(削除された後に)起動するまでオペレータが待機する時間も制御できます。詳細は、TimesTenClassicSpecSpecを参照してください。

この自動アップグレード・プロセスを使用して、自分のコンテナで実行されているダイレクト・モード・アプリケーションをアップグレードすることはできません。オペレータは、TimesTenClassicオブジェクトから関連するStatefulSetに変更を伝播しますが、変更は自動アップグレード・プロセスを開始しません。コンテナで実行されているアプリケーションを手動で終了する必要があります。その際、StatefulSetは、元のコンテナを置き換える新しいコンテナを生成します。これらの新しいコンテナは、新しく指定されたTimesTenイメージを実行します。ダイレクト・モード・アプリケーションの詳細は、ダイレクト・モード・アプリケーションの使用を参照してください。

アップグレード・プロセスのいずれかのステップで障害が発生した場合、TimesTenClassicオブジェクトはManualInterventionRequired状態になります。アップグレード・プロセスの残りのステップは取り消されます。ペアをオペレータによる管理に戻すには、アクティブ/スタンバイ・ペアを手動で修正する必要があります。ペアが自動管理に戻された場合でも、アップグレード・プロセスの残りのステップは自動的には実行されません。詳細は、ManualInterventionRequired状態の理解および1つのデータベースの起動を参照してください。

オペレータのアップグレード

自動アップグレードと手動アップグレードの両方で、オペレータを手動でアップグレードする必要があります。Kubernetesクラスタで実行されている1つ以上のTimesTenClassicオブジェクトがあり、それらのTimesTenClassicオブジェクトに関連付けられたTimesTenデータベースが稼働しているときに、TimesTenオペレータの現在のリリースを新しいリリースにアップグレードできます。

オペレータのアップグレード・プロセスは次のとおりです。

  • /deployディレクトリ内のcrd.yamlファイルおよびservice_account.yamlファイルの置換

  • 新しいオペレータ・イメージの作成

  • timestenclassic-operatorデプロイメントの更新

オペレータが再起動すると、新しいオペレータへのアップグレードが有効になります。オペレータのアップグレード中、TimesTenデータベースは(オペレータが管理していない場合でも)実行されます。オペレータのアップグレード・プロセスが完了すると、新しいオペレータは、クラスタ内の現在のTimesTenClassicオブジェクトと、それらのTimesTenClassicオブジェクトに関連付けられたTimesTenデータベースを引き続き管理します。

次の各項では、オペレータをアップグレードする手順について説明します。

新しいリリースのTimesTenオペレータのダウンロード

新しいリリースのTimesTenオペレータは、Linux 64ビットのTimesTen完全ディストリビューションの新しいリリースに含まれています。(この例では、新しいリリースは18.1.4.11.0です)。

次のステップを実行して、TimesTenのフル・ディストリビューションをダウンロードし、その中に埋め込まれているTimesTenオペレータのディストリビューションを解凍します。すべてのステップをLinux開発ホストから実行します。

  1. 選択したディレクトリから次のことを実行します。

    • 新しいTimesTenのフル・ディストリビューションをダウンロードするサブディレクトリを1つ作成します。たとえば、new_installation_dirサブディレクトリを作成します。

    • 新しいTimesTenオペレータのディストリビューションを解凍する2つ目のサブディレクトリを作成します。たとえば、new_kube_filesサブディレクトリを作成します。

    % mkdir -p new_installation_dir
    % mkdir -p new_kube_files
    
  2. new_installation_dirに移動します。

    % cd new_installation_dir
    

    このディレクトリにTimesTenのフル・ディストリビューションをダウンロードします。この例では、timesten1814110.server.linux8664.zipファイル(Linux 64ビットの18.1.4.11.0フル・ディストリビューション)をダウンロードします。

  3. new_installation_dirから、ZIPユーティリティを使用してTimesTenのディストリビューションを解凍します。

    % unzip timesten1814110.server.linux8664.zip
    Archive:  /timesten/installation/timesten1814110.server.linux8664.zip
       creating: 18.1.4.11.0/
       creating: 18.1.4.11.0/ttoracle_home/
    ...
       creating: tt18.1.4.11.0/kubernetes/
    ...
    

    new_installation_dir/tt18.1.4.11.0/kubernetesディレクトリが作成されることに注目してください。operator.zipファイルは、このディレクトリにあります。たとえば、分散を解凍した後のディレクトリ構造の例を次に示します(リリースごとに変わる可能性があります)。

    % pwd
    new_installation_dir/tt18.1.4.11.0
    % dir
    3rdparty  include     lib      oraclescripts  README.html  ttoracle_home
    bin       info        network  PERL           startup
    grid      kubernetes  nls      plsql          support
    
  4. new_kube_filesディレクトリに移動して、そのディレクトリにoperator.zipファイルを解凍します。この例では、new_installation_dir/tt18.1.4.11.0/kubernetes/operator.zipファイルを解凍します。

    % cd new_kube_files
    % unzip new_installation_dir/tt18.1.4.11.0/kubernetes/operator.zip
    [...UNZIP OUTPUT...]
    
  5. ディレクトリ構造を確認します。この例では、リリースごとに変更される可能性がある最も重要なサブディレクトリとファイルを示します。

    README.md
    deploy/crd.yaml
    deploy/operator.yaml
    deploy/service_account.yaml
    operator/Dockerfile
    operator/timestenclassic-operator
    ttimage/agent2
    ttimage/.bashrc
    ttimage/create1.sql
    ttimage/create2.sql
    ttimage/Dockerfile
    ttimage/get1.sql
    ttimage/pausecq.sql
    ttimage/repcreate.sql
    ttimage/repduplicate.sql
    ttimage/runsql,sql
    ttimage/starthost.pl
    ttimage/.ttdotversion
    ttimage/.ttdrop
    

    ノート:

    このディレクトリ・ツリーは、TimesTenオペレータの存続期間中存続している必要があります。

    また、TimesTenのフル・ディストリビューション・ファイル(この例ではtimesten1814110.server.linux8664.zip)は削除しないでください。このファイルは次の場所にコピーする必要があります。

    • 新しいオペレータ・イメージを作成して、そのイメージをイメージ・レジストリにプッシュするための/operatorディレクトリ。詳細は、「新しいオペレータ・イメージの作成」を参照してください。

    • 新しいTimesTenイメージをビルドして、そのイメージをイメージ・レジストリにプッシュするための/ttimageディレクトリ。詳細は、「新しいTimesTenイメージの作成」を参照してください。


crd.yamlファイルとservice_account.yamlファイルの置換

new_kube_files/ttdeployディレクトリにあるcrd.yamlファイルとservice_account.yamlファイルを置き換える必要があります。


ノート:

crd.yamlファイルを削除しないでください。そのようにすると、TimesTenClassicオブジェクトとそれに関連付けられたTimesTenデータベースが削除されてしまします。

次のステップを実行します。

  1. new_kube_files/deployディレクトリに移動し、crd.yamlファイルを再作成します。

    % cd new_kube_files/deploy
    % kubectl replace -f crd.yaml
    customresourcedefinition.apiextensions.k8s.io/timestenclassics.timesten.
    oracle.com replaced
    
  2. new_kube_files/deployディレクトリで、オペレータを実行するKubernetesサービス・アカウントを再作成します。アップグレード手順を実行するには、オペレータに追加の権限が必要です。

    % kubectl replace -f service_account.yaml
    role.rbac.authorization.k8s.io/timestenclassic-operator replaced
    serviceaccount/timestenclassic-operator replaced
    rolebinding.rbac.authorization.k8s.io/timestenclassic-operator replaced
    

crd.yamlファイルとservice_account.yamlファイルを正常に置換しました。これで、オペレータ・イメージを作成する準備が整いました。

新しいオペレータ・イメージの作成

新しいオペレータを実行する前に、新しいOperatorイメージを作成してイメージ・レジストリにプッシュしておく必要があります。

新しいOperatorイメージの作成に必要なファイルは、new_kube_files/operatorディレクトリにあります(前の手順で解凍したZIPファイルに含まれています)。

新しいオペレータ・イメージを作成してレジストリにプッシュするには、次のステップを実行します。

  1. new_kube_files/operatorディレクトリに移動して、そのディレクトリにTimesTenのディストリビューションをコピーします。この例は、new_installation_dirディレクトリにtimesten1814110.server.linux8664.zipディストリビューションをダウンロードしたと仮定しています。詳細は、「新しいリリースのTimesTenオペレータのダウンロード」を参照してください。その次に、timesten1814110.server.linux8664.zipファイルがnew_kube_files/operatorディレクトリにあることを確認します。

    % cd new_kube_files/operator
    % cp new_installation_dir/timesten1814110.server.linux8664.zip .
    % ls -a
    Dockerfile
    timesten1814110.server.linux8664.zip
    timestenclassic-operator
    
  2. new_kube_files/operatorディレクトリに移動します(このディレクトリに移動していない場合)。dockerコマンドを使用して新しいオペレータ・イメージを作成してタグ付けします。新しいオペレータ・イメージにタグ付けするときには、イメージにリリース番号のタグを付けることをお薦めします。たとえば、ttclassic-operator:releaseというネーミング規則を使用できます(releaseはタグ付けするリリース)。この例では、ttclassic-operator:3を使用して、新しいオペレータ・イメージに名前を付けます(太字で表示)。

    % cd new_kube_files/operator
    % docker build -t ttclassic-operator:3 .
    Sending build context to Docker daemon  478.6MB
    Step 1/7 : FROM container-registry.oracle.com/os/oraclelinux:7
     ---> d788eca028a0
    Step 2/7 : ARG TT_DISTRO=timesten1814110.server.linux8664.zip
     ---> Using cache
     ---> a259a93fe906
    Step 3/7 : RUN yum -y install openssl unzip && /usr/sbin/useradd -d 
    /tt-operator -m -u 1001 -s /bin/nologin -U tt-operator
     ---> Using cache
     ---> e3f1427246ab
    Step 4/7 : COPY --chown=tt-operator:tt-operator timestenclassic-operator 
    /usr/local/bin/timestenclassic-operator
     ---> Using cache
     ---> 6ccad53230f0
    Step 5/7 : COPY --chown=tt-operator:tt-operator $TT_DISTRO /tt-operator/
    $TT_DISTRO
     ---> 5cd31705485a
    Step 6/7 : USER tt-operator
     ---> Running in 6a773ddac5dd
    Removing intermediate container 6a773ddac5dd
     ---> 875ee38ebc75
    Step 7/7 : ENTRYPOINT ["/usr/local/bin/timestenclassic-operator"]
     ---> Running in fed0f6c94c2f
    Removing intermediate container fed0f6c94c2f
     ---> 10dde79e1617
    Successfully built 10dde79e1617
    Successfully tagged ttclassic-operator:3
    
  3. dockerコマンドを使用して、新しいオペレータ・イメージにタグを付けます。

    • phx.ocir.io/youraccountをイメージ・レジストリの場所に置き換えます。(この例では、phx.ocir.io/youraccount太字で表示されています。)

    • ttclassic-operator:3は、前のステップで選択した名前に置き換えます(この例では、ttclassic-operator:3太字で表示しています)。

    % docker tag ttclassic-operator:3 phx.ocir.io/youraccount/ttclassic-operator:3
    
  4. 新しいオペレータ・イメージをレジストリにプッシュするには、dockerコマンドを使用します。

    • phx.ocir.io/youraccountをイメージ・レジストリの場所に置き換えます。(この例では、phx.ocir.io/youraccount太字で表示されています。)

    • ttclassic-operator:3は、前のステップで選択した名前に置き換えます(この例では、ttclassic-operator:3太字で表示しています)。

    % docker push phx.ocir.io/youraccount/ttclassic-operator:3
    The push refers to repository [phx.ocir.io/youraccount/ttclassic-operator]
    46458e9fc890: Pushed
    471a399f0540: Pushed
    9e51a2b82af3: Pushed
    2f915858a916: Layer already exists
    3: digest: 
    sha256:9b941f12e3d52298b9b38f7766ddcdfb1d011857a990ff01a8adafd32f3d3e8d size: 
    1166
    

新しいオペレータ・イメージを正常に作成して、イメージ・レジストリにプッシュしました。

現在のオペレータの確認

この項では、現在の(実行中の)オペレータを確認するステップについて説明します。こうしたステップは必須ではありません。

  1. kubectl getコマンドを使用して、現在のオペレータ(この例では、太字表示のtimestenclassic-operator-66bd4bc88b-c8vf)が実行中になっていることを確認します。

    % kubectl get pods
    NAME                                        READY   STATUS    RESTARTS   AGE
    sample-0                                    2/2     Running   0          168m
    sample-1                                    2/2     Running   0          168m
    sample2-0                                   2/2     Running   0          158m
    sample2-1                                   2/2     Running   0          158m
    timestenclassic-operator-66bd4bc88b-c8vfq   1/1     Running   0          3h5m
    
  2. kubectl describeコマンドを使用すると、現在のtimestenclassic-operatorデプロイメントを確認できます。デプロイメントのイメージが元のイメージ(この例では、太字表示のphx.ocir.io/youraccount/ttclassic-operator:2)になっている点に注意してください。

    % kubectl describe deployment timestenclassic-operator
    Name:                   timestenclassic-operator
    Namespace:              mynamespace
    CreationTimestamp:      Sun, 11 Apr 2021 13:40:36 +0000
    Labels:                 <none>
    Annotations:            deployment.kubernetes.io/revision: 1
    Selector:               name=timestenclassic-operator
    Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 
    unavailable
    StrategyType:           RollingUpdate
    MinReadySeconds:        0
    RollingUpdateStrategy:  25% max unavailable, 25% max surge
    Pod Template:
      Labels:           name=timestenclassic-operator
      Service Account:  timestenclassic-operator
      Containers:
       timestenclassic-operator:
        Image:      phx.ocir.io/youraccount/ttclassic-operator:2
        Port:       <none>
        Host Port:  <none>
        Command:
          timestenclassic-operator
        Environment:
          WATCH_NAMESPACE:   (v1:metadata.namespace)
          POD_NAME:          (v1:metadata.name)
          OPERATOR_NAME:    timestenclassic-operator
          GODEBUG:          x509ignoreCN=0
        Mounts:             <none>
      Volumes:              <none>
    Conditions:
      Type           Status  Reason
      ----           ------  ------
      Available      True    MinimumReplicasAvailable
      Progressing    True    NewReplicaSetAvailable
    OldReplicaSets:  <none>
    NewReplicaSet:   timestenclassic-operator-66bd4bc88b (1/1 replicas created)
    Events:          <none>
    
  3. Kubernetesクラスタで実行しているTimesTenClassicオブジェクトを確認します。2つのTimesTenClassicオブジェクトが実行されています(この例ではsampleおよびsample2)。

    % kubectl get ttc
    NAME      STATE    ACTIVE      AGE
    sample    Normal   sample-0    3h8m
    sample2   Normal   sample2-0   179m
    

timestenclassic-operatorデプロイメントの更新

この項では、新しいオペレータ・コンテナ・イメージを使用するための現在のtimestenclassic-operatorデプロイメントの更新について説明します。この項のステップを完了すると、オペレータは再起動され、新しいオペレータへのアップグレードが有効になります。実行中のオペレータが複数ある場合は、各オペレータが1つずつ再起動されます。この新しいオペレータは、TimesTenClassicオブジェクトとそれらのTimesTenClassicオブジェクトに関連付けられているTimesTenデータベースを引き続き管理します。

次のステップを実行します。

  1. new_kube_files/deployディレクトリに移動し、operator.yamlファイルを編集します。このファイルは、以前に解凍したディストリビューションで提供されています。詳細は、新しいリリースのTimesTenオペレータのダウンロードを参照してください。

    太字で表示されている次のフィールド(次のoperator.yamlファイル内)を更新します。

    • replicas: 1

      1を、実行するオペレータのコピー数に置き換えます。開発およびテストには1を使用できます。ただし、高可用性を確保する目的で、複数のレプリカを実行できます。

    • sekretを、Kubernetesがレジストリからイメージを取得するために使用するイメージ・プル・シークレットの名前に置き換えます。

    • 作成したオペレータ・イメージを参照するには、image行を置き換えます。(この例ではphx.ocir.io/youraccount/ttclassic_operator:3)。

    % cd new_kube_files/deploy
    % vi operator.yaml
    
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: timestenclassic-operator
    spec:
      replicas: 1
      selector:
        matchLabels:
          name: timestenclassic-operator
      template:
        metadata:
          labels:
            name: timestenclassic-operator
        spec:
          serviceAccountName: timestenclassic-operator
          imagePullSecrets:
          - name: sekret
          containers:
            - name: timestenclassic-operator
              image: phx.ocir.io/youraccount/ttclassic-operator:3
              command:
              - timestenclassic-operator
              imagePullPolicy: Always
              env:
                - name: WATCH_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.namespace
                - name: POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
                - name: OPERATOR_NAME
                  value: "timestenclassic-operator"
                - name: GODEBUG
                  value: "x509ignoreCN=0"
    
  2. new_kube_files/deployディレクトリから、kubectl replaceコマンドを使用して、timestenclassic-operatorデプロイメントを更新します。

    % kubectl replace -f operator.yaml
    deployment.apps/timestenclassic-operator replaced
    
  3. kubectl get podsコマンドを使用して、新しいオペレータ(この例では、太字表示のtimestenclassic-operator-846cb5c97c-sbz22)が実行されていることを確認します。

    % kubectl get pods
    NAME                                       READY   STATUS    RESTARTS   AGE
    sample-0                                    2/2     Running   0          3h37m
    sample-1                                    2/2     Running   0          3h37m
    sample2-0                                   2/2     Running   0          3h28m
    sample2-1                                   2/2     Running   0          3h28m
    timestenclassic-operator-846cb5c97c-sbz22   1/1     Running   0          80s
    
  4. kubectl describe deploymentコマンドを使用すると、新しいtimetenclassic-operatorデプロイメントを表示できます。オペレータがphx.ocir.io/youraccount/ttclassic-operator:3イメージ(太字で表示)を使用している点に注目してください。

    % kubectl describe deployment timestenclassic-operator
    Name:                   timestenclassic-operator
    Namespace:              mynamespace
    CreationTimestamp:      Sun, 11 Apr 2021 13:40:36 +0000
    Labels:                 name=timestenclassic-operator
    Annotations:            deployment.kubernetes.io/revision: 2
    Selector:               name=timestenclassic-operator
    Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 
    unavailable
    StrategyType:           RollingUpdate
    MinReadySeconds:        0
    RollingUpdateStrategy:  25% max unavailable, 25% max surge
    Pod Template:
      Labels:           name=timestenclassic-operator
      Service Account:  timestenclassic-operator
      Containers:
       timestenclassic-operator:
        Image:      phx.ocir.io/youraccount/ttclassic-operator:3
        Port:       <none>
        Host Port:  <none>
        Command:
          timestenclassic-operator
        Environment:
          WATCH_NAMESPACE:   (v1:metadata.namespace)
          POD_NAME:          (v1:metadata.name)
          OPERATOR_NAME:    timestenclassic-operator
          GODEBUG:          x509ignoreCN=0
        Mounts:             <none>
      Volumes:              <none>
    Conditions:
      Type           Status  Reason
      ----           ------  ------
      Available      True    MinimumReplicasAvailable
      Progressing    True    NewReplicaSetAvailable
    OldReplicaSets:  <none>
    NewReplicaSet:   timestenclassic-operator-846cb5c97c (1/1 replicas created)
    Events:
      Type    Reason             Age    From                   Message
      ----    ------             ----   ----                   -------
      Normal  ScalingReplicaSet  4m19s  deployment-controller  Scaled up replica 
    set timestenclassic-operator-846cb5c97c to 1
      Normal  ScalingReplicaSet  3m51s  deployment-controller  Scaled down replica 
    set timestenclassic-operator-66bd4bc88b to 0
    

timestenclassic-operatorデプロイメントが正常に更新されました。新しいオペレータは、Kubernetesクラスタ内の既存のTimesTenClassicオブジェクトの管理を自動的に開始します。

TimesTenのアップグレード

オペレータのアップグレード後に、TimesTenデータベースのアクティブ・スタンバイ・ペアをTimesTenの新しいパッチにアップグレードする必要があります。これには、新しいTimesTenリリースを含む新しいコンテナ・イメージの作成と、各TimesTenClassicオブジェクトのimage値をこの新しいコンテナ・イメージの名前に変更することが必要になります。

image値を変更すると、オペレータは変更を認識して、StatefulSet内の対応するimage属性を変更します。

次に何が起こるかは、TimesTenClassicオブジェクトのimageUpgradeStrategy要素の値に依存します。imageUpgradeStrategyの詳細は、TimesTenClassicSpecSpecを参照してください。値が次の場合:

  • auto (または指定なし): 実行する必要がある追加のステップはありません。ただし、アップグレードの進捗状況を監視し、アップグレードが成功したことを確認できます。

  • manual: 完了する必要がある追加のステップがあります。これらのステップには、スタンバイ・データベースのアップグレードと、アクティブ・データベースからスタンバイ・データベースへのフェイルオーバーのステップの実行が含まれます。アップグレードが成功したことを確認することもできます。

次の各項では、TimesTenデータベースの各アクティブ・スタンバイ・ペアをアップグレードするために必要なステップについて説明します。例として、アップグレードが必要な2つのTimesTenClassicオブジェクト(sampleおよびsample2)があります。サンプルのTimesTenClassicオブジェクト(imageUpgradeStrategy値がauto)が最初にアップグレードされます。次に、sample2 TimesTenClassicオブジェクト(imageUpgradeStrategy値がmanual)がアップグレードされます。

新しいTimesTenイメージの作成

この項では、コンテナ・イメージとしてTimesTenを作成し、そのイメージをイメージ・レジストリにプッシュする方法について説明します。新しいTimesTenイメージの作成に必要なファイルは、new_kube_filesディレクトリ・ツリーに示されます。詳細は、「新しいリリースのTimesTenオペレータのダウンロード」を参照してください。

新しいTimesTenコンテナ・イメージを作成するには、次のステップを実行します。

  1. new_kube_files/ttimageディレクトリに移動して、そのディレクトリにTimesTenのディストリビューションをコピーします。この例は、new_installation_dirディレクトリにtimesten1814110.server.linux8664.zipディストリビューションをダウンロードしたと仮定しています。詳細は、「新しいリリースのTimesTenオペレータのダウンロード」を参照してください。その次に、timesten1814110.server.linux8664.zipファイルがnew_kube_files/ttimageディレクトリにあることを確認します。

    % cd new_kube_files/ttimage
    % cp new_installation_dir/timesten1814110.server.linux8664.zip .
    % ls *.zip
    timesten1814110.server.linux8664.zip
    
  2. new_kube_files/ttimageディレクトリに移動します(このディレクトリに移動していない場合)。Dockerfileを編集し、timesten1814110.server.linux8664.zipをTimesTenのフル・ディストリビューションの名前に置き換えます。TimesTenのディストリビューションがtimesten1814110.server.linux8664.zipの場合、変更の必要はありません。そうでない場合、必要な変更は太字で表示されます。

    % cd new_kube_files/ttimage
    % vi Dockerfile
    
    # Copyright (c) 2019, 2021, Oracle and/or its affiliates.
     
    FROM container-registry.oracle.com/os/oraclelinux:7
     
    ARG TT_DISTRO=timesten1814110.server.linux8664.zip
     
    RUN yum -y install tar gzip vim curl unzip libaio util-linux
    RUN groupadd -g 333 oracle
    RUN useradd -M -d /tt/home/oracle -s /bin/bash -u 333 -g oracle oracle
    RUN install -d -m 0750 -o oracle -g oracle /home/oracle
    COPY --chown=oracle:oracle $TT_DISTRO /home/oracle/
    COPY --chown=oracle:oracle .bashrc starthost.pl .ttdrop .ttdotversion agent2 
    create1.sql create2.sql get1.sql repcreate.sql repduplicate.sql runsql.sql 
    pausecg.sql /home/oracle/
    # Uncomment the following line if you are using the optional non-root 
    installation procedure.
    # USER 333
    ENTRYPOINT "/home/oracle/starthost.pl"
    
  3. dockerコマンドを使用して、新しいTimesTenコンテナ・イメージを作成します。tt1814110:3は、適宜の名前に置き換えます(次のdocker buildコマンドの太字で表示している部分)。出力はリリースごとに変わる可能性があることに注意してください。

    % docker build -t tt1814110:3 .
    
    Sending build context to Docker daemon  445.8MB
    Step 1/9 : FROM container-registry.oracle.com/os/oraclelinux:7
     ---> d788eca028a0
    Step 2/9 : ARG TT_DISTRO=timesten1814110.server.linux8664.zip
     ---> Using cache
     ---> a259a93fe906
    Step 3/9 : RUN yum -y install tar gzip vim curl unzip libaio util-linux
     ---> Using cache
     ---> ac676b5376f3
    Step 4/9 : RUN groupadd -g 333 oracle
     ---> Using cache
     ---> ce16920f085c
    Step 5/9 : RUN useradd -M -d /tt/home/oracle -s /bin/bash -u 333 -g oracle 
    oracle
     ---> Using cache
     ---> 0319814aca1c
    Step 6/9 : RUN install -d -m 0750 -o oracle -g oracle /home/oracle
     ---> Using cache
     ---> c8612b53398a
    Step 7/9 : COPY --chown=oracle:oracle $TT_DISTRO /home/oracle/
     ---> 31cae98b71fd
    Step 8/9 : COPY --chown=oracle:oracle .bashrc starthost.pl .ttdrop 
    .ttdotversion agent2 create1.sql create2.sql get1.sql repcreate.sql 
    repduplicate.sql runsql.sql pausecg.sql /home/oracle/
     ---> e50eb99c9b54
    Step 9/9 : ENTRYPOINT "/home/oracle/starthost.pl"
     ---> Running in 0b41efd38837
    Removing intermediate container 0b41efd38837
     ---> 171245e546d5
    Successfully built 171245e546d5
    Successfully tagged tt1814110:3
    
  4. dockerコマンドを使用して、新しいTimesTenコンテナ・イメージにタグを付けます。次のdocker tagコマンドで太字で表示されている次のものを置き換えます。

    • tt1814110:3: 前のステップで選択した名前に置き換えます。

    • phx.ocir.io/youraccount: イメージ・レジストリの場所に置き換えます。

    % docker tag tt1814110:3 phx.ocir.io/youraccount/tt1814110:3
    
  5. dockerコマンドを使用して、新しいTimesTenコンテナ・イメージをレジストリにプッシュします。次のdocker pushコマンドで太字で表示されている次のものを置き換えます。

    • phx.ocir.io/youraccount: イメージ・レジストリの場所に置き換えます。

    • tt1814110:3: 前に選択した名前に置き換えます。

    % docker push phx.ocir.io/youraccount/tt1814110:3
    
    The push refers to repository [phx.ocir.io/youraccount/tt1814110]
    97a0f250b2fe: Pushed
    650b003a3ad4: Pushed
    b8de51528854: Pushed
    62192d26e325: Pushed
    7dfe13e9b5a4: Pushed
    d8570fce965c: Pushed
    2f915858a916: Layer already exists
    3: digest: 
    sha256:a6ac313394229eb2256d4a56fbcd8e2eda50ea2cc21991fa76f11701f2299710 
    size: 1788
    

新しいTimesTenコンテナ・イメージを正常に作成しました。イメージ・レジストリにプッシュされます。アップグレードする各TimesTenClassicオブジェクトのアップグレード方法を確認する準備が整いました。

各TimesTenClassicオブジェクトのアップグレード方法の確認

TimesTenClassicオブジェクトの各imageUpgradeStrategy要素の値によって、アップグレードのタイプが決まります。値がauto (または指定なし)の場合、アップグレード方法は自動であり、オペレータがこのTimesTenClassicオブジェクトのアップグレードを実行します。値がmanualの場合、アップグレード方法は手動であり、TimesTenClassicオブジェクトのアップグレードを手動で実行する必要があります。

この例では、KubernetesクラスタにデプロイされたTimesTenClassicオブジェクトのimageUpgradeStrategyを決定する方法を示します。

  1. Kubernetesクラスタで実行しているTimesTenClassicオブジェクトを確認します。2つのTimesTenClassicオブジェクトが実行されています(この例ではsampleおよびsample2)。

    % kubectl get ttc
    NAME      STATE    ACTIVE      AGE
    sample    Normal   sample-0    2d3h
    sample2   Normal   sample2-0   2d3h
    
  2. kubectl describeコマンドを使用して、sample TimesTenClassicオブジェクトを表示します。sample TimesTenClassicオブジェクトのimageUpdateStrategyautoに設定されていることに注意してください(太字で表示)。これは、自動アップグレード方法を示します。また、upgradeDownPodTimeout900に設定されています(太字で表示)。

    % kubectl describe ttc sample
    Name:         sample
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
    API Version:  timesten.oracle.com/v1
    Kind:         TimesTenClassic
    Metadata:
      Creation Timestamp:  2021-04-11T13:58:09Z
      Generation:          1
      Resource Version:    150145728
      Self Link:       
      /apis/timesten.oracle.com/v1/namespaces/mynamespace/timestenclassics/sample
      UID:                 f2a16dff-9acd-11eb-86a3-06b2b9dd76bc
    Spec:
      Ttspec:
        Db Config Map:
          sample
        Image:                     phx.ocir.io/youraccount/tt181440:2
        Image Pull Policy:         Always
        Image Pull Secret:         sekret
        Image Upgrade Strategy:    auto
        Storage Class Name:        oci
        Storage Size:              250G
        Upgrade Down Pod Timeout:  900
    ...
    
  3. kubectl describeコマンドを使用して、sample2 TimesTenClassicオブジェクトを表示します。sample2 TimesTenClassicオブジェクトのimageUpdateStrategymanualに設定されていることに注意してください(太字で表示)。これは手動アップグレード方法を示します。

    % kubectl describe ttc sample2
    Name:         sample2
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
    API Version:  timesten.oracle.com/v1
    Kind:         TimesTenClassic
    Metadata:
      Creation Timestamp:  2021-04-11T14:07:20Z
      Generation:          1
      Resource Version:    150149654
      Self Link:    
      /apis/timesten.oracle.com/v1/namespaces/mynamespace/timestenclassics/sample2
      UID:                 3af3e6fb-9acf-11eb-8286-6a1fd5dce8ff
    Spec:
      Ttspec:
        Db Config Map:
          sample2
        Image:                   phx.ocir.io/youraccount/tt181440:2
        Image Pull Policy:       Always
        Image Pull Secret:       sekret
        Image Upgrade Strategy:  manual
        Storage Class Name:      oci
        Storage Size:            250G
    ...
    

Kubernetesクラスタの各TimesTenClassicオブジェクトに対して自動アップグレードまたは手動アップグレードのどちらが実行されるかを正常に確認しました。これで、アップグレード・プロセスを続行する準備が整いました。この例では、最初にsample TimesTenClassicオブジェクトをアップグレードします。sample TimesTenClassicオブジェクトのアップグレード方法はautoであるため、自動アップグレードの実行に進み、アップグレード手順を続行します。(ノート: sample2 TimesTenClassicオブジェクトを最初にアップグレードすることもできます。順序は関係ありません。)

自動アップグレードの実行

この項では、自動アップグレードに必要な操作について説明します。手動アップグレードを実行する場合は、手動アップグレードの実行を参照してください。

自動アップグレード・プロセスでは、新しいTimesTenイメージ(この例では18.1.4.11.0)を参照するようにTimesTenClassicオブジェクトのイメージ値を変更する必要があります。新しいTimesTenイメージを参照するようにTimesTenClassicオブジェクトを変更すると、オペレータは変更を認識して、オペレータが作成したStatefulSetを変更します。その後、オペレータがアップグレード・プロセスを開始します。kubectl describeコマンドを使用して、このアップグレード・プロセスを監視できます。


ノート:

自動アップグレードを実行すると、データベースが停止して再起動され、すぐにフェイルオーバーされます。本番日の最も忙しい時間にこの手順を実行しないでください。アップグレード手順の結果として、アプリケーションが短時間停止します。

TimesTenClassicオブジェクトの変更: 自動アップグレード

新しいTimesTenイメージを参照するようにTimesTenClassicオブジェクトを変更する必要があります。これを行うには、TimesTenClassicオブジェクトのimage CRD構文要素の値を変更します。image要素の詳細は、TimesTenClassicSpecSpecを参照してください。

sample TimesTenClassicオブジェクトのimageUpgradeStrategyの値はautoで、オペレータがアップグレードを実行することを示します。新しいTimesTenイメージを参照するようにsample TimesTenClassicオブジェクトのimage値を編集すると、オペレータは変更を認識して、StatefulSetを変更し、自動アップグレード・プロセスを開始します。

  1. kubectl editコマンドを使用して、sample TimesTenClassicオブジェクトを編集し、新しいTimesTenイメージ(この例では、太字表示のphx.ocir.io/youraccount/tt1814110:3)を参照するように.spec.ttspec.image属性を変更します。

    ノート: 出力のすべては示していません。

    % kubectl edit timestenclassic sample
    
    # Please edit the object below. Lines beginning with a '#' will be ignored,
    # and an empty file will abort the edit. If an error occurs while saving this 
    file will be
    # reopened with the relevant failures.
    #
    apiVersion: timesten.oracle.com/v1
    kind: TimesTenClassic
    ...
      name: sample
    ...
    spec:
      ttspec:
        dbConfigMap:
        - sample
        image: phx.ocir.io/youraccount/tt1814110:3
        imagePullPolicy: Always
        imagePullSecret: sekret
        imageUpgradeStrategy: manual
        storageClassName: oci
        storageSize: 250G
    ...
    timestenclassic.timesten.oracle.com/sample edited
    
  2. kubectl describe statefulsetコマンドを使用して、オペレータがsample StatefulSetを変更したこと、イメージを新しいイメージ(この例では、太字表示のphx.ocir.io/youraccount/tt1814110:3)に置き換えたことを確認します。

    % kubectl describe statefulset sample
    Name:               sample
    Namespace:          mynamespace
    CreationTimestamp:  Sun, 11 Apr 2021 13:58:10 +0000
    Selector:           app=sample
    Labels:             app=sample
    Annotations:        <none>
    Replicas:           2 desired | 2 total
    Update Strategy:    OnDelete
    Pods Status:        1 Running / 1 Waiting / 0 Succeeded / 0 Failed
    Pod Template:
      Labels:  app=sample
      Init Containers:
       ttinit:
        Image:       phx.ocir.io/youraccount/tt1814110:3
        Ports:       8443/TCP, 6624/TCP, 6625/TCP, 4444/TCP
        Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP
        Command:
          perl
          /home/oracle/starthost.pl
        Environment:
          TIMESTEN_HOME:            /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH:   
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
          TT_REPLICATION_TOPOLOGY:  activeStandbyPair
          TT_INIT_CONTAINER:        1
        Mounts:
          /tt from tt-persistent (rw)
          /ttagent from tt-agent (rw)
          /ttconfig from tt-config (rw)
      Containers:
       tt:
        Image:       phx.ocir.io/youraccount/tt1814110:3
        Ports:       8443/TCP, 6624/TCP, 6625/TCP, 4444/TCP
        Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP
        Command:
          perl
          /home/oracle/starthost.pl
        Environment:
          TIMESTEN_HOME:            /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH:   
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
          TT_REPLICATION_TOPOLOGY:  activeStandbyPair
        Mounts:
          /tt from tt-persistent (rw)
          /ttagent from tt-agent (rw)
          /ttconfig from tt-config (rw)
       daemonlog:
        Image:      phx.ocir.io/youraccount/tt1814110:3
        Port:       <none>
        Host Port:  <none>
        Command:
          sh
          -c
          /bin/bash <<'EOF'
          while [ 1 ] ; do tail --follow=name 
    /tt/home/oracle/instances/instance1/diag/ttmesg.log --max-unchanged-stats=5; 
    sleep 1; done
          exit 0
          EOF
        Requests:
          cpu:     100m
          memory:  20Mi
        Environment:
          TIMESTEN_HOME:    /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH: 
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
        Mounts:
          /tt from tt-persistent (rw)
      Volumes:
       tt-agent:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  ttf2a16dff-9acd-11eb-86a3-06b2b9dd76bc
        Optional:    false
       tt-config:
        Type:               Projected (a volume that contains injected data from 
    multiple sources)
        ConfigMapName:      sample
        ConfigMapOptional:  <nil>
    Volume Claims:
      Name:          tt-persistent
      StorageClass:  oci
      Labels:        <none>
      Annotations:   <none>
      Capacity:      250G
      Access Modes:  [ReadWriteOnce]
    Events:
      Type    Reason            Age   From                    Message
      ----    ------            ----  ----                    -------
      Normal  SuccessfulCreate  7s    statefulset-controller  create Pod sample-1 
    in StatefulSet sample successful
    

新しいTimesTenイメージを使用するようにTimesTenClassicオブジェクトのsampleを正常に変更しました。これで、オペレータが実行する自動アップグレード・プロセスを監視する準備が整いました。自動アップグレードの監視に進み、続行します。

自動アップグレードの監視

オペレータによって実行される自動アップグレード・プロセスを監視できます。

  1. kubectl getコマンドを使用して、sample TimesTenClassicオブジェクトの状態を評価します。

    状態はStandbyDown (太字で表示)になっている点に注目してください。

    % kubectl get ttc sample
    NAME     STATE         ACTIVE     AGE
    sample   StandbyDown   sample-1   2d5h
    

    数分間待機してから、コマンドを再実行します。状態がNormal (太字で表示)に変化した点に注目してください。

    % kubectl get ttc sample
    NAME     STATE    ACTIVE     AGE
    sample   Normal   sample-1   2d5h
    
  2. kubectl describeコマンドを使用して、オペレータがスタンバイ・データベース(sample-1)をアクティブに昇格させる方法を確認します。また、スタンバイ・データベースとアクティブ・データベースの両方がTimesTenの新しいリリース(この例では18.1.4.11.0)にアップグレードされていることに注意してください。

    % kubectl describe ttc sample
    Name:         sample
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
    API Version:  timesten.oracle.com/v1
    Kind:         TimesTenClassic
    Metadata:
      Creation Timestamp:  2021-04-11T13:58:09Z
      Generation:          2
      Resource Version:    150178771
      Self Link:      
    /apis/timesten.oracle.com/v1/namespaces/mynamespace/timestenclassics/sample
      UID:                 f2a16dff-9acd-11eb-86a3-06b2b9dd76bc
    Spec:
      Ttspec:
        Db Config Map:
          sample
        Image:                     phx.ocir.io/youraccount/tt1814110:3
        Image Pull Policy:         Always
        Image Pull Secret:         sekret
        Image Upgrade Strategy:    auto
        Storage Class Name:        oci
        Storage Size:              250G
        Upgrade Down Pod Timeout:  900
    Status:
      Classic Upgrade Status:
        Active Start Time:           0
        Active Status:
        Image Update Pending:        false
        Last Upgrade State Switch:   0
        Prev Reset Upgrade State:
        Prev Upgrade State:
        Standby Start Time:          0
        Standby Status:
        Upgrade Start Time:          0
        Upgrade State:
      Active Pods:                   sample-1
      High Level State:              Normal
      Last Event:                    67
      Last High Level State Switch:  1618341354
      Pod Status:
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       35425
          Db Updatable:                No
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618341923
          Pod IP:               10.244.7.46
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  1618341175
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    STANDBY
        Times Ten Status:
          Daemon:          Up
          Instance:        Exists
          Release:         18.1.4.11.0
        Admin User File:   true
        Cache User File:   false
        Cg File:           false
        Disable Return:    false
        High Level State:  Healthy
        Intended State:    Standby
        Local Commit:      false
        Name:              sample-0
        Schema File:       true
        Using Twosafe:     false
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       35426
          Db Updatable:                Yes
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618341923
          Pod IP:               10.244.6.25
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  1618340980
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    ACTIVE
        Times Ten Status:
          Daemon:             Up
          Instance:           Exists
          Release:            18.1.4.11.0
        Admin User File:      true
        Cache User File:      false
        Cg File:              false
        Disable Return:       false
        High Level State:     Healthy
        Intended State:       Active
        Local Commit:         false
        Name:                 sample-1
        Schema File:          true
        Using Twosafe:        false
      Prev High Level State:  StandbyDown
      Prev Reexamine:
      Prev Stop Managing:
      Rep Create Statement:   create active standby pair "sample" on 
    "sample-0.sample.mynamespace.svc.cluster.local", "sample" on 
    "sample-1.sample.mynamespace.svc.cluster.local" NO RETURN store "sample" on 
    "sample-0.sample.mynamespace.svc.cluster.local" PORT 4444 FAILTHRESHOLD 0 
    store "sample" on "sample-1.sample.mynamespace.svc.cluster.local" PORT 4444 
    FAILTHRESHOLD 0
      Rep Port:               4444
      Status Version:         1.0
    Events:
      Type  Reason       Age    From       Message
      ----  ------       ----   ----       -------
      -     StateChange  15m    ttclassic  Image updated, automatic upgrade 
    started
      -     StateChange  15m    ttclassic  Deleted STANDBY pod sample-1 per 
    upgrade
      -     StateChange  15m    ttclassic  TimesTenClassic was Normal, now
    ActiveTakeover
      -     StateChange  15m    ttclassic  TimesTenClassic was ActiveTakeover, now
    StandbyDown
      -     StateChange  13m    ttclassic  Pod sample-1 Agent Up
      -     StateChange  13m    ttclassic  Pod sample-1 Release 18.1.4.11.0
      -     StateChange  13m    ttclassic  Pod sample-1 Instance Exists
      -     StateChange  13m    ttclassic  Pod sample-1 Daemon Up
      -     StateChange  13m    ttclassic  Pod sample-1 Database None
      -     StateChange  12m    ttclassic  Pod sample-1 RepState IDLE
      -     StateChange  12m    ttclassic  Pod sample-1 Database Loaded
      -     StateChange  12m    ttclassic  Pod sample-1 CacheAgent Not Running
      -     StateChange  12m    ttclassic  Pod sample-1 RepAgent Not Running
      -     StateChange  12m    ttclassic  Pod sample-1 RepScheme Exists
      -     StateChange  12m    ttclassic  Pod sample-1 Database Not Updatable
      -     StateChange  12m    ttclassic  Pod sample-1 RepAgent Running
      -     StateChange  12m    ttclassic  Pod sample-1 RepState STANDBY
      -     StateChange  12m    ttclassic  TimesTenClassic was StandbyDown, now 
    Normal
      -     StateChange  12m    ttclassic  Deleted ACTIVE pod sample-0 per upgrade
      -     StateChange  12m    ttclassic  TimesTenClassic was Normal, now 
    ActiveDown
      -     StateChange  12m    ttclassic  TimesTenClassic was ActiveDown, now 
    ActiveTakeover
      -     StateChange  12m    ttclassic  Pod sample-1 RepState ACTIVE
      -     StateChange  12m    ttclassic  Pod sample-1 Database Updatable
      -     StateChange  12m    ttclassic  TimesTenClassic was ActiveTakeover, now 
    StandbyDown
      -     StateChange  10m    ttclassic  Pod sample-0 Agent Up
      -     StateChange  10m    ttclassic  Pod sample-0 Instance Exists
      -     StateChange  10m    ttclassic  Pod sample-0 Daemon Up
      -     StateChange  10m    ttclassic  Pod sample-0 Database None
      -     StateChange  10m    ttclassic  Pod sample-0 Release 18.1.4.11.0
      -     StateChange  9m38s  ttclassic  Pod sample-0 RepState IDLE
      -     StateChange  9m38s  ttclassic  Pod sample-0 Database Loaded
      -     StateChange  9m38s  ttclassic  Pod sample-0 Database Not Updatable
      -     StateChange  9m38s  ttclassic  Pod sample-0 RepAgent Not Running
      -     StateChange  9m38s  ttclassic  Pod sample-0 RepScheme Exists
      -     StateChange  9m38s  ttclassic  Pod sample-0 CacheAgent Not Running
      -     StateChange  9m32s  ttclassic  Pod sample-0 RepAgent Running
      -     StateChange  9m32s  ttclassic  Pod sample-0 RepState STANDBY
      -     StateChange  9m32s  ttclassic  Upgrade of ACTIVE complete
      -     StateChange  9m32s  ttclassic  Upgrade completed in 385 secs
      -     StateChange  9m32s  ttclassic  TimesTenClassic was StandbyDown, now 
    Normal
    

自動アップグレードが成功しました。この時点で、アクティブ・ポッドとスタンバイ・ポッドは、新しいTimesTenリリースが含まれている新しいTimesTenイメージを実行しています。追加のTimesTenClassicオブジェクトをアップグレードする必要がある場合は、自動アップグレードの場合は自動アップグレードの実行を、手動アップグレードの場合は手動アップグレードの実行を参照してください。すべてのTimesTenClassicオブジェクトに対してアップグレード・プロセスが完了している場合は、データベースのアクティブ・スタンバイ・ペアのアップグレードの確認を参照して、Kubernetesクラスタで実行されているすべてのTimesTenClassicオブジェクトのアップグレードを確認します。

この例では、次にsample2 TimesTenClassicオブジェクトをアップグレードします。このTimesTenClassicオブジェクトのimageUpgradePolicyの値はmanualであることに注意してください。したがって、手動アップグレードの実行に進み、sample2 TimesTenClassicオブジェクトのアップグレードを完了します。

手動アップグレードの実行

この項では、手動アップグレードに必要な操作について説明します。自動アップグレードを実行する場合、詳細は、自動アップグレードの実行を参照してください。

TimesTenClassicオブジェクトの変更: 手動アップグレード

新しいTimesTenイメージを参照するようにTimesTenClassicオブジェクトを変更する必要があります。これを行うには、TimesTenClassicオブジェクトのimage CRD構文要素の値を変更します。image要素の詳細は、TimesTenClassicSpecSpecを参照してください。

sample2 TimesTenClassicオブジェクトのimageUpgradeStrategyの値はmanualで、アップグレードを手動で実行することを示します。新しいTimesTenイメージを参照するようにsample2 TimesTenClassicオブジェクトのimage値を編集すると、オペレータは変更を認識して、StatefulSetを変更します。オペレータはポッドを再起動しません。かわりに、ポッドが実行するイメージをアップグレードします。(後述するスタンバイ・データベースのアップグレードおよびフェイルオーバーという項では、ポッドを再起動するステップについて詳しく説明します。)

  1. 元のsample2.yamlファイルを確認します。.spec.ttspec.imageは、phx.ocir.io/youraccount/tt181440:2イメージ(太字で表示)を参照している点に注目してください。また、imageUpgradeStrategyの値はmanualです(太字で表示)。

    % cat sample2.yaml
    apiVersion: timesten.oracle.com/v1
    kind: TimesTenClassic
    metadata:
     name: sample2
    spec:
      ttspec:
        storageClassName: oci
        storageSize: 250G
        image: phx.ocir.io/youraccount/tt181440:2
        imagePullSecret: sekret
        imagePullPolicy: Always
        dbConfigMap:
        - sample2
        imageUpgradeStrategy: manual
    
  2. kubectl editコマンドを使用して、sample2 TimesTenClassicオブジェクトを編集し、新しいTimesTenイメージ(この例では、太字表示のphx.ocir.io/youraccount/tt1814110:3)を参照するように.spec.ttspec.image属性を変更します。

    ノート: 出力のすべては示していません。

    % kubectl edit timestenclassic sample2
    
    # Please edit the object below. Lines beginning with a '#' will be ignored,
    # and an empty file will abort the edit. If an error occurs while saving this 
    file will be
    # reopened with the relevant failures.
    #
    apiVersion: timesten.oracle.com/v1
    kind: TimesTenClassic
    ...
    spec:
      ttspec:
        dbConfigMap:
        - sample2
        image: phx.ocir.io/youraccount/tt1814110:3
        imagePullPolicy: Always
        imagePullSecret: sekret
        imageUpgradeStrategy: manual
        storageClassName: oci
        storageSize: 250G
    ...
    timestenclassic.timesten.oracle.com/sample2 edited
    
  3. kubectl describe statefulsetコマンドを使用して、オペレータがsample2 StatefulSetを変更したこと、イメージを新しいイメージ(この例では、太字表示のphx.ocir.io/youraccount/tt1814110:3)に置き換えたことを確認します。

    % kubectl describe statefulset sample2
    Name:               sample2
    Namespace:          mynamespace
    CreationTimestamp:  Sun, 11 Apr 2021 14:07:21 +0000
    Selector:           app=sample2
    Labels:             app=sample2
    Annotations:        <none>
    Replicas:           2 desired | 2 total
    Update Strategy:    OnDelete
    Pods Status:        2 Running / 0 Waiting / 0 Succeeded / 0 Failed
    Pod Template:
      Labels:  app=sample2
      Init Containers:
       ttinit:
        Image:       phx.ocir.io/youraccount/tt1814110:3
        Ports:       8443/TCP, 6624/TCP, 6625/TCP, 4444/TCP
        Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP
        Command:
          perl
          /home/oracle/starthost.pl
        Environment:
          TIMESTEN_HOME:            /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH:  
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
          TT_REPLICATION_TOPOLOGY:  activeStandbyPair
          TT_INIT_CONTAINER:        1
        Mounts:
          /tt from tt-persistent (rw)
          /ttagent from tt-agent (rw)
          /ttconfig from tt-config (rw)
      Containers:
       tt:
        Image:       phx.ocir.io/youraccount/tt1814110:3
        Ports:       8443/TCP, 6624/TCP, 6625/TCP, 4444/TCP
        Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP
        Command:
          perl
          /home/oracle/starthost.pl
        Environment:
          TIMESTEN_HOME:            /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH:     
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
          TT_REPLICATION_TOPOLOGY:  activeStandbyPair
        Mounts:
          /tt from tt-persistent (rw)
          /ttagent from tt-agent (rw)
          /ttconfig from tt-config (rw)
       daemonlog:
        Image:      phx.ocir.io/youraccount/tt1814110:3
        Port:       <none>
        Host Port:  <none>
        Command:
          sh
          -c
          /bin/bash <<'EOF'
          while [ 1 ] ; do tail --follow=name
    /tt/home/oracle/instances/instance1/diag/ttmesg.log --max-unchanged-stats=5;
    sleep 1; done
          exit 0
          EOF
        Requests:
          cpu:     100m
          memory:  20Mi
        Environment:
          TIMESTEN_HOME:    /tt/home/oracle/instances/instance1
          LD_LIBRARY_PATH: 
    /tt/home/oracle/instances/instance1/ttclasses/lib:/tt/home/oracle/instances/
    instance1/install/lib:/tt/home/oracle/instances/instance1/install/
    ttoracle_home/instantclient_11_2
        Mounts:
          /tt from tt-persistent (rw)
      Volumes:
       tt-agent:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  tt3af3e6fb-9acf-11eb-8286-6a1fd5dce8ff
        Optional:    false
       tt-config:
        Type:               Projected (a volume that contains injected data from 
    multiple sources)
        ConfigMapName:      sample2
        ConfigMapOptional:  <nil>
    Volume Claims:
      Name:          tt-persistent
      StorageClass:  oci
      Labels:        <none>
      Annotations:   <none>
      Capacity:      250G
      Access Modes:  [ReadWriteOnce]
    Events:          <none>
    

新しいTimesTenイメージを使用するようにTimesTenClassicオブジェクトのsample2を正常に変更しました。これで、手動アップグレードを続行する準備が整いました。スタンバイ・データベースのアップグレードに進み、この手動アップグレードを続行します。

スタンバイ・データベースのアップグレード

次のステップを実行して、スタンバイ・データベースをアップグレードします。


ノート:

スタンバイ・データベースをアップグレードする場合でも、レプリケーション構成によっては、アクティブ・データベースが中断する可能性があります。これは、アプリケーションに影響を与える可能性があります。適切なタイミングでアップグレードを実行してください。

  1. kubectl get podsコマンドを使用して、ポッドを確認します。この例では、sample2-0およびsample2-1ポッドが表示されています。

    % kubectl get pods
    NAME                                       READY   STATUS    RESTARTS   AGE
    sample2-0                                  2/2     Running   0          2d6h
    sample2-1                                  2/2     Running   0          2d6h
    
  2. kubectl get ttcコマンドを使用して、次の作業を実行します。

    • どのポッドがスタンバイかを判別します。アクティブ・ポッドは、ACTIVE列に示されるポッドです。スタンバイ・ポッドは、それ以外のポッド(ACTIVE列に示されないもの)です。そのため、sample2 TimesTenClassicオブジェクトの場合、アクティブ・ポッドはsample2-0 (太字で表示)で、スタンバイ・ポッドはsample2-1です。

    • TimesTenClassicオブジェクト(この例ではsample2)の状態がNormal (太字で表示)になっていることを確認します。

    % kubectl get ttc sample2
    NAME     STATE    ACTIVE     AGE
    sample2  Normal   sample2-0   2d6h
    
  3. スタンバイを新しいTimesTenイメージにアップグレードするには、スタンバイ・ポッド(この例ではsample2-1)を削除します。

    % kubectl delete pod sample2-1
    pod "sample2-1" deleted
    

    削除されたポッドを置き換えるために、Kubernetesは新しいsample2-1ポッドを自動的に作成します。オペレータは、新しいsample2-1ポッドをスタンバイ・ポッドとして構成します。この時点で、この新しいポッドは新しく作成したTimesTenイメージを実行するようになります。

  4. kubectl getコマンドを使用して、スタンバイが稼働中であり、状態がNormalになっていることを確認します。

    状態はStandbyDown (太字で表示)になっている点に注目してください。

    % kubectl get ttc sample2
    NAME     STATE         ACTIVE     AGE
    sample2  StandbyDown   sample2-0   2d6h
    

    数分間待機してから、コマンドを再実行します。状態がNormal (太字で表示)に変化した点に注目してください。

    % kubectl get ttc sample2
    NAME     STATE    ACTIVE     AGE
    sample2  Normal   sample2-0   2d6h
    
  5. kubectl describeコマンドを使用して、スタンバイが稼働中であることを再確認し、アクティブ・スタンバイ・ペアの状態がNormalになっていることを確認します。スタンバイのアップグレード時に、アプリケーションが中断されることはありません。アプリケーションは、アクティブ・データベースの使用を継続できます。

    この例では、次の点に注目してください。

    • イメージが新しいリリース(太字で表示しているphx.ocir.io/youraccount/tt1814110:3)にアップグレードされています。

    • アクティブ・データベース(sample2-0)は新しいリリースにアップグレードされていません。(リリースは、太字で表示している18.1.4.4.0のままです)。

    • スタンバイ・データベース(sample2-1)が新しいリリース(太字で表示している18.1.4.11.0)にアップグレードされています。

    % kubectl describe ttc sample2
    Name:         sample2
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
    API Version:  timesten.oracle.com/v1
    Kind:         TimesTenClassic
    Metadata:
      Creation Timestamp:  2021-04-11T14:07:20Z
      Generation:          2
      Resource Version:    150206835
      Self Link:     
    /apis/timesten.oracle.com/v1/namespaces/mynamespace/timestenclassics/sample2
      UID:                 3af3e6fb-9acf-11eb-8286-6a1fd5dce8ff
    Spec:
      Ttspec:
        Db Config Map:
          sample2
        Image:                   phx.ocir.io/youraccount/tt1814110:3
        Image Pull Policy:       Always
        Image Pull Secret:       sekret
        Image Upgrade Strategy:  manual
        Storage Class Name:      oci
        Storage Size:            250G
    Status:
      Classic Upgrade Status:
        Active Start Time:           0
        Active Status:
        Image Update Pending:        true
        Last Upgrade State Switch:   0
        Prev Reset Upgrade State:
        Prev Upgrade State:
        Standby Start Time:          0
        Standby Status:
        Upgrade Start Time:          0
        Upgrade State:
      Active Pods:                   sample2-0
      High Level State:              Normal
      Last Event:                    41
      Last High Level State Switch:  1618347326
      Pod Status:
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       36351
          Db Updatable:                Yes
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618347435
          Pod IP:               10.244.8.199
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  0
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    ACTIVE
        Times Ten Status:
          Daemon:          Up
          Instance:        Exists
          Release:         18.1.4.4.0
        Admin User File:   true
        Cache User File:   false
        Cg File:           false
        Disable Return:    false
        High Level State:  Healthy
        Intended State:    Active
        Local Commit:      false
        Name:              sample2-0
        Schema File:       true
        Using Twosafe:     false
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       36351
          Db Updatable:                No
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618347435
          Pod IP:               10.244.5.156
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  0
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    STANDBY
        Times Ten Status:
          Daemon:             Up
          Instance:           Exists
          Release:            18.1.4.11.0
        Admin User File:      true
        Cache User File:      false
        Cg File:              false
        Disable Return:       false
        High Level State:     Healthy
        Intended State:       Standby
        Local Commit:         false
        Name:                 sample2-1
        Schema File:          true
        Using Twosafe:        false
      Prev High Level State:  StandbyDown
      Prev Reexamine:
      Prev Stop Managing:
      Rep Create Statement:   create active standby pair "sample2" on 
    "sample2-0.sample2.mynamespace.svc.cluster.local", "sample2" on 
    "sample2-1.sample2.mynamespace.svc.cluster.local" NO RETURN store "sample2" 
    on "sample2-0.sample2.mynamespace.svc.cluster.local" PORT 4444 
    FAILTHRESHOLD 0 store "sample2" on 
    "sample2-1.sample2.mynamespace.svc.cluster.local" PORT 4444 
    FAILTHRESHOLD 0
      Rep Port:               4444
      Status Version:         1.0
    Events:
      Type  Reason       Age    From       Message
      ----  ------       ----   ----       -------
      -     StateChange  29m    ttclassic  Image updated, automatic upgrade 
      disabled
      -     StateChange  4m35s  ttclassic  TimesTenClassic was Normal, now 
      ActiveTakeover
      -     StateChange  4m29s  ttclassic  TimesTenClassic was ActiveTakeover, now 
      StandbyDown
      -     StateChange  2m47s  ttclassic  Pod sample2-1 Agent Up
      -     StateChange  2m47s  ttclassic  Pod sample2-1 Release 18.1.4.11.0
      -     StateChange  2m47s  ttclassic  Pod sample2-1 Daemon Up
      -     StateChange  2m47s  ttclassic  Pod sample2-1 Database None
      -     StateChange  118s   ttclassic  Pod sample2-1 Database Loaded
      -     StateChange  118s   ttclassic  Pod sample2-1 Database Not Updatable
      -     StateChange  118s   ttclassic  Pod sample2-1 RepAgent Not Running
      -     StateChange  118s   ttclassic  Pod sample2-1 RepState IDLE
      -     StateChange  113s   ttclassic  Pod sample2-1 RepAgent Running
      -     StateChange  113s   ttclassic  Pod sample2-1 RepState STANDBY
      -     StateChange  113s   ttclassic  TimesTenClassic was StandbyDown, now 
      Normal
    

スタンバイ・データベースを正常にアップグレードしました。これで、アクティブ・データベースからスタンバイにフェイルオーバーする準備が整いました。詳細は、フェイルオーバーを参照してください。

フェイルオーバー

この時点で、アクティブ・データベースからスタンバイ・データベースにフェイルオーバーする必要があります。


ノート:

フェイルオーバーすると、アクティブなデータベースは停止され、すぐにフェイルオーバーされます。本番日の最も忙しい時間にこの手順を実行しないでください。

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

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

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

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


ノート:

この操作は、スケジュールされた本番環境の停止中に実行することをお薦めします。

  1. kubectl deleteコマンドを使用して、アクティブ・ポッド(この例ではsample2-0)を削除します。

    % kubectl delete pod sample2-0
    pod "sample2-0" deleted
    
  2. kubectl describeコマンドを使用して、オペレータがどのように障害からリカバリするかを確認します。オペレータは、スタンバイ・データベース(sample2-1)をアクティブに昇格させます。sample2-0データベースに接続されていたすべてのアプリケーションは、TimesTenによってsample2-1データベースに自動的に再接続されます。短時間の停止後、アプリケーションは引き続きデータベースを使用できます。アクティブ・スタンバイ・ペアの状態の詳細は、データベースのアクティブ・スタンバイ・ペアの状態の監視を参照してください。

    % kubectl describe ttc sample2
    Name:         sample2
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
    API Version:  timesten.oracle.com/v1
    Kind:         TimesTenClassic
    Metadata:
      Creation Timestamp:  2021-04-11T14:07:20Z
      Generation:          2
      Resource Version:    150214843
      Self Link:     
    /apis/timesten.oracle.com/v1/namespaces/mynamespace/timestenclassics/sample2
      UID:                 3af3e6fb-9acf-11eb-8286-6a1fd5dce8ff
    Spec:
      Ttspec:
        Db Config Map:
          sample2
        Image:                   phx.ocir.io/youraccount/tt1814110:3
        Image Pull Policy:       Always
        Image Pull Secret:       sekret
        Image Upgrade Strategy:  manual
        Storage Class Name:      oci
        Storage Size:            250G
    Status:
      Classic Upgrade Status:
        Active Start Time:           0
        Active Status:
        Image Update Pending:        true
        Last Upgrade State Switch:   0
        Prev Reset Upgrade State:
        Prev Upgrade State:
        Standby Start Time:          0
        Standby Status:
        Upgrade Start Time:          0
        Upgrade State:
      Active Pods:                   sample2-1
      High Level State:              Normal
      Last Event:                    57
      Last High Level State Switch:  1618348960
      Pod Status:
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       36623
          Db Updatable:                No
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618349003
          Pod IP:               10.244.6.26
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  0
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    STANDBY
        Times Ten Status:
          Daemon:          Up
          Instance:        Exists
          Release:         18.1.4.11.0
        Admin User File:   true
        Cache User File:   false
        Cg File:           false
        Disable Return:    false
        High Level State:  Healthy
        Intended State:    Standby
        Local Commit:      false
        Name:              sample2-0
        Schema File:       true
        Using Twosafe:     false
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       36624
          Db Updatable:                Yes
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1618349003
          Pod IP:               10.244.5.156
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:             phx.ocir.io/youraccount/tt181440:2
        Replication Status:
          Last Time Rep State Changed:  0
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    ACTIVE
        Times Ten Status:
          Daemon:             Up
          Instance:           Exists
          Release:            18.1.4.11.0
        Admin User File:      true
        Cache User File:      false
        Cg File:              false
        Disable Return:       false
        High Level State:     Healthy
        Intended State:       Active
        Local Commit:         false
        Name:                 sample2-1
        Schema File:          true
        Using Twosafe:        false
      Prev High Level State:  StandbyDown
      Prev Reexamine:
      Prev Stop Managing:
      Rep Create Statement:   create active standby pair "sample2" on 
    "sample2-0.sample2.mynamespace.svc.cluster.local", "sample2" on 
    "sample2-1.sample2.mynamespace.svc.cluster.local" NO RETURN store "sample2" 
    on "sample2-0.sample2.mynamespace.svc.cluster.local" PORT 4444 
    FAILTHRESHOLD 0 store "sample2" on 
    "sample2-1.sample2.mynamespace.svc.cluster.local" PORT 4444 
    FAILTHRESHOLD 0
      Rep Port:               4444
      Status Version:         1.0
    Events:
      Type  Reason       Age    From       Message
      ----  ------       ----   ----       -------
      -     StateChange  55m    ttclassic  Image updated, automatic upgrade 
    disabled
      -     StateChange  30m    ttclassic  TimesTenClassic was Normal, now 
    ActiveTakeover
      -     StateChange  30m    ttclassic  TimesTenClassic was ActiveTakeover, now 
    StandbyDown
      -     StateChange  28m    ttclassic  Pod sample2-1 Agent Up
      -     StateChange  28m    ttclassic  Pod sample2-1 Release 18.1.4.11.0
      -     StateChange  28m    ttclassic  Pod sample2-1 Daemon Up
      -     StateChange  28m    ttclassic  Pod sample2-1 Database None
      -     StateChange  28m    ttclassic  Pod sample2-1 Database Loaded
      -     StateChange  28m    ttclassic  Pod sample2-1 Database Not Updatable
      -     StateChange  28m    ttclassic  Pod sample2-1 RepAgent Not Running
      -     StateChange  28m    ttclassic  Pod sample2-1 RepState IDLE
      -     StateChange  27m    ttclassic  Pod sample2-1 RepAgent Running
      -     StateChange  27m    ttclassic  Pod sample2-1 RepState STANDBY
      -     StateChange  27m    ttclassic  TimesTenClassic was StandbyDown, now 
    Normal
      -     StateChange  3m8s   ttclassic  TimesTenClassic was Normal, now 
    ActiveDown
      -     StateChange  3m1s   ttclassic  TimesTenClassic was ActiveDown, now 
    ActiveTakeover
      -     StateChange  3m1s   ttclassic  Pod sample2-1 RepState ACTIVE
      -     StateChange  3m1s   ttclassic  Pod sample2-1 Database Updatable
      -     StateChange  2m56s  ttclassic  TimesTenClassic was ActiveTakeover, now 
    StandbyDown
      -     StateChange  113s   ttclassic  Pod sample2-0 Agent Up
      -     StateChange  113s   ttclassic  Pod sample2-0 Release 18.1.4.11.0
      -     StateChange  113s   ttclassic  Pod sample2-0 Daemon Up
      -     StateChange  113s   ttclassic  Pod sample2-0 Database None
      -     StateChange  50s    ttclassic  Pod sample2-0 Database Loaded
      -     StateChange  50s    ttclassic  Pod sample2-0 Database Not Updatable
      -     StateChange  50s    ttclassic  Pod sample2-0 RepAgent Not Running
      -     StateChange  50s    ttclassic  Pod sample2-0 RepState IDLE
      -     StateChange  44s    ttclassic  Pod sample2-0 RepAgent Running
      -     StateChange  44s    ttclassic  Pod sample2-0 RepState STANDBY
      -     StateChange  44s    ttclassic  TimesTenClassic was StandbyDown, now 
    Normal
    

新しいリリースのTimesTenに正常にアップグレードされました。この時点で、アクティブ・ポッドとスタンバイ・ポッドは、新しいTimesTenリリースが含まれている新しいTimesTenイメージを実行しています。追加のTimesTenClassicオブジェクトをアップグレードする必要がある場合は、自動アップグレードの場合は自動アップグレードの実行を、手動アップグレードの場合は手動アップグレードの実行を参照してください。すべてのTimesTenClassicオブジェクトに対してアップグレード・プロセスが完了している場合は、データベースのアクティブ・スタンバイ・ペアのアップグレードの確認を参照して、Kubernetesクラスタで実行されているすべてのTimesTenClassicオブジェクトのアップグレードを確認します。

この例では、sampleおよびsample2 TimesTenClassicオブジェクトがアップグレードされます。アップグレード・プロセスが完了しました。データベースのアクティブ・スタンバイ・ペアのアップグレードの確認に進み、TimesTenClassicオブジェクトが正常に実行され、アップグレードされたことを確認します。

データベースのアクティブ・スタンバイ・ペアのアップグレードの確認

TimesTenClassicオブジェクトのアップグレード・プロセスが完了したら、各TimesTenClassicオブジェクトが正常に実行され、アクティブ・データベースおよびスタンバイ・データベースでTimesTenの新しいリリースが実行されていることを確認できます。

  1. kubectl getコマンドを使用して、ポッドが実行中であることを確認します。

    % kubectl get pods
    NAME                                        READY   STATUS    RESTARTS   AGE
    sample-0                                    2/2     Running   0          7h1m
    sample-1                                    2/2     Running   0          7h4m
    sample2-0                                   2/2     Running   0          4h54m
    sample2-1                                   2/2     Running   0          5h22m
    timestenclassic-operator-846cb5c97c-sbz22   1/1     Running   0          2d8h
    
  2. kubectl getコマンドを使用して、各TimesTenClassicオブジェクトの状態がNormalであることを確認します(この例では太字で表示)。

    % kubectl get ttc
    NAME      STATE    ACTIVE      AGE
    sample    Normal   sample-1    2d12h
    sample2   Normal   sample2-1   2d12h
    
  3. sample TimesTenClassicオブジェクトに対して、kubectl exec -itコマンドを使用して、アクティブ・ポッド(この例ではsample-1)のシェルを呼び出します。その次に、ttVersionユーティリティを実行して、リリースが新しいリリース(この例では、太字で表示している18.1.4.11.0)になっていることを確認します。

    % kubectl exec -it sample-1 -c tt -- /usr/bin/su - oracle
    % ttVersion
    TimesTen Release 18.1.4.11.0 (64 bit Linux/x86_64) (instance1:6624) 
    2021-04-06T07:34:18Z
      Instance admin: oracle
      Instance home directory: /tt/home/oracle/instances/instance1
      Group owner: oracle
      Daemon home directory: /tt/home/oracle/instances/instance1/info
      PL/SQL enabled.
    
  4. ここで、kubectl exec -itコマンドを使用して、スタンバイ・ポッド(この例ではsample-0)のシェルを呼び出します。その次に、ttVersionユーティリティを実行して、リリースが新しいリリース(この例では、太字で表示している18.1.4.11.0)になっていることを確認します。

    % kubectl exec -it sample-0 -c tt -- /usr/bin/su - oracle
    % ttVersion
    TimesTen Release 18.1.4.11.0 (64 bit Linux/x86_64) (instance1:6624) 
    2021-04-06T07:34:18Z
      Instance admin: oracle
      Instance home directory: /tt/home/oracle/instances/instance1
      Group owner: oracle
      Daemon home directory: /tt/home/oracle/instances/instance1/info
      PL/SQL enabled.
    
  5. sample2 TimesTenClassicオブジェクトに対して、kubectl exec -itコマンドを使用して、アクティブ・ポッド(この例ではsample2-1)のシェルを呼び出します。その次に、ttVersionユーティリティを使用して、リリースが新しいリリース(この例では、18.1.4.11.0)になっていることを確認します。

    % kubectl exec -it sample2-1 -c tt -- /usr/bin/su - oracle
    % ttVersion
    TimesTen Release 18.1.4.11.0 (64 bit Linux/x86_64) (instance1:6624) 
    2021-04-06T07:34:18Z
      Instance admin: oracle
      Instance home directory: /tt/home/oracle/instances/instance1
      Group owner: oracle
      Daemon home directory: /tt/home/oracle/instances/instance1/info
      PL/SQL enabled.
    
  6. ここで、kubectl exec -itコマンドを使用して、スタンバイ・ポッド(この例ではsample2-0)のシェルを呼び出します。その次に、ttVersionユーティリティを使用して、リリースが新しいリリース(この例では、18.1.4.11.0)になっていることを確認します。

    % kubectl exec -it sample2-0 -c tt -- /usr/bin/su - oracle
    % ttVersion
    TimesTen Release 18.1.4.11.0 (64 bit Linux/x86_64) (instance1:6624) 
    2021-04-06T07:34:18Z
      Instance admin: oracle
      Instance home directory: /tt/home/oracle/instances/instance1
      Group owner: oracle
      Daemon home directory: /tt/home/oracle/instances/instance1/info
      PL/SQL enabled.
    

sampleおよびsample2 TimesTenClassicオブジェクトに対して、TimesTenの新しいリリースへのアップグレードが成功しました。各TimesTenClassicオブジェクトのアクティブ・ポッドおよびスタンバイ・ポッドは、新しいTimesTenリリースを含む新しいTimesTenイメージを実行しています。