Chapter 6. Instantiating enterprise replication 75
6.3.2 Defining replicates using the cdr command
Once the replication servers are defined, the details of what data should be sent
to the servers can be specified. That is done in the form of replicates and
replicate sets.
replicate is the definition of some set of data on a server to be sent elsewhere.
The cdr define replicate command is used to do this.
Example 6-3 on page 76 shows the replicate definitions corresponding to the
requirements of the example. The cdr define replicate command can be quite
long, so we chose to use a text file to construct the command rather than typing
multiple lines each time.
The first replicate definition is very simple. It specifies the one-way propagation
of changes to the order table on branch2 (one of the leaf nodes) to the HQ server
(the root node). No conflict resolution is required, and all the other parameters
use the default values. Best practice is to use descriptive names for the
replicates so that a casual observer can understand what is defined.
This replicate does not specify anything about when or how often changed data
should be transferred. The default is to move the data immediately at the end of
each transaction. The alternatives are to move data at some regular interval
(every 15 minutes, for example) or at some specific time (at 8:00 pm local time
each evening, for example).
This replicate has two participants, denoted by the P and R (the last two lines of
the replicate definition). Each participant defines the database and table that is
the source (P or primary) or target (R or recipient) of the data. Data changed in
the primary of a replicate is propagated to the other participants. Data changed in
a recipient is not propagated. In this case, the replicate is one way because there
is a single source and a single target.
Alternatively, a replicate may be defined with two or more primary participants.
That is how an update-anywhere replicate is defined. In that case, some conflict
resolution rule is required because the same row may be updated by separate
transactions on different servers at the same time. As the data is propagated, the
DBMS must be told which changes override others.
The next several replicate definitions complete the set required to have the
orders, items, and customer data propagated as the requirements stipulate.
Because only a single table can be used in each definition, separate replicates
are required for each table whose data needs to be shared.
Note: The group names are used, not the instance names.

Get Informix Dynamic Server V10: Superior Data Replication for Availability and Distribution now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.