Database Backup
(Procedure applicable only for builds prior to 6301. For later versions, click here)
Data stored in Password Manager Pro database are of critical importance and in any production environment, there would be constant requirements for backing up the data for reference purposes or for disaster recovery. To achieve this, Password Manager Pro provides two features:
1. Live Backup
Whenever there happens an addition or modification of the entries in the Password Manager Pro database, the data gets immediately backed up. Password Manager Pro achieves this live backup by leveraging the database replication feature offered by MySQL.
A live 'slave' database could be configured in a remote location and it will get instantaneously updated whenever the 'master' database running with Password Manager Pro undergoes a change. At any point of time, the data in both the databases will be in synchronization with each other. In the unlikely event of any disaster to the primary database, you can rely on the slave database and recover the data.
To enable Live Backup,
Prerequisite
- After installation, the Password Manager Pro server should have been started and stopped at least once
- If Password Manager Pro server is already running, stop it before proceeding further
Step 1: Setup master and slave databases
- Go to <PMP_Home>/bin directory and run the script replicationPack.bat (in Windows) / replicationPack.sh (in Linux)
- This will create a new directory named 'replication' under <PMP_Home> and a replication package in the form a zip file will be created under <PMP_Home>/replication folder. This zip with the name "Replication.zip" contains the slave database package
- Move the zip file from <PMP_Home>/replication folder to the remote location where you wish to keep the slave database for live backup
- Unzip the zip file in the remote machine
- The slave database is now setup
- The database that is bundled with Password Manager Pro acts as the master database. No separate setup is required for that
Step 2: Start master and slave databases
- Now, come back to the machine where Password Manager Pro is running. Navigate to <PMP_Home>/bin directory and run the script startDB.bat <MySQL Port> (Windows) / startDB.sh <MySQL Port> (Linux)
- Again go to the remote machine and navigate to the <MySQL>/bin folder and run the script startSlaveDB.bat (Windows) / startSlaveDB.sh (Linux)
For example, with the default the MySQL port 2345, you need to execute this as:
startDB.bat 2345 (For Windows)
startDB.sh 2345 (For Linux)
Step 3: Start Password Manager Pro server
- Start the Password Manager Pro server
- Live Backup setup is ready now. Whenever there happens a change in the master database, which runs with Password Manager Pro, the same will be immediately updated to the slave database
Verify Live Backup Setup
After carrying out the above steps, you can verify if the Live Backup setup is working properly by looking at the message in "Admin >> General >> Database Backup" page. If the setup is proper, you will see the following:
Connection Status: Alive and Live Backup is in progress now
Slave database is running in host: <Host Name>
Recovering data from slave when master database crashes
In the rare event of master database crash, you can recover data from the slave database.
To recover the data,
- In the remote machine where slave DB is running, navigate to <MySQL>/data folder and create a zip of the following:
- "passtrix" directory
- "ibdata1" file
- Copy the zip created as above.
- Go to the machine where Password Manager Pro was running.
- Get a fresh Password Manager Pro installation in the machine where the master database was running.
- Navigate to <PMP_Home>/mysql/data folder and unzip the zip created from the slave database. Once you do this, the data is safely recovered in the new Password Manager Pro version.
- Now, start the Password Manager Pro server.
Note: Once you recover the data from the slave and give life to the master database, the slave database will no longer be valid. Just delete the mysql folder in the remote machine. If you want to have the Live Backup enabled again, you need to follow the steps once again.
2. Scheduled Backup
You can schedule database backup to be executed at any specific point of time.
To schedule database backup,
- Go to "Admin" tab.
- Click "Database Backup" icon under "General" section.
- In the UI that opens up, select the schedule option - day, weekly or monthly.
To schedule database backup,
- If your requirement is to backup the database contents in specific day intervals - say, once in three days, this option would come in handy. You can choose any interval between 1 and 28 and also specify the time at which backup has to be taken.
- To enable this option, click the radio button "Day".
- Select the day interval.
- Select the time at which backup has to be taken.
- Backed up data are stored as a .zip file under <PMP_Home>/backUp directory by default. If you want, you can specify the destination directory where you wish to store the backed up contents.
- Every time backup is executed, one backup file will be created. You can specify the maximum number of such backup files to be kept in this directory. For example, if you choose "10" in the drop-down against the field "Maintain latest --- backups only", only the latest 10 backup files would be kept under this directory.
- Click "Save". The required backup schedule is created.
- Where does the backup data get stored? Is it encrypted?
- What is the best option for database backup schedule?
- Can I replicate the data to another server and have the permissions stay intact?
All sensitive data in the backup file are stored in encrypted form in a .zip file under <PMP_Home/backUp> directory or under the directory specified by you. It is recommended that you backup this file in your secure, secondary storage for disaster recovery.
Database backup operation is both time and resource consuming. Hence, it is recommended to schedule it to run during off-peak traffic timings. While the operation is in progress, no configuration change could be performed in Password Manager Pro.
Yes. Password Manager Pro application is stateless and all the data are stored in the database and just replicating the database against a fresh installation of the application gets you all the data intact.
To schedule backup on a specific day every week,
- If your requirement is to backup the database contents on a specific day every week - say, on Mondays, this option would come in handy. You can choose any day from Sunday to Saturday and also specify the time at which backup has to be taken. To enable this option,
- Click the radio button "Weekly".
- Select the day of the week.
- Select the time at which backup has to be taken.
- Backed up data are stored as a .zip file under <PMP_Home>/backUp directory by default. If you want, you can specify the destination directory where you wish to store the backed up contents.
- Every time backup is executed, one backup file will be created. You can specify the maximum number of such backup files to be kept in this directory. For example, if you choose "10" in the drop-down against the field "Maintain latest --- backups only", only the latest 10 backup files would be kept under this directory.
- Click "Save". The required backup schedule is created.
To schedule backup on a specific day every month,
- If your requirement is to backup the database contents on a specific date every month - say, on 13th, this option would come in handy. You can choose any date from 1st to 31st and also specify the time at which backup has to be taken. To enable this option,
- Click the radio button "Monthly".
- Select the date of the month.
- Select the time at which backup has to be taken.
- Backed up data are stored as a .zip file under <PMP_Home>/backUp directory by default. If you want, you can specify the destination directory where you wish to store the backed up contents.
- Every time backup is executed, one backup file will be created. You can specify the maximum number of such backup files to be kept in this directory. For example, if you choose "10" in the drop-down against the field "Maintain latest --- backups only", only the latest 10 backup files would be kept under this directory.
- Click "Save". The required backup schedule is created.