The two best ways of loading new data into ConfD CDB at startup:
- Loading from pre-configured CDB files is by far your most effective option if your use-case allow that you overwrite the current (if any) configuration data in CDB.
By default, if not changed in the ConfD configuration file, ConfD will load its initial configuration from two files, A.cdb and C.cdb (if they already exist). If ConfD is stopped, these two files can simply be backed up by copying them, and the copy is then a full backup of CDB. If ConfD is running, we cannot copy the files, but need to use
to copy the two CDB files into a backup file (in gzipped tar format). These files can then be restored to the confd-cdb folder where ConfD by default keep its persistent storage in the A and C.cdb files , if not changed in the ConfD configuration.
This is your best option if you want to initialise ConfD CDB data in the fastest way possible.
Next, approximately 10x slower than option 1:
- Loading from XML backup file(s) is a good option if you need to merge your initial configuration data with existing configuration data, or need to move data between major revision changes of ConfD.
If no *.cdb files exists in the confd-cdb folder at startup, ConfD will read any xml files that you placed there. Or you can read from disk using the confd_load tool that comes with the ConfD release, or use the the load command in the ConfD CLI.
Or you can have a script use confd_cli to load your xml backup:
#!/bin/bash confd_cli -u admin <<EOF config t load merge initial.cfg commit exit EOF
To create an XML backup of your configuration when the configuration is in CDB you can use the confd_load tool or the ConfD cli doing something like:
show /path-to-your-config | display xml | save ./confd-cdb/my_inialization_file.xml