Overview of Oracle Globally Distributed Database in Linux Containers
Oracle Globally Distributed Database is a scalability and availability feature for custom-designed OLTP applications that enables the distribution and replication of data across a pool of Oracle Databases that do not share hardware or software. The pool of databases is presented to the application as a single logical database.
We have a GitHub Project that provides sample container files to facilitate installation, configuration, and environment setup of Oracle Globally Distributed Database using containers for DevOps users.
You can refer to the following page for all the steps and commands to deploy an Oracle Globally Distributed Database using Podman Containers. But in this blog we will discuss how podman-compose simplifies the deployment even further.
Why “podman-compose”?
If you are deploying an Oracle Globally Distributed Database using podman containers, you will need to deploy multiple containers (Catalog, Shards, GSM Containers). This involves multiple commands to create the containers.
“podman-compose” allows you to define and manage multiple containers using a YAML file, Similar to Docker Compose, “podman-compose” works with Podman Container Engine.
You can define all the required containers in a single YAML File and “podman-compose” can provision all the containers in a SINGLE COMMAND on a single host machine! Once the deployment is completed, the end user will have a working Oracle Globally Distributed Database on that Single host machine.
Here are the steps to deploy an Oracle Globally Distributed Database using “podman-compose”, on a Single Host using a YAML FILE
Note: In this setup:
- We are using Oracle Database 23ai FREE RDBMS and GSM Container Images from Oracle Container Registry
-
The deployment is using System-Managed Sharding Topology with Raft Replication
-
This deployment is having a Container for the Catalog Database, 4 Containers for 4 individual Shard Databases and 2 Containers for Primary and Standby GSM
Step 1: Install podman-compose
$ dnf config-manager --enable ol8_developer_EPEL
$ dnf install podman-compose
Step 2: Create podman secrets
- Create a file with the password you want to use in the secret creation. This password will be used for the Database User creation during the deployment.
- Generate openssl encrypted key, encrypt the password file using the encrypted key and create podman secrets using the encrypted password file
- Its important that the version of the openssl in this case must be compatible with the version of openssl in the Oracle Database and GSM Container Images
$ mkdir /opt/.secrets/
$ cd /opt/.secrets
$ openssl genrsa -out key.pem
$ openssl rsa -in key.pem -out key.pub -pubout
$ echo "<< Password >>" > /opt/.secrets/pwdfile.txt
$ openssl pkeyutl -in /opt/.secrets/pwdfile.txt -out /opt/.secrets/pwdfile.enc -pubin -inkey /opt/.secrets/key.pub -encrypt
$ rm -rf /opt/.secrets/pwdfile.txt
$ podman secret create keysecret /opt/.secrets/key.pem
$ podman secret ls
|
Step 3: Login and get the Container Images for Oracle Database FREE and Oracle GSM from Oracle Container Registry:
$ podman login container-registry.oracle.com podman pull container-registry.oracle.com/database/free:23.7.0.0
$ podman pull container-registry.oracle.com/database/gsm:23.7.0.0
|
Step 4: Get the project files from GitHub Project and prepare the environment
- Get the project files
- Refer to the page: https://github.com/oracle/db-sharding/blob/master/container-based-sharding-deployment/samples/compose-files/podman-compose/README.md
- Replace the RDBMS and GSM Images in the script “podman-compose-prerequisites-free.sh” and set the environment using this script
$ grep -i image podman-compose-prerequisites-free.sh
export SIDB_IMAGE='container-registry.oracle.com/database/free:23.7.0.0'
export GSM_IMAGE='container-registry.oracle.com/database/gsm:23.7.0.0'
$ source podman-compose-prerequisites-free.sh
|
-
If SELinux is enabled on the host machine, use the script below to set the context
$ source set-file-context.sh
|
-
To deploy using the Oracle Database 23ai FREE, use the file “podman-compose-free.yml”
$ mv podman-compose.yml podman-compose.yml_enterprise
$ cp podman-compose-free.yml podman-compose.yml
|
Step 5: Deploy the Oracle Globally Distributed Database using “podman-compose” using the YAML FILE in a single command
$ podman-compose up -d
Step 6: You can monitor all the containers using “podman-compose” as below:
$ podman-compose logs -f
- For the Catalog container, wait for this message in the logs: GSM Catalog Setup Completed
-
For the Shard containers, wait for this message in the logs: GSM Shard Setup Completed
- For the GSM Containers, wait for this message in the logs: GSM Setup Completed
Step 7: Confirm the deployment of Oracle Globally Distributed Database
Below is a sample output to check the Oracle Globally Distributed Database Deployment:
$ podman exec -i -t oshard-gsm1 /bin/bash
[oracle@oshard-gsm1 ~]$ gdsctl config shard
Name Shard Group Status State Region Availability
---- ----------- ------ ----- ------ ------------
orcl1cdb_orcl1pdb shardgroup1 Ok Deployed region1 ONLINE
orcl2cdb_orcl2pdb shardgroup1 Ok Deployed region1 ONLINE
orcl3cdb_orcl3pdb shardgroup1 Ok Deployed region1 ONLINE
orcl4cdb_orcl4pdb shardgroup1 Ok Deployed region1 ONLINE
[oracle@oshard-gsm1 ~]$ gdsctl config chunks
Chunks
------------------------
Database From To
-------- ---- --
orcl1cdb_orcl1pdb 1 2
orcl1cdb_orcl1pdb 5 9
orcl1cdb_orcl1pdb 11 12
orcl2cdb_orcl2pdb 1 6
orcl2cdb_orcl2pdb 9 11
orcl3cdb_orcl3pdb 1 4
orcl3cdb_orcl3pdb 7 10
orcl3cdb_orcl3pdb 12 12
orcl4cdb_orcl4pdb 3 8
orcl4cdb_orcl4pdb 10 12
[oracle@oshard-gsm1 ~]$
[oracle@oshard-gsm1 ~]$ gdsctl config sdb
GDS Pool administrators
------------------------
Replication Type
------------------------
Native
Shard type
------------------------
System-managed
Shard spaces
------------------------
shardspaceora
Services
------------------------
oltp_rw_svc
[oracle@oshard-gsm1 ~]$
[oracle@oshard-gsm1 ~]$ gdsctl status ru
Replication units
------------------------
Database RU# Role Term Log Index Status
-------- --- ---- ---- --------- ------
orcl1cdb_orcl1pdb 1 Leader 1 1 Ok
orcl1cdb_orcl1pdb 3 Leader 3 3 Ok
orcl1cdb_orcl1pdb 4 Follower 4 4 Ok
orcl1cdb_orcl1pdb 5 Leader 1 1 Ok
orcl1cdb_orcl1pdb 7 Leader 3 3 Ok
orcl1cdb_orcl1pdb 8 Leader 4 4 Ok
orcl4cdb_orcl4pdb 6 Follower 2 2 Ok
orcl4cdb_orcl4pdb 7 Follower 3 3 Ok
orcl4cdb_orcl4pdb 2 Leader 2 2 Ok
orcl4cdb_orcl4pdb 8 Follower 4 4 Ok
orcl4cdb_orcl4pdb 4 Follower 4 4 Ok
orcl4cdb_orcl4pdb 3 Follower 3 3 Ok
orcl3cdb_orcl3pdb 1 Follower 1 1 Ok
orcl3cdb_orcl3pdb 6 Leader 2 2 Ok
orcl3cdb_orcl3pdb 2 Follower 2 2 Ok
orcl3cdb_orcl3pdb 8 Follower 4 4 Ok
orcl3cdb_orcl3pdb 4 Leader 4 4 Ok
orcl3cdb_orcl3pdb 5 Follower 1 1 Ok
orcl2cdb_orcl2pdb 6 Follower 2 2 Ok
orcl2cdb_orcl2pdb 1 Follower 1 1 Ok
orcl2cdb_orcl2pdb 7 Follower 3 3 Ok
orcl2cdb_orcl2pdb 2 Follower 2 2 Ok
orcl2cdb_orcl2pdb 5 Follower 1 1 Ok
orcl2cdb_orcl2pdb 3 Follower 3 3 Ok
[oracle@oshard-gsm1 ~]$
|
Step 8: Workload Tests
You can use workload tests with this deployment of Oracle Globally Distributed Database. You can use Swingbench 2.7 for this workload testing.
Please refer to this GitHub Page for a sample workload test run against an Oracle Globally Distributed Database deployed on podman containers using podman-compose. It uses Swingbench 2.7 for the workload test.
Step 9: Bring Down the complete topology using “podman-compose” in a SINGLE COMMAND !!
Once you no longer need this deployment, you can bring it down using a single command using “podman-compose”. After that, you can clear the local filesystem used during the deployment.
Note: You will need to set the environment variables if earlier session is closed using “source podman-compose-prerequisites-free.sh”
$ podman-compose down
$ rm -rf ${PODMANVOLLOC}
|
Reference
For detailed instructions on how to use podman-compose please refer to:
https://github.com/oracle/db-sharding/blob/master/container-based-sharding-deployment/samples/compose-files/podman-compose/README.md


