What are my options for loading new data for best performance at startup?

The two best ways of loading new data into ConfD CDB at startup:

  1. 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

confd --cdb-backup 

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:

  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

@cohult Thanks for your suggestions. I am loading the configuration using maapi_load_config from a disk file. What would be the best way to find out what all configuration commands in the file that have failed ?

maapi_load_config() load a configuration from filename into ConfD in a transaction using the provided transaction handle. So when the transaction is applied, using for example maapi_apply_trans(), all or no commands in the transaction are applied.

See ConfD UG / confd_lib_maapi man pages for details on maapi_load_config() and errors returned by for example maapi_apply_trans().

The confd_load tool source code is a good example on the use of maapi_load_config() and maapi_apply_trans() / maapi_apply_trans_flags(). There are a couple of examples that come with ConfD that are good references for transactions using MAAPI too. See:

$CONFD_DIR/src/confd/tools/confd_load.c
$CONFD_DIR/misc/maapi_cli/cliapp.c
$CONFD_DIR/misc/maapi_command/maapi.c

Note that by default the complete configuration (as allowed by the user of the current transaction) is deleted before the file is loaded. To merge the contents of the file use the MAAPI_CONFIG_MERGE flag (this is usually what you want to do). To replace only the part of the configuration that is present in the file, use the MAAPI_CONFIG_REPLACE flag.

I am not able to apply “confd --cdb-backup” as I can see come error.

[root@pl-ipfe-1_3_0 ~]# /opt/nec/vcpe/lib/confd/erts/bin/confd --cdb-backup /root/filename.tar
Environment variable BINDIR is not set

How to solve this ?

Please create a new topic for this question.

Hi cohult,

I have created new topic “Not able to save cdb backup.” as requested.
Please help with this.

Thanks,
Kamal