レプリケートされたTimesTen Classicデータベースの作成
- TimesTenClassicオブジェクトのYAMLマニフェスト・ファイルを作成します。
vi repsample.yaml apiVersion: timesten.oracle.com/v4 kind: TimesTenClassic metadata: name: repsample spec: ttspec: storageClassName: oci-bv storageSize: 10Gi image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 imagePullSecret: sekret dbConfigMap: - repsample次の点に注目してください。-
storageClassNameはoci-bvです。oci-bvを記憶域クラスの名前に置き換えます。 -
storageSizeは10Giです。10Giを、各ポッドがTimesTenを保持するためにリクエストする必要がある記憶域の量に置き換えます。 -
imageはcontainer-registry.oracle.com/timesten/timesten:22.1.1.34.0です。imageをTimesTenコンテナ・イメージの名前および場所に置き換えます。 -
imagePullSecretはsekretです。sekretを、KubernetesがTimesTenコンテナ・イメージをフェッチするために使用するイメージ・プル・シークレットに置き換えます。 dbConfigMapは、「例について」で作成したrepsampleConfigMapを指定します。
-
- TimesTenClassicオブジェクトをネームスペースにデプロイします。
kubectl create -f repsample.yaml出力は次のようになります。timestenclassic.timesten.oracle.com/repsample created - デプロイメントを監視します。
- オブジェクトのステータスを確認します。
kubectl get ttc repsample出力は、次のようになります。
NAME STATE ACTIVE AGE repsample Initializing None 9sプロビジョニングは開始されますが、
Initializing状態で示されているとおり、完了していません。 - 数分間待機します。次に、ステータスを再度確認します。
kubectl get ttc repsample出力は、次のようになります。
NAME STATE ACTIVE AGE repsample Normal repsample-0 2m27sプロビジョニング・プロセスが完了します。アクティブ・データベースとスタンバイ・データベースが稼働中であり、動作しています。TimesTenオペレータにより、
repsampleオブジェクトがNormal状態に遷移します。
- オブジェクトのステータスを確認します。
- (オプション): 状態遷移を確認します。
kubectl get events出力は、次のようになります。
LAST SEEN TYPE REASON OBJECT MESSAGE ... 4m46s Normal Create timestenclassic/repsample Service repsample created 4m46s Warning Warning timestenclassic/repsample Database CPU limit/request not specified 4m46s Normal Create timestenclassic/repsample StatefulSet repsample created 4m46s Warning Create timestenclassic/repsample PodMonitor repsample created 3m46s Normal Info timestenclassic/repsample Pod repsample-0 Agent Up 3m46s Normal Info timestenclassic/repsample Pod repsample-0 Release 22.1.1.34.0 3m46s Normal Info timestenclassic/repsample Pod repsample-1 Agent Up 3m46s Normal Info timestenclassic/repsample Pod repsample-1 Release 22.1.1.34.0 3m46s Normal Info timestenclassic/repsample Pod repsample-0 Daemon Up 3m45s Normal Info timestenclassic/repsample Pod repsample-1 Daemon Up 3m30s Normal Info timestenclassic/repsample Pod repsample-0 Database Loaded 3m30s Normal Info timestenclassic/repsample Pod repsample-0 Database Updatable 3m29s Normal Info timestenclassic/repsample Pod repsample-0 RepAgent Running 3m29s Normal Info timestenclassic/repsample Pod repsample-0 RepScheme Exists 3m29s Normal StateChange timestenclassic/repsample Pod repsample-0 RepState ACTIVE 2m38s Normal Info timestenclassic/repsample Pod repsample-1 Database Loaded 2m38s Normal Info timestenclassic/repsample Pod repsample-1 RepScheme Exists 2m38s Normal StateChange timestenclassic/repsample Pod repsample-1 RepState IDLE 2m37s Normal Info timestenclassic/repsample Pod repsample-1 Database Loaded 2m37s Normal Info timestenclassic/repsample Pod repsample-1 RepScheme Exists 2m37s Normal StateChange timestenclassic/repsample Pod repsample-1 RepState IDLE 2m32s Normal Info timestenclassic/repsample Pod repsample-1 RepAgent Running 2m32s Normal StateChange timestenclassic/repsample Pod repsample-1 RepState STANDBY 2m31s Normal StateChange timestenclassic/repsample TimesTenClassic was Initializing, now Normal 2m26s Normal StateChange timestenclassic/repsample Pod repsample-0 is Ready 2m26s Normal StateChange timestenclassic/repsample Pod repsample-0 is Active Ready 2m26s Normal StateChange timestenclassic/repsample Pod repsample-1 is Readyプロビジョニング・プロセス中に、TimesTenClassicオブジェクトは
Initializing状態からNormal状態に遷移します。 - 基礎となるオブジェクトが存在するかどうかの確認
1. StatefulSet:
kubectl get statefulset repsample出力は、次のようになります。
NAME READY AGE repsample 1/2 7m22s2. サービス:
kubectl get service repsample出力は、次のようになります。
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE repsample ClusterIP None <none> 6625/TCP,8888/TCP 8m2s3 ポッド:kubectl get pods出力は、次のようになります。NAME READY STATUS RESTARTS AGE repsample-0 3/3 Running 0 8m31s repsample-1 2/3 Running 0 8m31s ...4.PVC:
kubectl get pvc出力は、次のようになります。
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE tt-persistent-repsample-0 Bound csi-f36b2402-9745-46bd-a023-811839ab518e 250Gi RWO oci-bv 8m59s tt-persistent-repsample-1 Bound csi-0a0cfd59-b2bf-48b7-bdef-6ee03794891b 250Gi RWO oci-bv 8m59s - アクティブ・データベースに接続します。
- 開発ホストから、ポッドにシェルを確立します。
kubectl exec -it repsample-0 -c tt -- /bin/bash - アクティブ・データベースに接続します。表に行を挿入します。
[timesten@repsample-0 ~]$ ttIsql repsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=repsample"; Connection successful: DSN=repsample;UID=timesten;DataStore=/tt/home/timesten/datastore/repsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> select * from adminuser.emp; 0 rows found. Command> describe adminuser.emp; Table ADMINUSER.EMP: Columns: *ID NUMBER NOT NULL NAME CHAR (32) PRIMARY KEY (ID) RANGE INDEX 1 table found. (primary key columns are indicated with *) Command> insert into adminuser.emp values (1,'test'); 1 row inserted. Command> commit; Command> select * from adminuser.emp; < 1, test > 1 row found. ttIsqlおよびシェルを終了します。Command> exit Disconnecting... Done. [timesten@repsample-0 ~]$ exit exit
- 開発ホストから、ポッドにシェルを確立します。