November 12, 2021, 2:45pm
The user manual states (section 31.9.1) that performing a backup of a running CDB must be done via “
confd --cdb-backup”. This commands creates a tar-gz file with A.cdb and C.cdb that can then be backed up.
I’ve also read this post
One question about the disk IO write rate - NETCONF - ConfD User Community (tail-f.com). That describes the implementation of the CDB file:
CDB store configuration data by default persistently in a file called “A.cdb”. This file is a journal file, i.e. each transaction (e.g. NETCONF edit-config with target running) is just appended to this file and when the transaction has been completed ConfD adds a “magic marker”.
If ConfD is killed/crash and subsequently restarted at some point during an ongoing transaction, ConfD will read the transaction that has been committed and if there is a transaction at the end of the file with a missing “magic marker”, the transaction will be considered incomplete and the transaction will be ignored.
A transaction is either committed or not. A transaction cannot be partially committed. Even though there is a power outage either the writing of the “magic marker” succeeds or fail, so just a part of a transaction cannot make it into the journal file.
Since just adding data to journal file would lead to that we eventually would run out of disk space, ConfD run an algorithm that handle compacting it automatically by default.
ConfD perform a compaction by writing the data it has stored in RAM to a file named, for example, A.cdb.tmp and then rename the file from *.cdb.tmp to *.cdb. Hence, the compaction cannot fail since, even though if there is a power outage, the renaming of the file either succeeds or fail.
After a successful compaction the journal file will contain one single transaction that can be applied in one go if ConfD is restarted.
After reading that part I’m wondering if a snapshot of the CDB volume (kubernetes persistent volume in this case) would be a viable backup alternative to the tar-gz approach using
November 12, 2021, 5:17pm
If you are ok with that an ongoing transaction is not backed up then yes. The point of either using confd --cdb-backup or taking a global northbound interface lock is to not miss an ongoing transaction when taking a backup.