Data Management
This page describes the processes and strategies used for collecting, storing, managing, protecting, and maintaining CCC data, with a particular focus on data persistence, backup, and restore mechanisms. Persistence ensures that data is not lost when the CCC container is stopped or restarted, while backup and restore are key components of data protection and disaster recovery strategies. Together, these processes help ensure the availability, integrity, and security of CCC data and form the foundation of CCC data management.
Persistence
CCC supports data persistence through bind mounts and volume mounts.
Bind Mount
The default persistence mechanism used by CCC is a bind mount, where the CCC container mounts a file or directory from the host system into the container’s file system. This allows the container to access and modify data as if it were part of its own file system. Any changes made by the container are reflected on the host machine, ensuring that data persists even if the container is stopped or deleted.
Podman
For users who have installed the CCC database using Podman, the /usr/safenet/db/data directory inside the CCC database container is mapped to the /home/ccc/pgdata directory on the host machine. The entire CCC database is stored in the pgdata directory. When the CCC container is initialized, it reads the volume mapping defined in the ccc_config.env file and begins persisting database data according to the specified configuration.
You can change the directory mapped on the host machine by modifying the ccc_config.env file.
Kubernetes/Helm
For users who have installed the CCC database using Kubernetes or Helm, the /usr/safenet/db/data directory inside the CCC container is mapped to the /home/ccc/pgdata directory on the host machine. The entire CCC database is stored in the pgdata directory. When the CCC container is initialized, it reads the volume mapping defined in the pv-pvc.yaml file and begins persisting database data according to the specified configuration.
You can change the directory mapped on the host machine by modifying the pv-pvc.yaml file.
Backup and Restore
The approach used to back up and restore CCC data depends on whether CCC is deployed with an internal database or an external database. Backup and restore procedures also vary based on the deployment platform, such as Podman or Kubernetes.
CCC Internal Database: Backup and Restore
When CCC operates with an internal database, it uses a PostgreSQL database running inside the CCC container. Data persistence is handled using a bind mount mechanism, which links the database directory inside the container to a directory on the host machine.
Backup
To back up the CCC internal database, perform the following steps.
Create a database dump file.
Podman
podman exec ccc bash -c "pg_dump 'host=localhost port=5432 dbname=lunadirectordb user=lunadirector password=dbpassword' > postgres.sql"
Kubernetes
kubectl exec -it <podname> -- bash -c "pg_dump 'host=localhost port=5432 dbname=lunadirectordb user=lunadirector password=dbpassword' > postgres.sql"
Copy the dump file from the container to the host machine for safekeeping.
Podman
podman cp ccc:/usr/safenet/ccc/postgres.sql .
Kubernetes
kubectl cp:/usr/safenet/ccc/postgres.sql .
Restore
Restoring data involves importing the previously created database dump file.
Copy the backup file into the CCC container.
Podman
podman cp postgres.sql ccc:/usr/safenet/ccc/
Kubernetes
kubectl cp postgres.sql <podname>:/usr/safenet/ccc/
Restore the database using the CCC database migration utility.
Podman
podman exec ccc bash -c 'db-migration --truststore CCC_truststore_password --keystorepass CCC_keystore_password --cccpass CCC_admin_password --dbpass database_password --file filename --copass crypto_officer_password'
Kubernetes
kubectl exec <podname> -- bash -c 'db-migration --truststore CCC_truststore_password --keystorepass CCC_keystore_password --cccpass CCC_admin_password --dbpass database_password --file filename --copass crypto_officer_password'
If the CCC administrator password contains special characters, they must be escaped. For example, if the password is Ab@C$123!, enter it as Ab\@C\$123\!.
CCC External Database: Backup and Restore
If CCC is deployed with an external PostgreSQL database, backup and restore operations must be performed directly on the external database using standard PostgreSQL tools and procedures. Refer to the official PostgreSQL documentation for detailed instructions.