- Kubernetes Operator User's Guide
- Create TimesTen Classic Databases
- Create Replicated TimesTen Classic Databases
Create Replicated TimesTen Classic Databases
- Create the YAML manifest file for the TimesTenClassic object.
vi repsample.yaml apiVersion: timesten.oracle.com/v2 kind: TimesTenClassic metadata: name: repsample spec: ttspec: storageClassName: oci-bv storageSize: 10Gi image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 imagePullSecret: sekret dbConfigMap: - repsample
Note the following:-
The
storageClassName
isoci-bv
. Replaceoci-bv
with the name of your storage class. -
The
storageSize
is10Gi
. Replace10Gi
with the amount of storage that needs to be requested for each Pod to hold TimesTen. -
The
image
iscontainer-registry.oracle.com/timesten/timesten:22.1.1.27.0
. Replaceimage
with the name and location of your TimesTen container image. -
The
imagePullSecret
issekret
. Replacesekret
with the image pull secret that Kubernetes needs to use to fetch the TimesTen container image. - The
dbConfigMap
specifies therepsample
ConfigMap created in About the Examples.
-
- Deploy the TimesTenClassic object into your namespace.
kubectl create -f repsample.yaml
The output is the following:timestenclassic.timesten.oracle.com/repsample created
- Monitor deployment.
- Check status of object.
kubectl get ttc repsample
The output is similar to the following:
NAME STATE ACTIVE AGE repsample Initializing None 9s
The provisioning starts, but is not completed as indicated by the
Initializing
state. - Wait a few minutes. Then, check status again.
kubectl get ttc repsample
The output is similar to the following:
NAME STATE ACTIVE AGE repsample Normal repsample-0 2m27s
The provisioning process completes. The active and standby databases are up and running and operational. The TimesTen Operator transitions the
repsample
object to theNormal
state.
- Check status of object.
- (Optional): Review the state transitions.
kubectl get events
The output is similar to the following:
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.27.0 3m46s Normal Info timestenclassic/repsample Pod repsample-1 Agent Up 3m46s Normal Info timestenclassic/repsample Pod repsample-1 Release 22.1.1.27.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
During the provisioning process, the TimesTenClassic object transitions from the
Initializing
to theNormal
state. - Verify the existence of the underlying objects.
1. StatefulSet:
kubectl get statefulset repsample
The output is similar to the following:
NAME READY AGE repsample 1/2 7m22s
2. Service:
kubectl get service repsample
The output is similar to the following:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE repsample ClusterIP None <none> 6625/TCP,8888/TCP 8m2s
3. Pods:kubectl get pods
The output is similar to the following:NAME READY STATUS RESTARTS AGE repsample-0 3/3 Running 0 8m31s repsample-1 2/3 Running 0 8m31s ...
4. PVCs:
kubectl get pvc
The output is similar to the following:
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
- Connect to the active database.
- From your development host, establish a shell in the Pod.
kubectl exec -it repsample-0 -c tt -- /bin/bash
- Connect to the active database. Insert a row in a table.
[timesten@repsample-0 ~]$ ttIsql repsample Copyright (c) 1996, 2024, 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.
- Exit from
ttIsql
and from the shell.Command> exit Disconnecting... Done. [timesten@repsample-0 ~]$ exit exit
- From your development host, establish a shell in the Pod.