Technical Tip: How to do advanced checks on the CMDB replication
| Description | This article describes how to do advanced checks on the CMDB replication. |
| Scope | FortiSIEM. |
| Solution | When the FortiSIEM is in DR mode and CMDB replication is not in sync from the Admin -> Health -> Replication menu, there are a few checks that can be done and some actions to remediate the issue, like below:
Make sure dr_slot1 is displayed on the primary CLI as root:
Make sure sync_state is 'streaming':
If the row is missing or the sync_state is not 'streaming', it means that replication is not ongoing properly.
From super 1 CLI as root:
nmap -p 5432 super2_address PORT STATE SERVICE
From super 2 CLI as root:
nmap -p 5432 super1_address PORT STATE SERVICE
When the connection is fixed, the replication should start again by itself. If /cmdb is growing and the secondary has been disconnected for a long time, it is recommended to stop the DR mode by removing the secondary node under Admin -> License -> Node (before disk usage gets 100% and crashes the primary).
su admin -c "monctl stop" su admin -c "phtools --stop ALL" systemctl stop postgresql-13 # If necessary, perform a backup of the data directory <----- Check disk usage for /cmdb and space left in destination directory. df -h /cmdb df -h /tmp tar -czvf /tmp/data_backup.tar.gz /cmdb/data cd /cmdb/data/ rm -rf *
Replace 'primary' with the IP of the primary in the next command.
su postgres -c "pg_basebackup -h primary -D /var/lib/pgsql/13/data -U phoenix -v -P -R -X stream -c fast" systemctl start postgresql-13 systemctl status postgresql-13 su admin -c "monctl start" su admin -c "phtools --start ALL"
The pg_basebackup command can take some time along the amount of data to transfer.
Note: If users notice the error '0000000x.history (No such file or directory)' during execution of pg_basebackup command, proceed to Primary device and create an empty file manually, and run the pg_basebackup command in the Secondary again:
cd /cmdb/data/pg_wal/ touch 00000000x.history <-- Replace x with the number notice in the error.
Afterwards, repeat step 1 to check the replication state. |
