Skip to main content

Backup of CMDBuild data

All CMDBuild data is stored in the PostgreSQL database. To back up the system, it is sufficient to back up the database.

Database backups can be performed using a graphical tool such as pgAdmin, or via the PostgreSQL command line.

Example:

pg_dump \
--host localhost \
--port 5432 \
--username "postgres" \
--format custom \
--verbose \
--file /backup/cmdbuild/cmdbuild.backup \
cmdbuild_db

This command connects to the PostgreSQL instance running on localhost and creates a compressed backup of the cmdbuild_db database. The backup is saved to /backup/cmdbuild/cmdbuild.backup in PostgreSQL's custom format, which is smaller than a plain SQL dump and supports selective restore. The --verbose flag prints progress information to the console during execution.

ParameterValueDescription
--hostlocalhostPostgreSQL instance host
--port5432PostgreSQL port (default)
--username"postgres"Authentication user
--formatcustomCustom compressed format — smaller than a plain SQL dump and supports selective restore
--verbosePrints progress information to the console during execution
--file/backup/cmdbuild/cmdbuild.backupOutput path and filename for the backup file
(positional)cmdbuild_dbName of the database to back up

Database restore

A previously created backup can be restored at any time using the cmdbuild.sh utility. The following command drops the current database and recreates it from the specified backup file:

bash webapps/cmdbuild/cmdbuild.sh dbconfig recreate /path/to/database/backup.backup