In peer-to-peer replication with three or more servers,
changes that are made to each copy of a table are replicated to all
other copies of that table. All rows and columns are replicated, and
the column names in each copy of the table must match.
Before you begin
Before
you create Q subscriptions for peer-to-peer replication, you must
perform the following actions:
- On each server that will participate in peer-to-peer replication,
create the control tables for the Q Capture and Q Apply programs.
The control tables for the Q Capture and Q Apply programs that are
on each individual server must have the same schema.
- Create the replication queue maps that will transport data between
each pair of servers. You need one replication queue map for each
source-to-target pair. If you have one table that you want to replicate
between three servers, you need six replication queue maps. If you
have one table that you want to replicate between four servers, you
need twelve replication queue maps. (You can do this task before you
create Q subscriptions or while you create Q subscriptions.)
Restrictions
- Views and stored procedures cannot participate in peer-to-peer
replication.
- If the source table includes a LONG VARCHAR column
type, that table cannot participate in a peer-to-peer replication.
For peer-to-peer replication, the Replication Center or ASNCLP must
add two columns to the source table. DB2® for z/OS® does
not allow the replication administration tools to add columns to a
table that includes a LONG VARCHAR column.
- For peer-to-peer and bidirectional configurations, do not use
the IMPORT utility. The IMPORT utility logs the inserts and, therefore,
the inserts will be recaptured.
- In peer-to-peer and bidirectional replication, you must use the
same constraints on both the source and target.
- Identity columns in target tables that are part of the Q subscription
must be defined as GENERATED BY DEFAULT.
- Peer-to-peer replication is not supported
on systems that use IBM® HourGlass
to alter the date and time that is returned when a time request is
made. This software alters the version columns that are required for
peer-to-peer.
About this task
One
Q subscription is created for each source-to-target pair. If you have
one table that you want to replicate to and from three servers, six
Q subscriptions are created. If you have one table that you want to
replicate to and from four servers, twelve Q subscriptions are created.
The formula for determining the number of Q subscriptions that are
created is n*(n-1), where n is the number of servers.
When you create Q subscriptions for peer-to-peer replication by using
the ASNCLP command-line program or Replication Center, the administration
tool creates all necessary Q subscriptions at one time.
Procedure
To create Q subscriptions for peer-to-peer replication
with three or more servers, use one of the following methods:
Method |
Description |
ASNCLP command-line program |
Use the CREATE QSUB command for peer-to-peer replication.
For example, the following commands set the environment and create
six peer-to-peer Q subscriptions for the EMPLOYEE table at servers
SAMPLE, SAMPLE2, and SAMPLE3:SET SUBGROUP "p2p3group";
SET PEER NODE 1 SERVER DBALIAS SAMPLE
SCHEMA GRAY;
SET PEER NODE 2 SERVER DBALIAS SAMPLE2
SCHEMA BROWN;
SET PEER NODE 3 SERVER DBALIAS SAMPLE3
SCHEMA YELLOW;
SET CONNECTION SOURCE SAMPLE.GRAY
TARGET SAMPLE2.BROWN REPLQMAP
"SAMPLE_GRAY_TO_SAMPLE2_BROWN";
SET CONNECTION SOURCE SAMPLE.GRAY
TARGET SAMPLE3.YELLOW REPLQMAP
"SAMPLE_GRAY_TO_SAMPLE3_YELLOW";
SET CONNECTION SOURCE SAMPLE2.BROWN
TARGET SAMPLE.GRAY REPLQMAP
"SAMPLE2_BROWN_TO_SAMPLE_GRAY";
SET CONNECTION SOURCE SAMPLE2.BROWN
TARGET SAMPLE3.YELLOW REPLQMAP
"SAMPLE2_BROWN_TO_SAMPLE3_YELLOW";
SET CONNECTION SOURCE SAMPLE3.YELLOW
TARGET SAMPLE.GRAY REPLQMAP
"SAMPLE3_YELLOW_TO_SAMPLE_GRAY";
SET CONNECTION SOURCE SAMPLE3.YELLOW
TARGET SAMPLE2.BROWN REPLQMAP
"SAMPLE3_YELLOW_TO_SAMPLE2_BROWN";
SET TABLES (SAMPLE.GRAY.GRAY.STAFF);
CREATE QSUB SUBTYPE P;
The SET CONNECTION commands specify the six replication
queue maps that are used. The SET TABLES command specifies the EMPLOYEE
table at the SAMPLE server. Matching copies of the table will be created
at the SAMPLE2 and SAMPLE3 servers.
|
Replication Center |
Use the Create Q Subscriptions wizard. To open the wizard,
expand the appropriate Q Capture or Q Apply schema, right-click the Q
Subscriptions folder, and select Create.- Servers page
- Each time that you specify a server to participate in peer-to-peer
replication, you must specify the replication queue map from that
new server to each of the other servers that you already selected.
You must also specify the replication queue map from each existing
server back to the new server.
- Target Tables page
- Review the target object profile for each server other than the
server that contains the existing (base) tables. Modify the profile
if necessary so that the target tables for the Q subscriptions meet
your needs.
The target object profile determines if an existing
target table is used or if a new one is created. The Replication Center
looks for an object that matches the naming scheme that is defined
in the profile. If a matching object does not exist, then the object
is created.
- Loading Target Table page
- When you create Q subscriptions for peer-to-peer replication with
three or more servers, the Q subscriptions are always created in an
inactive state, and you must activate them.
|