Apache Geode CHANGELOG

wan-copy region

Copy the entries of a region in a WAN site onto the same region in another WAN site, using a gateway sender.

This command copies region entries from a WAN site to another by putting them in batches of configurable size that are sent to the remote site by the selected gateway sender. Batch size is specified as number of entries per batch.

The command allows you to specify a maximum copy rate in order not to stress excessively the sending or receiving WAN sites. This rate is configured in entries per second.

Callbacks (cache listeners, replication to other WAN sites) will not be executed in the remote WAN site for the entries copied.

The main uses of this command are:

  • Recovery of a WAN site after a disaster in which the failed site needs to be put into service again with the data from another WAN site.

  • Adding a new WAN site to a Geode system in which the data in the new WAN site needs to be initially loaded from an existing WAN site.

The execution of a currently running instance of this command may be stopped by using this same command with the --cancel option.

Requirements:

The wan-copy region command requires that

  • a gateway sender is configured and running on the source WAN site
  • a gateway receiver is configured and running on the remote WAN site
  • the region onto which the data will be copied has already been created on the remote WAN site

Availability: Online. You must be connected in gfsh to a JMX Manager member to use this command.

Syntax:

wan-copy region --region=value --sender-id=value [--max-rate=value] [--batch-size=value]
  [--cancel]

Name Description Default Value
‑‑region Required. The region for which the data is to be copied.
‑‑sender-id Required. The gateway sender to be used to copy the region entries.
‑‑max-rate The maximum copy rate in entries per second. If the sender is parallel, the maximum rate limit is applied to each server hosting buckets for the region to be copied. 0 (unlimited)
‑‑batch-size The size of the batches, in number of entries, to be used to copy the region entries. 1000
‑‑cancel Cancel a running wan-copy region command for the specified sender and region. If the sender-id and region passed are both “*”, then all running wan-copy region commands will be canceled.

Table 1. Copy Region Parameters

Example Commands:

wan-copy region --region=myRegion--sender-id=mySender --max-rate=1000 --batch-size=100
wan-copy region --region=/overload --sender-id=sender1 --cancel
wan-copy region --region=* --sender-id=* --cancel

Sample Output:

gfsh>wan-copy region --region=/overload --sender-id=myParallelSender --max-rate=100 --batch-size=100
        Member     | Status | Message
    -------------- | ------ | -----------------------
    server-sender  | OK     | Entries copied: 333
    server-sender3 | OK     | Entries copied: 334
    server-sender2 | OK     | Entries copied: 333

gfsh>wan-copy region --region=/overload --sender-id=mySerialSender --max-rate=100 --batch-size=100
        Member     | Status | Message
    -------------- | ------ | ----------------------------------------------------------------------
    server-sender2 | OK     | Sender mySerialSender is serial and not primary. 0 entries copied.
    server-sender3 | OK     | Sender mySerialSender is serial and not primary. 0 entries copied.
    server-sender  | OK     | Entries copied: 1000
gfsh>wan-copy region --region=/overload --sender-id=sender1 --cancel
        Member     | Status | Message
    -------------- | ------ | ------------------
    server-sender2 | OK     | Execution canceled
    server-sender  | OK     | Execution canceled
    server-sender3 | OK     | Execution canceled
gfsh>wan-copy region --region=myRegion --sender-id=myParallelSender --max-rate=100 --batch-size=10
        Member     | Status | Message
    -------------- | ------ | ------------------------------------------------------
    server-sender2 | OK     | Operation canceled after having copied 10 entries
    server-sender  | OK     | Operation canceled after having copied 10 entries
    server-sender3 | OK     | Operation canceled after having copied 10 entries
gfsh>wan-copy region --region=myRegion --sender-id=myParallelSender --max-rate=100 --batch-size=10
        Member     | Status | Message
    -------------- | ------ | ----------------------------------------------------------------------
    server-sender2 | OK     | Sender mySerialSender is serial and not primary. 0 entries copied.
    server-sender3 | OK     | Sender mySerialSender is serial and not primary. 0 entries copied.
    server-sender  | OK     | Operation canceled after having copied 4 entries

Error Messages:

Example of wan-copy region with an invalid region:

gfsh> wan-copy region --region=/regionX --sender-id=sender1
        Member     | Status | Message
    -------------- | ------ | -------------------------
    server-sender  | ERROR  | Region /regionX not found
    server-sender2 | ERROR  | Region /regionX not found
    server-sender3 | ERROR  | Region /regionX not found

Example of wan-copy region with a stopped gateway sender:

gfsh> wan-copy region --region=/region1 --sender-id=sender1
        Member     | Status | Message
    -------------- | ------ | -----------------------------
    server-sender  | ERROR  | Sender sender1 is not running
    server-sender2 | ERROR  | Sender sender1 is not running
    server-sender3 | ERROR  | Sender sender1 is not running

Example of cancel of wan-copy region when no command is running:

gfsh> wan-copy region --region=/region1 --sender-id=sender1 --cancel
        Member     | Status | Message
    -------------- | ------ | ------------------------------------------------------------------------------------
    server-sender2 | ERROR  | No running command to be canceled for region /region1 and sender sender1
    server-sender  | ERROR  | No running command to be canceled for region /region1 and sender sender1
    server-sender3 | ERROR  | No running command to be canceled for region /region1 and sender sender1

Example of cancel of all running wan-copy region commands:

gfsh> wan-copy region --region=* --sender-id=* --cancel
        Member     | Status | Message
    -------------- | ------ | ------------------------------------------------------------------------------------
    server-sender2 | OK     | Executions canceled: [(myRegion,mySender1), (myRegion,mySender)]
    server-sender  | OK     | Executions canceled: [(myRegion,mySender1), (myRegion,mySender)]
    server-sender3 | OK     | Executions canceled: [(myRegion,mySender1), (myRegion,mySender)]