Skip to content

Dynamic XDR configuration

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

This page describes how to configure XDR dynamically using asadm or asinfo, and how to persist that configuration across node restarts.

XDR is Aerospike’s inter-cluster replication mechanism, a standard feature in Aerospike Database Enterprise Edition.

Terminology

  • Shipping refers to sending data from one datacenter to another.
  • A cluster from which records are shipped is a source cluster.
  • A cluster to which records are shipped is a destination cluster.

Version changes

You can ship between connected DCs as long as each is running Database 6.0.0 or later. Different versions of Aerospike Database, however, have the following variations with respect to XDR:

  • Starting with Database 8.1.1, recovery-threads configures the number of threads per datacenter (1-32) for use in parallel recovery. This improves recovery performance for large backlogs.
  • Starting with Database 7.2.0:
    • ship-versions-policy controls how XDR ships versions of modified records when facing lag between the source cluster and a destination.
    • ship-versions-interval specifies a time window in seconds within which XDR is allowed to skip versions.

Dynamic configuration

Configure XDR on a running cluster without restarting database nodes using asadm or asinfo.

  • asadm manage config applies changes across all nodes in the cluster. Aerospike recommends this for most XDR configuration tasks.
  • asinfo set-config applies changes only to the node you connect to. The same command-string format is used when configuring XDR programmatically through the SDK.

For additional command syntax, see XDR syntax in the runtime configuration guide.

Configure a new datacenter

  1. Create the datacenter and add destination nodes.

    Terminal window
    asadm -e "enable; manage config xdr create dc DC1"
    asadm -e "enable; manage config xdr dc DC1 add node 10.0.0.2:3000"

    When using TLS, append the destination cluster’s TLS name after the port using the format host:tls_port:tls_name:

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 add node 10.0.0.2:4333:destination_tls_name"

    To remove a TLS node, specify only the host and port (omit the TLS name):

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 remove node 10.0.0.2:4333"
  2. Add the namespace to the defined dc. This starts shipping new writes from this point forward. XDR does not ship existing records unless you add the namespace with rewind. See Rewind a shipment.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 add namespace NAMESPACE_NAME"
  3. To retain this configuration on restart, add it to your configuration file. See Persist dynamic XDR configuration.

Configure a new datacenter with TLS

When the destination cluster requires TLS and authentication, set the TLS and authentication parameters before adding node addresses and namespaces. For background on TLS name concepts and static configuration, see XDR security.

  1. Create the datacenter.

    Terminal window
    asadm -e "enable; manage config xdr create dc DC1"
  2. Set the local cluster’s TLS name for this datacenter.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 param tls-name to source_tls_name"
  3. Set the authentication mode.

    Use external for LDAP authentication over TLS, internal for Aerospike access control, or pki for PKI authentication. With pki, do not set auth-user or auth-password-file. See XDR security for authentication mode details and credential setup.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 param auth-mode to external"
  4. If using access control or LDAP, set the password file and user.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 param auth-password-file to /path/to/credentials.txt"
    asadm -e "enable; manage config xdr dc DC1 param auth-user to xdr_user"
  5. Add the destination node addresses. Use the format host:tls_port:tls_name to append the destination cluster’s TLS name after the port.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 add node 10.0.0.2:4333:destination_tls_name"

    To remove a node, specify only the host and port (omit the TLS name):

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 remove node 10.0.0.2:4333"
  6. Add the namespace to start shipping new writes from this point forward. To ship older records, see Rewind a shipment.

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 add namespace NAMESPACE_NAME"
  7. To retain this configuration on restart, add it to your configuration file. See Persist dynamic XDR configuration.

Persist dynamic XDR configuration

To retain dynamic XDR settings across node restarts, add the equivalent xdr section to your Aerospike configuration file after you finish dynamic configuration. See Rewind a shipment for how to control backfill when associating a namespace.

Rewind a shipment

Use rewind when you associate a namespace with a datacenter to ship records last updated within a specified time window. A rewind ships every matching record in that window, whether or not XDR previously shipped it to the destination. You can use rewind when first associating a namespace or when re-associating a namespace that is already configured for the datacenter.

