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.
- 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.
- Alternatively, use the
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);
- 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.