1つのデータベースの起動について

この項では、TimesTenClassicオブジェクトに関連付けられたデータベースの1つで、手動で修復またはメンテナンスを実行したことを前提としています。TimesTenClassicオブジェクトは現在ManualInterventionRequired状態です。次に、修復されたデータベースをアクティブとして処理し、このデータベースをスタンバイに複製するために必要なステップを実行し、両方のデータベースが正常に実行されて動作するように両方のデータベースを起動することをオペレータに指示します。

データベースでは、次の条件をすべて満たす必要があります。

  • コンテナのTimesTenエージェントが実行中です。

  • コンテナのTimesTenデーモン(インスタンス)が実行中です。

  • TimesTenデータベースがロードされています。

  • データベースにレプリケーション・スキームがありません。

  • レプリケーション・エージェントは稼働していません。

  • レプリケーションの状態はIDLEです。

次の各項では、データベースの条件が満たされていることの確認方法と、reexamine値を設定する方法について説明します。

データベースの条件が満たされていることの確認

データベース(アクティブになるデータベース)の条件が満たされていることを確認するには、次のステップを実行します。この例では、sample-1が新しいアクティブになります。

ノート: これらのステップでは、TimesTenユーティリティおよびTimesTen組込みプロシージャを使用する必要があります。詳細は、Oracle TimesTen In-Memory Databaseリファレンスユーティリティおよび組込みプロシージャを参照してください。

  1. TimesTenClassicオブジェクト(この例ではsample)がManualInterventionRequired状態であることを確認します(boldで表示)。
    % kubectl get ttc sample
    NAME     STATE                        ACTIVE     AGE
    sample   ManualInterventionRequired   sample-0   12h
    
  2. kubectl exec -itコマンドを使用して、TimesTenデータベースを含むsample-1ポッド内のシェルを起動します。(このデータベースが新しいアクティブになります。)

    残りの手順はこのシェル内で実行されます。

    % kubectl exec -it sample-1  -c tt -- /bin/bash
  3. ttDaemonAdminユーティリティを使用して、TimesTenデーモンを起動します(まだ起動していない場合)。次に、ttAdminユーティリティを使用して、TimesTenデータベースをメモリーにロードします(まだロードされていない場合)。
    % ttDaemonAdmin -start
    TimesTen Daemon (PID: 5948, port: 6624) startup OK.
    % ttAdmin -ramLoad sample
    RAM Residence Policy            : manual
    Manually Loaded In RAM          : True
    Replication Agent Policy        : manual
    Replication Manually Started    : False
    Cache Agent Policy              : manual
    Cache Agent Manually Started    : False
    Database State                  : Open
    
  4. ttIsqlユーティリティを使用して、sampleデータベースに接続します。次に、ttRepStop組込みプロシージャをコールして、レプリケーション・エージェントを停止します。
    % ttIsql sample
     
    Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
    Type ? or "help" for help, type "exit" to quit ttIsql.
     
     
     
    connect "DSN=sample";
    Connection successful: DSN=sample;UID=timesten;DataStore=/tt/home/timesten/datastore/sample;
    DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;AutoCreate=0;
    PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1;
    (Default setting AutoCommit=1)
    Command> call ttRepStop;
    
  5. ttIsql内から、SQL DROP ACTIVE STANDBY PAIR文を使用して、アクティブ・スタンバイ・ペアのレプリケーション・スキームを削除します。次に、ttIsql repschemesコマンドを使用して、データベースにレプリケーション・スキームがないことを確認します。ttIsqlを終了します。
    Command> DROP ACTIVE STANDBY PAIR;
    Command> repschemes;
     
    0 replication schemes found.
    
  6. ttStatusユーティリティを使用して、TimesTenデーモンが実行中であり、レプリケーション・エージェントが実行されていないことを確認します。
    % ttStatus
    TimesTen status report as of Sat Apr 24 02:14:15 2023
     
    Daemon pid 5948 port 6624 instance instance1
    TimesTen server pid 5955 started on port 6625
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    Data store /tt/home/timesten/datastore/sample
    Daemon pid 5948 port 6624 instance instance1
    TimesTen server pid 5955 started on port 6625
    There are 15 connections to the data store
    Shared Memory KEY 0x0a100c60 ID 196609
    PL/SQL Memory Key 0x0b100c60 ID 229378 Address 0x5000000000
    Type            PID     Context             Connection Name              ConnID
    Process         10418   0x000000000218a6e0  sample                            2
    Process         8338    0x0000000001cbb6e0  sample                            1
    Subdaemon       5953    0x00000000015075f0  Manager                        2047
    Subdaemon       5953    0x0000000001588540  Rollback                       2046
    Subdaemon       5953    0x0000000001607210  Checkpoint                     2041
    Subdaemon       5953    0x00007f132c0008c0  Flusher                        2045
    Subdaemon       5953    0x00007f132c080370  Log Marker                     2040
    Subdaemon       5953    0x00007f13340008c0  Monitor                        2044
    Subdaemon       5953    0x00007f133407f330  HistGC                         2037
    Subdaemon       5953    0x00007f13380008c0  Aging                          2042
    Subdaemon       5953    0x00007f133807f330  AsyncMV                        2039
    Subdaemon       5953    0x00007f133c0008c0  Deadlock Detector              2043
    Subdaemon       5953    0x00007f133c07f330  IndexGC                        2038
    Subdaemon       5953    0x00007f135c0008c0  Garbage Collector              2035
    Subdaemon       5953    0x00007f13600e8e20  XactId Rollback                2036
    Open for user connections
    RAM residence policy: Manual
    Data store is manually loaded into RAM
    Replication policy  : Manual
    Cache Agent policy  : Manual
    PL/SQL enabled.
    ------------------------------------------------------------------------
    Accessible by group timesten
    End of report
    