Use these rules when planning a rewind:

  • For a new namespace association, add the namespace with rewind in the same command.
  • For an existing namespace association, remove the namespace from the datacenter, then add it back with rewind. Removing the namespace discards the existing XDR queue, so records can be missed if the rewind period is shorter than the current XDR lag.
  • To ship records updated within a specific time window, set rewind to the number of seconds before the current time.
  • To rewind only specific sets, configure ship-only-specified-sets and ship-set after removing the namespace and before adding it back. See Ship specific sets to a new namespace for the full sequence.
  • For large namespaces, using asbackup and asrestore, or a touch UDF that triggers normal XDR shipping, may be more efficient than a set-specific rewind. See How to rewind XDR for a namespace for details.
  • When a namespace is added with or without rewind, XDR sets a fresh Last Ship Time (LST) for that namespace and DC pair. The LST is communicated across nodes and persisted to SMD. XDR does not ship records older than the LST.

Rewind and restart examples

  1. In the following example, the rewind 600 clause rewinds shipment to 10 minutes before the current time for datacenter DC1 and namespace namespace1:

    Terminal window
    asadm -e "enable; manage config xdr dc DC1 remove namespace namespace1"
    asadm -e "enable; manage config xdr dc DC1 add namespace namespace1 rewind 600"
    • For small datasets, you can restart the shipment entirely from the beginning with rewind all.

    • For large datasets, starting a complete rewind can increase server loads.

  2. The following example completely restarts shipment for datacenter DC2 and namespace namespace2:

    Terminal window
    asadm -e "enable; manage config xdr dc DC2 remove namespace namespace2"
    asadm -e "enable; manage config xdr dc DC2 add namespace namespace2 rewind all"

Ship specific sets to a new namespace

In some cases, when associating a namespace to a datacenter, you can restrict shipping to only specific sets.

  1. Disassociate the namespace from the datacenter.

    Terminal window
    asadm -e "enable; manage config xdr dc DC_NAME remove namespace NAMESPACE_NAME"
  2. Dynamically configure ship-only-specified-sets for that namespace. These parameters must be set while the namespace is disassociated; they cannot be changed after the action=add step.

    Terminal window
    asadm -e "enable; manage config xdr dc DC_NAME namespace NAMESPACE_NAME param ship-only-specified-sets to true"
  3. Specify which sets to ship.

    Terminal window
    asadm -e "enable; manage config xdr dc DC_NAME namespace NAMESPACE_NAME param ship-set to SETNAME"
  4. Rewind when associating the namespace to the datacenter.

    Terminal window
    asadm -e "enable; manage config xdr dc DC_NAME add namespace NAMESPACE_NAME rewind all"

Recovery modes

When you rewind a namespace, XDR scans the index and ships matching records for that namespace, partition by partition. This is XDR recovery mode. For when recovery mode activates and how it fits the shipment lifecycle, see XDR recovery mode. XDR supports the following recovery modes.

Single-threaded interleaved recovery

Single-threaded interleaved recovery is the default when recovery-threads is 1.

In this mode, one recovery thread processes multiple partitions in an interleaved fashion. The mode is active when max-recoveries-interleaved is greater than or equal to 0.

Use max-recoveries-interleaved to control how many partitions recover concurrently. Set it greater than 0 to limit concurrent recovery.

Recovery jobs are inserted at position mri-1 in the recovery queue rather than at the end. That ordering spreads recovery work across partitions so large partitions do not monopolize recovery time.

If high incoming throughput pushes partitions back into recovery after they finish a round, raise max-recoveries-interleaved to reduce how many partitions recover at once.

Parallel partition-dedicated recovery

Parallel partition-dedicated recovery is active when recovery-threads is greater than 1 and max-recoveries-interleaved is 0 (Database 8.1.1 and later).

When the entire partition is finished, the thread picks up the next partition from the queue. Multiple threads work simultaneously on different partitions, with each thread fully dedicated to one partition at a time.

Dynamic configuration constraints

  • When switching from parallel to interleaved mode: To enable interleaving when max-recoveries-interleaved = 0, first set recovery-threads to 1, then change max-recoveries-interleaved to the desired value.
  • When switching from interleaved to parallel mode: To change recovery-threads when max-recoveries-interleaved >= 0, first set max-recoveries-interleaved to 0, then change recovery-threads to the desired value.