Create Tables with Gateway Senders

To replicate table DML operations to a remote WAN site, you specify one or more named gateway senders when you create the table, or after you create a table (using the ALTER TABLE statement). The gateway senders that you specify then replicate the DML operations to the remote GemFire XD clusters for which they are configured.

Note: A table must have identical column definitions in each cluster in order for GemFire XD to replicate it between clusters. Use the same DDL command in each cluster to create the table. If you achieve identical column definitions using different DDL commands (for example, by using ALTER TABLE to change one table to match another), then you may need to use SYS.INCREMENT_TABLE_VERSION to ensure that both tables have the same version in each cluster.

Procedure

  1. Use the GATEWAYSENDER clause with the CREATE TABLE statement to specify one or more gateway senders. For example, to create a WAN-replicated table in cluster 1 shown in Figure 2:
    CREATE TABLE test_table (ID INT NOT NULL, NAME VARCHAR(10))
         GATEWAYSENDER(cluster-2-sender, cluster-3-sender) SERVER GROUPS (sender_group)
    Note: You can configure both partitioned tables and replicated tables to use a gateway sender. However, you must use the SERVER GROUPS clause in CREATE TABLE to a host a replicated table's data in the same server group(s) that host the gateway sender(s).
    Create and Start Gateway Sender provides more information about configuring gateway senders.
  2. Alternatively, use the GemFire XD ALTER TABLE statement after you have created a table to add or remove gateway sender configurations. For example, if you did not supply a GATEWAYSENDER clause in the CREATE TABLE statement, you could add it later:
    ALTER TABLE test_table SET GATEWAYSENDER (cluster-2-sender, cluster-3-sender);
  3. Repeat these steps to create the same table definitions in each GemFire XD cluster that will replicate DML operations for those tables. The WAN replication process does not automatically create a table in the target GemFire XD cluster.