Backup Database
The database backup configuration on the server, set by the system administrators, allows backups of the entire database to be taken daily, weekly, or monthly. Only system administrators have access to the backup folders and can perform restorations. Backup archives are stored on a highly durable NFS share. The available backup archives include:
-
Daily archives for the last 7 days
-
Weekly archives for the last 4 weeks
-
Monthly archives for the last 6 months
![]() Note |
You can change the duration for monthly archives. |
Setup Backup
Before you begin
-
Ensure that a highly durable 2 TB NFS storage is available to store database archives.
-
Ensure that the storage is accessible from the Cisco ONP environment.
-
Set up rules as defined by the Cisco ONP network and configure the appropriate Access Control List (ACL) to permit or deny access to the storage as needed.
Procedure
Step 1 |
Log into the Cisco ONP server, where you have installed Cisco ONP by using the tar archive. |
Step 2 |
Create a folder for backup. Ideally it should be mounted on a reliable object storage such as NFS. |
Step 3 |
Copy backup, rotation, and setup backup scripts from Example:
Ensure that all scripts have necessary permissions:
|
Step 4 |
Copy |
Perform manual backup
Follow these steps to back up the Cisco ONP database.
Procedure
Step 1 |
Browse to the location where the backup_postgres.sh script is stored. |
Step 2 |
Use the Example:
This command creates the necessary folder structure. |
Step 3 |
Use the Example:
The backup file is stored in the daily backup folder (backup.daily) with the current time stamp. |
Schedule a backup
You can schedule a backup in either of these two ways:
Schedule a backup using script
Procedure
Step 1 |
Log in to the Cisco ONP server. |
Step 2 |
Use the command Example:
This command creates the necessary folder structure. |
Step 3 |
Use the command Example:
The backup file is stored in the daily backup folder (backup.daily) with the current time stamp. |
Step 4 |
Enter the path at the user prompt to store the file. Example:
|
Schedule a backup with Crontab
Procedure
Step 1 |
Log in to the Cisco ONP server. |
Step 2 |
Use the command
|
Step 3 |
Update the Example:This example shows the scheduling of the backup operation at 3:00 a.m daily.
|
Syntax to schedule the backup using Crontab
Use this syntax to schedule a backup in Crontab:
m h dom mon dow
Where:
-
m: Minutes (0–59)
-
h: Hours (1–23)
-
dom: Day of the month (1–31)
-
mon: Month of the year (1–12)
-
dow: Day of the week (0–6, where 0 represents Sunday)
To specify the time, you can provide exact values for the minute (m), hour (h), day of the month (dom), month (mon), and
day of the week (dow). Alternatively, you can use the wildcard character *
in these fields to indicate "any value."
![]() Note |
The backup jobs are initiated according to the system daemon's understanding of time and time zones as defined by the cron scheduler. |
Restore the database manually
Follow these steps to restore the database manually.
Procedure
Step 1 |
Check the Cisco ONP Database. Example:
|
Step 2 |
Remove the Cisco ONP back-end and front-end Docker services,"docker service rm cnp_cnp cnp_cnp_frontend" and check again: Example:
|
Step 3 |
Copy the database to the folder that is mapped to PostgresDB container's volume: Example:
|
Step 4 |
Restore the database and check. Example:
|