Configure Container Deployment
After deploying KWDB with script in a container environment, the system generates the docker-compose.yml configuration file which can be used to control the startup flags and CPU resource allocation for KWDB.
Note
Both startup flags and CPU configurations are node-specific. To ensure consistent performance across your cluster, apply the same configurations to all nodes.
Configure Startup Flags
While KWDB provides reasonable default settings, you can customize its behavior by modifying the startup flags. Your custom settings will override the default values. For a list of all supported parameters, see Cluster Parameters.
To modify startup flags:
Navigate to the
/etc/kaiwudb/scriptdirectory and stop the KWDB container.docker-compose downOpen
docker-compose.yml, locate thecommandsection, and add or modify parameters as needed.WARNING
Keep all existing startup flags in place. Removing them may prevent the database from starting.
Example: Add the
--cacheparameter and set it to25%.... command: - /bin/bash - -c - | /kaiwudb/bin/kwbase start-single-node --certs-dir=<certs_dir> --listen-addr=0.0.0.0:26257 --advertise-addr=your-host-ip:port --store=/kaiwudb/deploy/kwdb-container --cache=25%Start KWDB with the new configuration.
systemctl start kaiwudb
Manage CPU Resources
You can adjust the CPU resources allocated to KWDB on each node by either using the docker update command or modifying the configuration file.
The CPU setting (CPUs) represents how many CPU cores KWDB can use and is calculated using the following formula: CPUs = (desired usage percentage) × (number of CPU cores). For example, to use 30% of a 6-core system: 0.3 x 6 = 1.8.
To adjust CPU allocation:
Using the
docker updatecommand:docker update --cpus <value> kwdb-containerUsing the
docker-compose.ymlfile:Navigate to the
/etc/kaiwudb/scriptdirectory and stop the KWDB container.docker-compose downEdit
docker-compose.ymlto update the CPU resource limits.Example: Limit the CPU resources to
1.8for KWDBversion: '3.3' services: ... deploy: resources: -1 limits: cpus:'1.8' ...Recreate and start the KWDB container.
systemctl start kaiwudb