6. Backup Server Setup
6.2. Setting up a cold standby script-based backup server
6.2.1. Server Mode
The DNA-M server can be run in three different server modes.
Table 47. Server Modes
Normal Default non-backup mode
Primary Server is the primary one
Secondary Server is the secondary one
To be able to run the secondary server after a restore operation without any need for handson configuration, the parameters for SNMP agent address and the TFTP server address must be set in the server.conf file on each host
For back-up purposes, the two hosts must be run simultaneously. The upload function must have identical configuration on both the DNA-M server and, if applicable, the separate PM server. Also, all changes done to the secondary server will disappear after the next synchronization.
6.2.2. Configuration of the primary server
1. Set main.serverMode: to primary in the server.conf file on the primary server
2. Restart the DNA-M server and verify that Server Mode (Options > Server Mode in DNA-M Server GUI) is set to primary
6.2.3. Configuration of the secondary server
1. Install the DNA-M Server intended to use as the secondary server on a separate host according to DNA-M Installation Guide for Linux or DNA-M Installation Guide for Windows without starting the DNA-M Server
2. Set main.serverMode: to secondary in the server.conf file on the secondary server
3. Start the secondary DNA-M Server, and verify that Server Mode (Options > Server Mode in DNA-M Server GUI) is set to secondary
4. On the secondary server, set up a shared directory for the data transfer between the primary and the secondary server
To avoid any truncation problems, when restoring the secondary server later on, avoid any white spaces in the directory path for the shared directory.
Do not use the shared directory for other purposes than synchronizing the DNA-M servers since all non DNA-M related files will be removed.a. Linux
6. Backup Server Setup
This command requires an NFS daemon to be installed and running on the secondary server. The <hostname> parameter is the hostname of the primary server. The shared directory’s permissions must also be set for reading and writing.
b. Windows
> net share <share name>=<path to shared_directory> /GRANT:<user>,FULL /REMARK:"{productName} Script-based backup server"
The shared directory need to have write permission for the data transfer to work, this is done by the option /GRANT:<user>,FULL when creating the shared directory.Refer to http://support.microsoft.com (select your Windows server version, and search for net share).
6.2.4. Backing up the primary server
1. On the primary server, mount the shared directory created on the secondary server. You can also place the data transfer directory on a third server, used for storage only, and mount that directory on both the primary and the secondary server.
Linux
# mount -o vers=3 <hostname>:<path to shared_directory> <path to mount_point>
Windows
> net use \\<hostname>\<share name> /SAVECRED
Enter the username followed by the password when prompt
/SAVEDCRED stores the credentials (store username and passwords) as a key in the Credential Manager for the resource when the connection is made.Refer to http://support.microsoft.com (select your Windows server version, and search for net use).
2. Navigate to the DNA-M scripts directory in a command prompt Linux
# cd /opt/transmode/tnm/mainserver/scripts
Windows
6. Backup Server Setup
> cd c:\Program Files\transmode\tnm\mainserver\scripts
3. Execute the script to backup the primary server Linux
# ./backup_primary.sh -uroot -proot -ntnmdb -d <path to mount point>
Windows
> backup_primary.cmd -u root -p root -n tnmdb -i "c:\Program Files\transmode\tnm" -d \\<hostname>\<share name>
The options given are: DNA-M database name (-n), database user name (-u), database password (-p), DNA-M installation directory (-i) and the network mounted data transfer UNC path (-d), as stated in step 1.The option (-p) for a database password should be excluded if no password has been set for the MariaDB root user.
Additional options:
• Flag -i specifies path to the install directory
• Custom backup file name (-b)
Execution without this option will give the backup file the same file name as the defined database name (-n), e.g. tnmdb.sql. If the backup file should be given another file name than the default, append the option -b to the command above:
Linux: -b<backup file name>.sql Windows: -b <backup file name>.sql
4. Backup was successfully completed if a file named backupedOK.txt exists in the shared transfer directory together with all backup files.
6.2.5. Transfer backup of primary server to secondary server
1. Navigate to the DNA-M scripts directory in a command prompt Linux
# cd /opt/transmode/tnm/mainserver/scripts
Windows
> cd c:\Program Files\transmode\tnm\mainserver\scripts
2. Execute the script to to update the secondary server using the backup files from the primary 6. Backup Server Setup
Linux
# ./restore_secondary.sh -uroot -proot -ntnmdb -d <shared_directory>
Windows
> restore_secondary.cmd -u root -p root -n tnmdb -i "c:\Program Files\transmode\tnm -d <shared_directory>
Additional options:
• Custom backup file name (-b)
Execution without this option assumes that the backup file name, from the primary server, has the same file name as the database name.
If the secondary server should be using a backup file with another file name than the default, append the option -b to the command above:
Linux: -b<backup file name>.sql Windows: -b <backup file name>.sql
• Custom database name (-n)
• DNA-M Server restart (-r)
The DNA-M Server will be shut down during execution of the restore script. If the secondary server should be restarted after execution of the restore script, append the option -r to the command above.
3. Restoring was successfully completed if a file named restoredOK.txt exists in the shared transfer directory, and the secondary now contains the same data and setting as the orimary server.
6.2.6. Automating the synchronization process
This synchronization process can be automated in both Linux and Windows. If customized error handling is needed to automate the status reporting of the backup- and restore procedure, put the script executions within other scripts and call this script from the scheduler.
6.2.6.1. Linux
Automating synchronization in Linux is done using cron 1. On the primary server, add backup script as cron job
# /opt/transmode/tnm/mainserver/scripts/backup_primary.sh [options] > ../log/backup_primary.log
2. On the secondary server, add restoring script as cron job
# /opt/transmode/tnm/mainserver/scripts/restore_secondary.sh [options] > ../log/restore_secondary.log
3. Let the cron job run once and check the backup_primary.log and restore_secondary.log
6. Backup Server Setup
afterwards. The scripts will set the $? environment variable to 1 if something goes wrong during execution.
6.2.6.2. Windows
Automating synchronization in Windows is done using Task Scheduler 1. On the primary server, add backup script to a scheduled task
> cmd.exe /c backup_primary.cmd [options] > C:\log\backup_primary.log
2. On the secondary server, add restoring script to a scheduled task
> cmd.exe /c restore_secondary.cmd [options] > C:\log\restore_secondary.log
3. Let the scheduled jobs run once and check the backup_primary.log and restore_secondary.log afterwards. The scripts will set the errorlevel environment variable to 1 if something goes wrong during execution.