データベースの条件を正常に確認しました。データベースは稼働中です。オペレータはこのデータベースをアクティブとして扱います。これで、.spec.ttspec.reexamineデータ項目の値を設定する準備ができました。

reexamine値の設定

この例では、TimesTenClassicオブジェクト定義(この例ではsample)でreexamine値を設定する方法を示します。この例は、reexamine値が変更された後にオペレータが実行する処理も示しています。

  1. reexamine値を設定します。値は、TimesTenClassicオブジェクトの現在の値と異なる必要があります。オペレータは、この値を調べて最後の反復以降に変更されたことに気付くと、適切な処理を実行します。

    kubectl editコマンドを使用して、TimesTenClassicオブジェクトを編集します。

    • ファイル内にreexamineの行がある場合は、その値を変更します。現在の値と異なる必要があります。

    • ファイル内にreexamineの行がない場合は、行を追加して値を指定します。

    この例では、reexamine行はありません。この例では、reexamine行を追加し、reexamineの値をApril22reexamine1に設定します(boldで表示)。

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

    % 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
    metadata:
    ...
      name: sample
      namespace: mynamespace
    ...
    repCreateStatement: |
      create active standby pair
        "{{tt-name}}" on "{{tt-node-0}}",
        "{{tt-name}}" on "{{tt-node-1}}"
      RETURN TWOSAFE
      store "{{tt-name}}" on "{{tt-node-0}}"
        PORT {{tt-rep-port}} FAILTHRESHOLD 0 TIMEOUT 999
      store "{{tt-name}}" on "{{tt-node-1}}"
        PORT {{tt-rep-port}} FAILTHRESHOLD 0 TIMEOUT 999
    spec:
      ttspec:
        bothDownBehavior: Best
        dbConfigMap:
        - sample
        image: container-registry.oracle.com/timesten/timesten:22.1.1.19.0
        imagePullSecret: sekret
        storageClassName: oci-bv
        storageSize: 250Gi
        reexamine: April22reexamine1
    ...
    timestenclassic.timesten.oracle.com/sample edited
    
  2. kubectl getコマンドを使用して、sample TimesTenClassicオブジェクトの状態を評価します。複数のkubectl getコマンドを発行して、状態がどのように変化するかを確認します。また、オペレータはsample-1をアクティブとして正常に構成しました。
    % kubectl get ttc sample 
    NAME     STATE       ACTIVE   AGE 
    sample   Reexamine   None     68m 
    % kubectl get ttc sample 
    NAME     STATE               ACTIVE   AGE 
    sample   ConfiguringActive   None     68m 
    % kubectl get ttc sample 
    NAME     STATE         ACTIVE     AGE 
    sample   StandbyDown   sample-1   68m 
    % kubectl get ttc sample 
    NAME     STATE    ACTIVE     AGE
    sample   Normal   sample-1   71m
    
  3. kubectl describeコマンドを使用して、オペレータの処理をさらにレビューします(boldで表示)。

    出力のすべては示していません。

    % kubectl describe ttc sample
    Name:         sample
    Namespace:    mynamespace
    ...
    Kind:         TimesTenClassic
    ...
    Rep Create Statement:  create active standby pair
      "{{tt-name}}" on "{{tt-node-0}}",
      "{{tt-name}}" on "{{tt-node-1}}"
    RETURN TWOSAFE
    store "{{tt-name}}" on "{{tt-node-0}}"
      PORT {{tt-rep-port}} FAILTHRESHOLD 0 TIMEOUT 999
    store "{{tt-name}}" on "{{tt-node-1}}"
      PORT {{tt-rep-port}} FAILTHRESHOLD 0 TIMEOUT 999
     
    Spec:
      Ttspec:
        Both Down Behavior:  Best
        Db Config Map:
          sample
        Image:               container-registry.oracle.com/timesten/timesten:22.1.1.19.0
        Image Pull Policy:   Always
        Image Pull Secret:   sekret
        Reexamine:           April22reexamine1
        Stop Managing:       April21Stop1
        Storage Class Name:  oci-bv
        Storage Size:        250Gi
    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:                    54
      Last High Level State Switch:  1619230912
      Pod Status:
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       475
          Db Updatable:                No
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1619231126
          Pod IP:               10.244.7.89
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:
        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:         22.1.1.19.0
        Admin User File:   false
        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:       false
        Using Twosafe:     false
        Cache Status:
          Cache Agent:        Not Running
          Cache UID Pwd Set:  true
          N Cache Groups:     0
        Db Status:
          Db:                          Loaded
          Db Id:                       476
          Db Updatable:                Yes
        Initialized:                   true
        Last High Level State Switch:  ?
        Pod Status:
          Agent:                Up
          Last Time Reachable:  1619231126
          Pod IP:               10.244.6.149
          Pod Phase:            Running
        Prev High Level State:  Healthy
        Prev Image:
        Replication Status:
          Last Time Rep State Changed:  1619228670
          Rep Agent:                    Running
          Rep Peer P State:             start
          Rep Scheme:                   Exists
          Rep State:                    ACTIVE
        Times Ten Status:
          Daemon:             Up
          Instance:           Exists
          Release:            22.1.1.19.0
        Admin User File:      false
        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:          false
        Using Twosafe:        false
      Prev High Level State:  StandbyDown
      Prev Reexamine:         April22reexamine1
      Prev Stop Managing:     April21Stop1
      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  58m    ttclassic  TimesTenClassic was Normal, now ManualInterventionRequired
      -     StateChange  46m    ttclassic  Pod sample-0 Daemon Down
      -     StateChange  41m    ttclassic  Pod sample-1 Daemon Down
      -     StateChange  41m    ttclassic  Pod sample-1 Daemon Up
      -     StateChange  41m    ttclassic  Pod sample-1 Database Unloaded
      -     StateChange  40m    ttclassic  Pod sample-1 Database Loaded
      -     StateChange  40m    ttclassic  Pod sample-1 RepState IDLE
      -     StateChange  40m    ttclassic  Pod sample-1 RepAgent Not Running
      -     StateChange  17m    ttclassic  Pod sample-1 Database Updatable
      -     StateChange  17m    ttclassic  Pod sample-1 RepScheme None
      -     StateChange  4m21s  ttclassic  TimesTenClassic was ManualInterventionRequired, now Reexamine
      -     Error        4m16s  ttclassic  Active error: Daemon Down
      -     StateChange  4m16s  ttclassic  TimesTenClassic was Reexamine, now ConfiguringActive
      -     StateChange  4m10s  ttclassic  Pod sample-1 RepState ACTIVE
      -     StateChange  4m10s  ttclassic  Pod sample-1 RepScheme Exists
      -     StateChange  4m10s  ttclassic  Pod sample-1 RepAgent Running
      -     StateChange  4m8s   ttclassic  TimesTenClassic was ConfiguringActive, now StandbyDown
      -     StateChange  4m3s   ttclassic  Pod sample-0 Daemon Up
      -     StateChange  4m3s   ttclassic  Pod sample-0 Database Unloaded
      -     StateChange  3m56s  ttclassic  Pod sample-0 Database None
      -     StateChange  3m42s  ttclassic  Pod sample-0 Database Loaded
      -     StateChange  3m42s  ttclassic  Pod sample-0 Database Not Updatable
      -     StateChange  3m42s  ttclassic  Pod sample-0 RepAgent Not Running
      -     StateChange  3m42s  ttclassic  Pod sample-0 RepState IDLE
      -     StateChange  3m36s  ttclassic  Pod sample-0 RepAgent Running
      -     StateChange  3m36s  ttclassic  Pod sample-0 RepState STANDBY
      -     StateChange  3m36s  ttclassic  TimesTenClassic was StandbyDown, now Normal
    
  4. kubectl exec -itコマンドを使用して、TimesTenデータベースを含むsample-1ポッド内のシェルを起動します。次に、アクティブ・データベースに接続できることを確認します。
    % kubectl exec -it sample-1 -c tt -- /bin/bash
    $ ttIsql sample
     
    Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
    Type ? or "help" for help, type "exit" to quit ttIsql.
     
     
     
    connect "DSN=sample";
    Connection successful: DSN=sample;UID=timesten;DataStore=/tt/home/timesten/datastore/sample;
    DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1;
    (Default setting AutoCommit=1)
    Command> call ttRepStateGet;
    < ACTIVE >
    1 row found.
    
  5. kubectl exec -itコマンドを使用して、TimesTenデータベースを含むsample-0ポッド内のシェルを起動します。次に、スタンバイ・データベースに接続できることを確認します。
    % kubectl exec -it sample-0 -c tt -- /bin/bash
    % ttIsql sample
     
    Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
    Type ? or "help" for help, type "exit" to quit ttIsql.
     
     
     
    connect "DSN=sample";
    Connection successful: DSN=sample;UID=timesten;DataStore=/tt/home/timesten/datastore/sample;
    DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;AutoCreate=0;
    PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1;
    (Default setting AutoCommit=1)
    Command> call ttRepStateGet;
    < STANDBY >
    1 row found.
    

オペレータがTimesTenClassicオブジェクトを管理および監視するようになりました。TimesTenClassicオブジェクトはNormal状態です。いずれのデータベースも稼働中で、すぐに使用できます。