Migrating Database
If you are an existing CCC user planning to upgrade to the latest version and want to migrate your existing database, consider choosing one of the following scenarios:
Migrate your PostgreSQL database
-
Migrate from external PostgreSQL database to internal PostgreSQL database
-
Migrate from internal PostgreSQL database to external PostgreSQL database
Migrate your existing PostgreSQL database as it is
To migrate your PostgreSQL database as it is from the previous CCC version to the latest version, you have two choices:
Migrating your old database without creating backup
There are two possibilities here, depending on how you've installed CCC:
a. If you've installed CCC using Kubernetes, Helm, or Podman with external database: Update the configuration and password of the database, as described under the Installing Crypto Command Center page.
b. If you've installed CCC using Podman with internal database:
Copy the existing pgdata folder located inside the podman folder and paste it into /home/ccc/.
Change the ownership of /home/ccc/pgdata to the user who is running the CCC container. The podman-compose.yml file, by default, points to this location for the database, so it will be picked up for the new version of CCC.
Creating backup of old database and then migrating
To create a backup of the old database and then migrating, follow the guidelines explained under the Backup and Restore section.
Please exercise caution while performing these actions, as handling databases requires care to prevent data loss or application disruption. It is advisable to take necessary backups before proceeding with any changes. Refer to the relevant documentation and seek support resources for detailed guidance based on your specific setup.
Migrate from extrernal PostgreSQL database to internal PostgreSQL database
The steps involved in migrating your external PostgreSQL database to internal PostgreSQL database are:
Install CCC using Podman, as explained here.
Login to the virtual machine that contains your existing PostgreSQL database.
Create a dump of your existing database using the following command:
pg_dump -h IP of source PostgreSQL database -p 5432 -U lunadirector lunadirectordb > postgres.sql
Copy the dump that you’ve created to the podman directory inside the CCC package.
Go the the podman directory inside the CCC package and run the following command to copy the postgres.sql file inside the CCC container:
podman cp postgres.sql ccc:/usr/safenet/ccc/
Run the following command to start data migration to internal PostgreSQL database.
podman exec ccc bash -c 'cd scripts && sh dbmig.sh postgres-file-name CCC_ADMIN_PASSWORD'
If you are using special characters such as # and $ in the password, you need to put a backward slash \ before those characters to avoid errors.
Upon successful completion of the data migration process, you’ll see a confirmation message on your screen. Thereafter, you can login to CCC and check whether the data has been successfully migrated.
Migrate from internal to external PostgreSQL database
The steps involved in migrating your internal PostgreSQL database to internal PostgreSQL database are:
Use the link that you would have received over email to download and extract the CCC package.
Login to the virtual machine that contains your existing PostgreSQL database.
Create a dump of your existing database by running the following command:
pg_dump -h IP of source PostgreSQL database -p 5432 -U lunadirector lunadirectordb > postgres.sql
Start your target PostgreSQL database where you want to migrate your existing database.
Open the directory where you’ve created the postgres.sql file in step 3 and run the following command to copy the existing database to the target database:
psql -h IP of target postgres db -p 5432 -U lunadirector -f postgres.sql lunadirectordb
Install CCC using either Podman or Kubernetes, as explained here.
During CCC installation, while modifying the configuration settings in the Master node, you need to provide various database related details, such as IP of the target database and database password.
Upon successful completion of the CCC installation process, you’ll see a confirmation message on your screen. Thereafter, you can login to CCC and check whether the data has been successfully migrated.
Migrate your Oracle database
Follow the below-mentioned three-step process to migrate your data from Oracle to PostgreSQL:
Install CCC
Before you begin the process of migrating your database from Oracle to PostgreSQL, install CCC, using the steps explained here.
Migrate database
Follow steps 1 to 9, if you've installed CCC using Podman and are using an internal database. Follow steps 1 to 12 if you've installed CCC using Podman and are using an external database, or if you've installed CCC using Helm and are using an external database. Follow steps 1 to 14 if you've installed CCC using Kubernetes and are using an external database.
Download the db-migration package, depending on whether you are using an external database or an internal database.
Go to the directory where you’ve downloaded the db-migration package.
Run one of the following commands to initiate the process of database migration from Oracle to PostgreSQL, depending on whether are using an external database or an internal database:
sh start-data-migration-external-db.sh
or,
sh start-data-migration-internal-db.sh
Enter Y to initiate the database migration process.
Enter the hostname or IP address, enter oracle as the user name, and enter the password of the Oracle database server.
Enter the Oracle database server password to begin the initial setup.
Enter the Oracle database server password to begin data extraction.
Enter the Oracle database server password to copy the files from Oracle database server to your local machine.
Enter the Oracle database server password to delete the data-dump files. Following this, database insertion will take place, CCC will get reconfigured, and the server will get restarted. This process can take some time to get completed, depending on the size of your database.
If you've installed CCC using Podman and are using an internal database, your database migration process gets completed with this step and you can now activate CCC after database migration. If you've installed CCC using Podman and are using an external database, or have installed CCC using Helm and are using an external database, or have installed CCC using Kubernetes and are using an external database, continue to the next step.
Copy the files from the local machine to PostgreSQL server or virtual machine by entering the PostgreSQL database server hostname or IP address, user name (root user), and password.
Enter the PostgreSQL database server password once again to insert data into the database.
Enter the PostgreSQL database server password once again to run the re-configuration script and start CCC.
If you've installed CCC using Podman and are using an external database, your database migration process gets completed with this step and you can now activate CCC after database migration.
If you've installed CCC using Helm and are using an external database, navigate to the Helm directory inside the CCC package and run the command helm uninstall ccc
to remove the existing installation, followed by the command helm install ccc .
to reinstall CCC. Your database migration process gets completed with this step and you can now activate CCC after database migration.
If you've installed CCC using Kubernetes and are using an external database, go to the next step.
Navigate to the ccc/kubernetes directory and delete the existing CCC container using the following command:
kubectl delete –f deployment.yaml
Restart Kubernetes container using the following command:
kubectl apply –f deployment.yaml
This completes the database migration process if you've installed CCC using Kubernetes and are using an external database. You can now activate CCC after database migration.
Activate CCC after database migration
Log on to CCC.
Click the Administration tab from the main menu and complete the CCC activation process as follows:
-
Check the checkbox to confirm that your HSM device is running firmware 7.7 or above.
-
Enter the partition label and password.
-
Press the Activation button. You will see a message stating that CCC has been successfully activated.
Upload your CCC license and press Continue. This completes the database migration process.
You should check whether all of your data has been successfully migrated from Oracle to PostgreSQL. It is recommended that you retain your Oracle database for some time after completing the migration process.
Reconfiguring devices after changing the CCC root of trust
In case you've changed the CCC root of trust (ROT), you need to reconfigure the devices to perform device monitoring and various other device management tasks. To reconfigure your devices:
Login to CCC and navigate to Devices.
Select the device that is displaying the error under the Device Status column.
Click the Connection tab.
Press the Update Credentials button.
In the Update Rest API Credentials window that appears, enter your username and password and then press the Update button. A pop-up message will appear on your screen, indicating that the credentials have been successfully changed.
Click the Authorization tab and then press the Re-authorize Device button.
In the Authorize SO Login window that appears, enter the HSM SO password to grant CCC the right to login to the device, and then press the Authorize button.
In a short while, the Device Status icon will turn to green and you'll be able to perform the device monitoring tasks. In case you have another device that's reflecting the same error perform the above-mentioned procedure again for that device.