Real-Time Backup Deployment
The following topics discuss deployment methods for Real-Time Backup replication, as well as disaster recovery steps in the event you need to restore a replicated database:
Real-Time Backup Configurations
The Real-Time Backup configuration replicates data in real-time from a Zen database to a standby backup server also running Zen and DataExchange. Upon a system failure, clients can be directed to the standby server. The following figure illustrates this 1-way replication backup, where the First Site named ServerA is networked with a Partner Site named ServerB as the backup server. ServerA runs its database dbA. DataExchange maintains a copy of the dbA database on the backup server, which replicates changes on ServerA on a set schedule.
Before You Get Started
To follow this working example, you will install DataExchange on a First Site and a Partner Site that already have a Zen database engine installed.
The example assumes the following:
• You have a First Site and a Partner Site named ServerA and ServerB.
• A copy of the Demodata sample database that comes with the Zen installation is used for this example. Consider using the ZenCC schema export and import feature to create the Demodata copy in a different location on the First Site, such as C:\Data.
Deploying Using DXdeploy
To deploy a database in a Real-Time Backup configuration
1. Confirm that the database to be replicated is not being accessed by your application.
For example, if Demodata is used by Myapp.exe, ensure that Myapp is not accessing Demodata while you deploy Demodata for replication.
2. On First Site, open the XML descriptor file EXPRESS.XML in a text editor. On a 64-bit system this file is found in C:\Program Files (x86)\Actian\Zen\Replication\Docs.
3. Edit the XML descriptor file, specifying the appropriate information for ServerA and the ServerB backup.
Note that you will edit and use a different descriptor file for each site. Some information in the descriptor file must be unique each time that you use the file. The following table explains this.
4. Save EXPRESS.XML as ServerA.xml to a chosen location. This example assumes C:\.
5. Copy the Demodata directory from ServerA to the backup directory on ServerB.
The backup location must be unique and must match the location for First Site DataDirectory in the XML descriptor file. This task assumes that the backup location is C:\Demodata_Backup_ServerA.
6. On ServerA, open a command prompt and enter the following:
dxdeploy /Site=First C:\ServerA.xml
7. Press Enter.
DXdeploy provides high-level status messages and is done when the command prompt reappears.
8. After DXdeploy finishes, enter the following:
dxdeact <First Site DSN>
<First Site DSN> is the DSN you specified in ServerA.xml for the First Site.
9. Press Enter.
10. Copy the contents of the DataExchange directory from C:\Demodata_Backup_ServerA on the First Site to the Demodata directory on ServerB.
11. Copy ServerA.xml from the First Site to ServerB.
12. At a command prompt on the First Site, enter the following:
dxact /FIRSTSITE <First Site DSN>
<First Site DSN> is the DSN you specified in ServerA.xml for the First Site.
13. Press Enter.
14. On ServerA, open a command prompt and enter the following:
dxdeploy /Site=Partner C:\ServerA.xml
15. Press Enter.
DXdeploy provides high-level status messages on the screen as it completes its actions. DXdeploy is complete when the command prompt reappears.
16. On ServerA, set up a replication schedule.
17. Bring your application back online.
Disaster Recovery
This topic explains how to recover from the failure of one replication site. The information assumes that the disaster occurs to your primary site, requiring that you temporarily switch production to your backup site. After a primary site is again provided, you then need to reestablish the primary site/backup site replication network.
A disaster could, of course, occur to the backup site. The information still applies; just substitute backup for primary. For ease of discussion, and to remain consistent with terminology commonly used to discuss disaster recovery, this topic refers to primary site and backup site. Think of them as the First Site and Partner Site, respectively.
The information here applies only to a real-time backup situation or to a 1-way situation. See
Deployment Process for an explanation of real-time backup deployment. See
1-Way Deployment Using DXdeploy for a working example of 1-way deployment.
Failover
In the event of a disaster, you must switch your users to access the backup site. Use whatever methods are in place at your company to accomplish switching to a different server. Such methods are many and varied and beyond the scope of this document.
Since the backup site contains current data, your application should continue to function as before.
Once your users are accessing the backup site, reestablish your First Site. Two disaster scenarios exist pertaining to the data on the primary site:
• The primary site is catastrophically destroyed and no data can be recovered from it.
• The primary is brought back into service and its data is still available, but no longer current.
No Data Recoverable
Use the following steps to reestablish your primary site.
To set up a new primary site
1. Install the Zen database product on the new machine.
2. Install DataExchange on the new machine.
If the system was a First Site before, install a First Site. If it was a Partner Site, install the Partner Site.
3. Install any previously installed applications on the new system.
This creates a fresh copy of your application database on the new machine.
4. Create the same data source name (DSN) on the primary as used for the replication database on the backup.
5. Take your application offline on the backup site.
You must ensure that the database is not being accessed until you get the primary and backup sites synchronized.
6. Deactivate the replication database on the backup site.
7. From the backup machine, copy the following to the same locations on the primary machine:
• All user database tables.
• All data dictionary files (DDFs).
• All replication control tables, which have the name of each data table with the prefix PDC. Default location is C:\ProgramData\Actian\Zen\<database name>\DX_<project name>.
• All replication system tables shown in the following list. Their default location is C:\ProgramData\Actian\Zen]Replication\Data.
8. Activate the replication database on the primary site.
9. Activate the replication database on the backup site.
See
dxact. Note that the activation on the backup site performs an initial replication with the primary site. An initial replication is a full replication, in which all data is synchronized between the two machines.
The primary site and backup site now contain the same data.
10. Recreate any replication schedules from the primary site to the backup site.
11. Switch your users to access the primary site and bring your application back online.
Data Recoverable But Not Current
Use the following steps to reestablish your primary site.
To place an existing primary site back into replication
1. Bring the primary machine back online.
2. Take your application offline.
Be sure that the database is not accessed until you get the primary and backup sites synchronized.
3. Delete all replication schedules on the primary site.
4. Deactivate the replication database on both the primary and the backup sites.
5. Activate the replication database on the primary site.
6. Activate the replication database on the backup site.
See
dxact. Note that the activation on the backup site performs an initial replication with the primary site. This is a full replication, in which all data is synchronized between the two systems.
The primary site and backup site now contain the same data.
7. Recreate any replication schedules from the primary site to the backup site.
8. Bring your application back online.