Start KVLite in a Container
This section explains how to start KVLite in a container.
- Pull the Oracle NoSQL Database Container ImageThe steps outlined below use the Oracle NoSQL Database Community Edition. You can pull the image directly from the GitHub Container Registry. Here, we are pulling the non-secure image.
docker pull ghcr.io/oracle/nosql:latest-ce docker tag ghcr.io/oracle/nosql:latest-ce oracle/nosql:ce
- Run Oracle NoSQL Database in a ContainerYou must provide a name and a hostname.
Output:docker run -d --name=kvlite --hostname=kvlite --env KV_PROXY_PORT=8080 -p 8080:8080 oracle/nosql:ce
KVLite is started in a container and the ID of the container is displayed.
By default, the KVLite store that is created has a size of 10 GB. You can use19001d44b56aa9a53c75cf0904298c4e0e3013df287e4a8f83ebff2e1b0ac172
--env KV_STORAGESIZE=N
to set a new value, where N is in gigabytes and must have a value greater than 1. - Check the Status of the ContainerTo check the status of the container, run the following command:
Output:docker ps
The details of the container are displayed.CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 19001d44b56a oracle/nosql:ce "bash -c ./start-kvl…" 6 minutes ago Up 6 minutes 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp kvlite
- Validate your DeploymentYou can ping the KVLite store instance using the following commandOutput:
docker exec -ti kvlite java -jar lib/kvstore.jar ping -host kvlite -port 5000
Pinging components of store kvstore based upon topology sequence #14 10 partitions and 1 storage nodes Time: 2025-04-28 09:57:53 UTC Version: 24.4.9 Shard Status: healthy: 1 writable-degraded: 0 read-only: 0 offline: 0 total: 1 Admin Status: healthy Zone [name=KVLite id=zn1 type=PRIMARY allowArbiters=false masterAffinity=false] RN Status: online: 1 read-only: 0 offline: 0 Storage Node [sn1] on kvlite: 5000 Zone: [name=KVLite id=zn1 type=PRIMARY allowArbiters=false masterAffinity=false] Status: RUNNING Ver: 24.4.9 2024-11-21 17:06:06 UTC Build id: 95fa28ea4441 Edition: Community isMasterBalanced: true serviceStartTime: 2025-04-28 09:43:36 UTC Admin [admin1] Status: RUNNING,MASTER serviceStartTime: 2025-04-28 09:43:38 UTC stateChangeTime: 2025-04-28 09:43:38 UTC availableStorageSize: 2 GB Rep Node [rg1-rn1] Status: RUNNING,MASTER sequenceNumber: 84 haPort: 5011 availableStorageSize: 9 GB storageType: HD serviceStartTime: 2025-04-28 09:43:39 UTC stateChangeTime: 2025-04-28 09:43:39 UTC
- Query the DatabaseYou can start the SQL shell to query the database and create few tables.
The SQL prompt is displayed.docker exec -ti kvlite java -jar lib/sql.jar -helper-hosts kvlite:5000 -store kvstore
Enter the SQL query to create a table namedsql->
ticket
.
Output:sql->create table if not exists ticket(ticketNo LONG, confNo STRING, PRIMARY KEY(ticketNo))
The table is created successfully
Enter the query to show the list of tablesStatement completed successfully
Output:sql->show tables
The tableticket
that you just created is listed.tables SYS$IndexStatsLease SYS$MRTableAgentStat SYS$MRTableInfo SYS$MRTableInitCheckpoint SYS$PartitionStatsLease SYS$SGAttributesTable SYS$StreamRequest SYS$StreamResponse SYS$TableMetadata SYS$TableStatsIndex SYS$TableStatsPartition SYS$TopologyHistory ticket