Creating Your Database

To create a database, you must:

Creating an Image Pull Secret

An image pull secret is used to pull the NuoDB container image from the NuoDB Docker hub repository when the NuoDB domain and database deployment templates are processed. To create an image pull secret, do the following:

  1. From the OpenShift Web UI dashboard, click the Resources tab and then click Secrets.
  2. On the Secrets page, click Create Secret.
  3. On the Create Secrets screen select Image Secret from the Secret Type drop-down list.
  4. Complete the following fields:
  5. Click Create.

Creating a Database Secret

Before creating a database, you must first create a Database secret in the project where the SMs and/or TEs are to run, which contains the database administrative username and password.

The NuoDB Storage (DaemonSet) template creates this secret automatically (whereas DeploymentConfig does not. Also, if you are running TEs in a project that is different to the project where the SMs are running, you must create the same secret in the TE project that was created in the SM project.

To create a database secret in a project, do the following:

  1. Click Add to Project.
  2. Click Select from Project.
    A Select from Project wizard displays.
  3. On the Selection screen select the database secret option and click Next. For example, if you named this project NuoDB, the database secret option is NuoDB Database Secret.
  4. On the Information screen review details of options set on the previous screen and click Next.
  5. On the Configuration screen, complete the following mandatory fields:
  6. If required, complete the Labels field.
  7. Click Next.
    The Results screen then confirms that a database secret has been created.
  8. Click Close.

Labeling Nodes Which Have Storage and Backup volumes for the Database

On each node that has storage for a specific database, but will not be running backups, run the following oc label command:

oc label node <node-id> nuodb.com/<domain-name>.<database>=nobackup

On each node that has storage for a specific database, and has backup storage, and will be running backups, run the following oc label command:

oc label node <node-id> nuodb.com/<domain-name>.<database-name>=backup

For example, to label a node with the id node-123 that has data storage and backup storage for database called mydb, in a domain called mydomain, the following command could be used:

oc label node node-123 nuodb.com/mydomain.mydb=backup

For more information on labeling, see Preparing Your Cluster.

(Optional) Enabling NuoDB Insights

An optional step to creating your database is to enable NuoDB Insights for monitoring activity on the database. For information on opting in to and using NuoDB Insights, see Database Monitoring.

Starting Storage Managers

When a database secret has been created, you can then create the database by first creating a SM pod for that database. The following types of SM templates are available:

Note: When using DAS, you must then specify the storage path where the database is to be written to; all storage hosts will require this same path for the same database.

Note: The zones you enter at this point are those to which the cluster is deployed; these are the same zones as used in when Labeling Nodes.

To create database SM pods, do the following:

  1. Click Add to Project.
  2. Click Select from Project.
    A Select from Project wizard displays.
  3. On the Selection screen select the DAS option and click Next. For example, if you named this project NuoDB, the DAS source option is NuoDB Storage (Direct Attached Storage).
  4. On the Information screen review details of options set on the previous screen and click Next.
  5. On the Configuration screen, complete the following mandatory fields:
  6. If required, complete the Additional labels for storage manager field.
  7. Click Next.
    The Results screen then confirms that a DAS SM pod has been created.

  8. Click Close.

Starting Transaction Engines

When you have successfully started one or more SM pods, you can then launch TE pods.

Note: When starting a TE you also have the option to enter a label that can be used to connect applications to a specific TE type as identified by its label. You can use labels to indicate other categories other than location. For example, you can use labels to indicate a TE is for a specific application type or serving a specific workload type.

To launch the TEs you require, do the following:

  1. Click Add to Project.
  2. Click Select from Project.
    A Select from Project wizard displays.
  3. On the Selection screen select the transaction engine option and click Next. For example, if you named this project NuoDB, the transaction engine option is NuoDB Transaction Engine.
  4. On the Information screen review details of the option selected on the previous screen.
  5. On the Configuration screen, complete the following mandatory fields:
  6. If required, complete the Additional labels and UID fields.
  7. Click Next.
    The Results screen then confirms that a TE pod has been created.

  8. Click Close.

Verifying the Database

To verify a database, open a terminal window on any NuoDB Admin Service pod and run the nuocmd show domain command. This will show the health of the domain and any databases under management. For a example of the nuocmd show domain command and other show commands, see Displaying Domain and Database Status.

You can also verify that the database is processing SQL before creating an application. Simply log into a TE through the UI Terminal and run the following commands:

$ nuosql ${DB_NAME}@${PEER_ADDRESS}  --user dba --password goalie 
SQL> select count(*) from system.tables; 
COUNT 
------ 
 35 
SQL>exit 
$

Launching a Sample Application

At this point the database has been fully provisioned with SM and TE database processes. You can now launch a sample workload. For example, launch the Yahoo Cloud Serving Benchmark (YCSB) application - a standard SQL database performance benchmark. The YCSB application allows you to choose the type of workload value (a through to f) you would like to generate. The default workload value in the NuoDB YCSB pod is load b: a 95% read and 5% update workload which is representative of many Online Transaction Processing (OLTP) type applications. Workload c is 100% read-only. Workload a is 50% read and 50% write. For details of the other workload values, see the YCSB documentation.

To launch YCSB as a sample application, do the following:

  1. Click Add to Project.
  2. Click Select from Project.
    A Select from Project wizard displays.
  3. On the Selection screen select the YCSB load option and click Next.
  4. On the Information screen review details of the option selected on the previous screen.
  5. On the Configuration screen, complete the following fields:
  6. Click Create.
    The Results screen then confirms that the YCSB application has been created.
  7. Click Close.

Once an application is running, you can observe the transactions per second (TPS) rates from NuoDB Insights. For more information on using NuoDB Insights, see Database Monitoring.