In this example, define the g_usa and g_italy database server groups as Enterprise Replication servers and create a replicate, repl1.
cdr define server --init g_usa
Before replicating data, you must define the database servers as replication servers. A replication server is a database server that has an extra database that holds replication information.
The --init option specifies that this server is a new replication server. When you define a replication server, you must use the name of the database server group (g_usa) rather than the database server name.
cdr list server
The command returns the following information:
SERVER ID STATE STATUS QUEUE CONNECTION CHANGED ---------------------------------------------------------- g_usa 1 Active Local 0
cdr define server --connect=italy --init \ --sync=g_usa g_italy
The --connect option allows you to define italy (on the s2 computer) while working at the s1 (usa) computer. The --sync option instructs the command to use the already-defined replication server (g_usa) as a pattern for the new definition. The --sync option also links the two replication servers into a replication environment.
cdr list server
The command returns the following information:
SERVER | ID | STATE | STATUS | QUEUE | CONNECTION CHANGED |
---------------------------------------------------------------------- | |||||
g_italy | 8 | Active | Connected | 0 | JUN 14 14:38:44 2000 |
g_usa | 1 | Active | Local | 0 |
cdr define replicate --conflict=ignore repl1 \ "P stores@g_usa:informix.manufact" \ "select * from manufact" \ "R stores@g_italy:informix.manufact" \ "select * from manufact"
These lines are all one command. The backslashes (\) at the end of the lines indicate that the command continues on the next line.
This step specifies that conflicts should be ignored and describes two participants, usa and italy, in the replicate:
cdr list replicate
The command returns the following information:
CURRENTLY DEFINED REPLICATES
------------------------------------------------ REPLICATE: repl1 STATE: Inactive CONFLICT: Ignore FREQUENCY: immediate QUEUE SIZE: 0 PARTICIPANT: g_usa:informix.manufact g_italy:informix.manufact
Step 5 defines a replicate but does not make the replicate active. The output of step 6 shows that the STATE of the replicate is INACTIVE.
repl1
cdr list replicate
The command returns the following information:
CURRENTLY DEFINED REPLICATES ------------------------------------------------ REPLICATE: repl1 STATE: Active CONFLICT: Ignore FREQUENCY: immediate QUEUE SIZE: 0 PARTICIPANT: g_usa:informix.manufact g_italy:informix.manufact
If any changes are made to the manufact table, the changes will be replicated to the other participants in the replicate.