Embedded database is lost due to docker storage and mounting issues
DSS configuration data is sometimes lost during a
dpdeploy.sh restart or stop if you are using the embedded database for production purposes.
Due to issues with the Docker storage engine, conflicts with other processes can prevent the mounted storage under a docker container from being unmounted correctly. This can result in the loss of data in the embedded database.
To prevent this problem from occurring:
- Avoid using the embedded database for production purposes.
- Regularly backup and create a local copy of the embedded Postgres database to allow for graceful recovery.
To perform backup and recovery of the database:
Back up the database.
docker exec -u postgres dp-database pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Remove the docker container.
docker rm -f dp-database
Remove the docker volume.
docker volume rm postresql-data
Start the database container.
Restore the database.
cat <Name of the backup file.sql> | docker exec -i dp-database psql -U dp_admin -d dataplane