Create Non-Replicated TimesTen Classic Databases

This example shows you how to create and deploy a non-replicated TimesTenClassic object in your Kubernetes namespace. It shows you how to monitor the TimesTen Operator as it uses the information in the object's definition to create independent TimesTen databases.
  1. Create the YAML manifest file for the TimesTenClassic object.
    vi norepsample.yaml
    
    apiVersion: timesten.oracle.com/v2
    kind: TimesTenClassic
    metadata:
      name: norepsample
    spec:
      ttspec:
        storageClassName: oci-bv
        storageSize: 10Gi
        image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0
        imagePullSecret: sekret
        replicationTopology: none
        replicas: 3
        dbConfigMap:
        - norepsample
    
    Note the following:
    • The storageClassName is oci-bv. Replace oci-bv with the name of your storage class.

    • The storageSize is 10Gi. Replace 10Gi with the amount of storage that needs to be requested for each Pod to hold TimesTen.

    • The image is container-registry.oracle.com/timesten/timesten:22.1.1.27.0. Replace image with the name and location of your TimesTen container image.

    • The imagePullSecret is sekret. Replace sekret with the image pull secret that Kubernetes needs to use to fetch the TimesTen container image.

    • The replicationTopology is none. Do not change this setting for non-replicated configurations.
    • The replicas value is 3. Replace 3 with the number of TimesTen Pods (each containing a TimesTen database) to provision. The value must be between 1 and 3. If you omit replicas, the default is 1.
    • The dbConfigMap specifies the norepsample ConfigMap created in About the Examples.
  2. Deploy the TimesTenClassic object into your namespace.
    kubectl create -f norepsample.yaml
    The output is the following:
    timestenclassic.timesten.oracle.com/norepsample created
  3. Monitor deployment.
    1. Check status of object.
      kubectl get ttc norepsample

      The output is similar to the following:

      NAME          STATE             ACTIVE   AGE
      norepsample   NoReplicasReady   N/A      43s

      The provisioning starts, but is not completed as indicated by the NoReplicasReady state.

    2. Wait a few minutes. Then, check status again.
      kubectl get ttc norepsample

      The output is similar to the following:

      NAME          STATE               ACTIVE   AGE
      norepsample   SomeReplicasReady   N/A      74s

      The provisioning continues. As evidenced by the SomeReplicasReady state, some of the databases are ready, but not all.

    3. Check the status again.
      kubectl get ttc norepsample
      The output is similar to the following:
      NAME          STATE              ACTIVE   AGE
      norepsample   AllReplicasReady   N/A      2m54s

      The provisioning process completes. Databases are up and running and operational. The TimesTen Operator transitions the norepsample object to the AllReplicasReady state.

  4. (Optional) Review the state transitions.
    kubectl get events

    The output is similar to the following:

    LAST SEEN   TYPE      REASON                   OBJECT                                              MESSAGE
    ...
    6m6s        Normal    Create                   timestenclassic/norepsample                         Service norepsample created
    6m6s        Warning   Warning                  timestenclassic/norepsample                         Database CPU limit/request not specified
    6m6s        Normal    Create                   timestenclassic/norepsample                         StatefulSet norepsample created
    6m6s        Warning   Create                   timestenclassic/norepsample                         PodMonitor norepsample created
    6m6s        Normal    StateChange              timestenclassic/norepsample                         TimesTenClassic was Initializing, now NoReplicasReady
    5m10s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Agent Up
    5m10s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Release 22.1.1.27.0
    5m10s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Instance Exists
    5m10s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Daemon Down
    5m9s        Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Daemon Up
    5m9s        Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Database None
    4m59s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Database Loaded
    4m58s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 Database Updatable
    4m58s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-0 RepAgent Not Running
    4m58s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-0 is Ready
    4m58s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-0 state was Initializing, now Normal
    4m58s       Normal    StateChange              timestenclassic/norepsample                         TimesTenClassic was NoReplicasReady, now SomeReplicasReady
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Agent Up
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Release 22.1.1.27.0
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Instance Exists
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Daemon Down
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Daemon Up
    4m48s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Database None
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Database Loaded
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 Database Updatable
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-2 RepAgent Not Running
    3m37s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-2 is Ready
    3m37s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-2 state was Initializing, now Normal
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Agent Up
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Release 22.1.1.27.0
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Instance Exists
    3m37s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Daemon Down
    3m36s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Daemon Up
    3m36s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Database None
    3m30s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Database Loaded
    3m30s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 Database Updatable
    3m30s       Normal    Info                     timestenclassic/norepsample                         Pod norepsample-1 RepAgent Not Running
    3m30s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-1 is Ready
    3m30s       Normal    StateChange              timestenclassic/norepsample                         Pod norepsample-1 state was Initializing, now Normal
    3m30s       Normal    StateChange              timestenclassic/norepsample                         TimesTenClassic was SomeReplicasReady, now AllReplicasReady

    During the provisioning process, the TimesTenClassic object and TimesTen Pods transition from and to various states.

  5. Verify the existence of the underlying objects.

    1. StatefulSet:

    kubectl get statefulset norepsample

    The output is similar to the following:

    NAME          READY   AGE
    norepsample   3/3     8m30s

    2. Service:

    kubectl get service norepsample

    The output is similar to the following:

    NAME          TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
    norepsample   ClusterIP   None         <none>        6625/TCP,8888/TCP   8m58s

    3. Pods:

    kubectl get pods

    The output is similar to the following:

    NAME                                 READY   STATUS    RESTARTS   AGE
    norepsample-0                        3/3     Running   0          9m15s
    norepsample-1                        3/3     Running   0          9m15s
    norepsample-2                        3/3     Running   0          9m15s
    ...

    4. PVCs:

    kubectl get pvc

    The output is similar to the following:

    NAME                          STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    tt-persistent-norepsample-0   Bound    csi-00bf2a2e-ef70-4f41-a3ef-66341f7404ac   250Gi      RWO            oci-bv         9m34s
    tt-persistent-norepsample-1   Bound    csi-516d9ef4-9492-4927-b483-05f7d320cc73   250Gi      RWO            oci-bv         9m34s
    tt-persistent-norepsample-2   Bound    csi-99c95d75-f9d9-4754-9378-0c5a7d288871   250Gi      RWO            oci-bv         9m34s
  6. Connect to one of the databases.
    1. From your development host, establish a shell in the Pod.
      kubectl exec -it norepsample-0 -c tt -- /bin/bash
    2. Connect to the database. Insert a row in a table.
      ttIsql norepsample
      
      Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
      Type ? or "help" for help, type "exit" to quit ttIsql.
      
      
      
      connect "DSN=norepsample";
      Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;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.
    3. Exit from ttIsql and from the shell.
      Command> exit
      Disconnecting...
      Done.
      [timesten@norepsample-0 ~]$ exit
      exit
Congratulations! You successfully created and deployed a non-replicated TimesTenClassic object. The non-replicated TimesTen Classic databases are up and running and fully operational.