Cisco Optical Network Planner Configuration Guide, Releases 26.x.x

PDF

Database backups

Want to summarize with AI?

Log in

Overview

Provides a mechanism for system administrators to schedule daily, weekly, or monthly database backups on durable NFS storage. It covers the archive types, setup requirements, manual backup procedures, scheduling methods, and restoration processes to ensure data protection.

A database backup is a data protection mechanism that

  • allows system administrators to schedule full database backups at daily, weekly, or monthly intervals,

  • lets only system administrators access backup folders and perform restorations, and

  • stores all backup archives on a highly durable NFS share.

Archive types

Archive types available for database backups 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 to meet specific retention needs.

Set up database backup storage

Use this task to ensure reliable backups of database archives by preparing NFS storage and configuring backup scripts

Database archives require secure, high-durability backup storage. This task guides you through establishing a reliable NFS storage location and preparing scripts for regular backups and restoration.

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

1.

Log into the Cisco ONP server, where you have installed Cisco ONP by using the tar archive.

2.

Create a folder for backup. Ideally it should be mounted on a reliable object storage such as NFS.

3.

Copy backup, rotation, and setup backup scripts from ONP/images folder to the new folder created in step 2.

Example:

 $ cd 
$ mkdir cnp_backups
$ tree ~/cnp_backups/
 /home/ciscocnp/cnp_backups/
├── backup_postgres.sh
└── rotation.sh
└── setup_backup.sh

Ensure that all scripts have necessary permissions:

 $ chmod +x backup_postgres.sh 
 $ chmod +x rotation.sh
 $ chmod +x setup_backup.sh
$ ls -l | grep .sh
 -rwxrwxr-x 1 ciscocnp ciscocnp 518 Jan 16 05:23 backup_postgres.sh
-rwxrwxr-x 1 ciscocnp ciscocnp 1412 Feb 1 05:50 rotation.sh
4.

Copy restore_postgres.sh from /ONP/images/.

Backup scripts are prepared and ready to archive, rotate, and restore database files securely on your NFS storage.


Back up the Cisco ONP database

Follow these steps to back up the Cisco ONP database.

Procedure

1.

Browse to the location where the backup_postgres.sh script is stored.

2.

Use the bash rotation.sh command to execute the rotation.sh script.

Example:

user@server:~/cnp_backups$ bash rotation.sh

This command creates the necessary folder structure.

3.

Use the bash backup_postgres.sh command to execute the script.

Example:

 user@server:~/cnp_backups$ bash backup_postgres.sh

The backup file is stored in the daily backup folder (backup.daily) with the current time stamp.


Backup scheduling methods

You can schedule a backup using either of these methods:


Schedule a backup using script

Follow these steps to schedule the backup operation using a script.

Procedure

1.

Log in to the Cisco ONP server.

2.

Use the command bash rotation.sh to execute the rotation.sh script.

Example:

user@server:~/cnp_backups$ bash rotation.sh

This command creates the necessary folder structure.

3.

Use the command bash setup_backup.sh to execute the setup_backup.sh script.

Example:

 user@server:~/cnp_backups$ bash setup_backup.sh

The backup file is stored in the daily backup folder (backup.daily) with the current time stamp.

4.

Enter the path at the user prompt to store the file.

Backup files are stored in your required file path as shown in this example.

Example:

/user-defined path/backups/backup.daily

Schedule a backup with Crontab

Follow these steps to schedule the backup operation using Crontab.

Procedure

1.

Log in to the Cisco ONP server.

2.

Use the command sudo crontab -e to configure the Crontab job.

user@server~/cnp_backups$ sudo crontab -e
3.

Update the Crontab.shscript with the required cron job entries using the Syntax to schedule the backup using Crontab, to schedule backup operations.

Example:

This example shows the scheduling of the backup operation at 3:00 a.m daily.

 0 3 * * * /home/ciscocnp/cnp_backups/backup_postgres.sh

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.