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-threadsconfigures 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-policycontrols how XDR ships versions of modified records when facing lag between the source cluster and a destination.ship-versions-intervalspecifies 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.
asadmmanage configapplies changes across all nodes in the cluster. Aerospike recommends this for most XDR configuration tasks.asinfoset-configapplies 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
-
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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;action=create"asinfo -v "set-config:context=xdr;dc=DC1;node-address-port=10.0.0.2:3000;action=add"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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;node-address-port=10.0.0.2:4333:destination_tls_name;action=add"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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;node-address-port=10.0.0.2:4333;action=remove" -
Add the
namespaceto the defineddc. This starts shipping new writes from this point forward. XDR does not ship existing records unless you add the namespace withrewind. See Rewind a shipment.Terminal window asadm -e "enable; manage config xdr dc DC1 add namespace NAMESPACE_NAME"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;namespace=NAMESPACE_NAME;action=add" -
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.
-
Create the datacenter.
Terminal window asadm -e "enable; manage config xdr create dc DC1"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;action=create" -
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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;tls-name=source_tls_name" -
Set the authentication mode.
Use
externalfor LDAP authentication over TLS,internalfor Aerospike access control, orpkifor PKI authentication. Withpki, do not setauth-userorauth-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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;auth-mode=external" -
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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;auth-password-file=/path/to/credentials.txt"asinfo -v "set-config:context=xdr;dc=DC1;auth-user=xdr_user" -
Add the destination node addresses. Use the format
host:tls_port:tls_nameto 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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;node-address-port=10.0.0.2:4333:destination_tls_name;action=add"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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;node-address-port=10.0.0.2:4333;action=remove" -
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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;namespace=NAMESPACE_NAME;action=add" -
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
rewindin 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
rewindto the number of seconds before the current time. - To rewind only specific sets, configure
ship-only-specified-setsandship-setafter removing the namespace and before adding it back. See Ship specific sets to a new namespace for the full sequence. - For large namespaces, using
asbackupandasrestore, 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
-
In the following example, the
rewind 600clause rewinds shipment to 10 minutes before the current time for datacenterDC1and namespacenamespace1: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"Terminal window asinfo -v "set-config:context=xdr;dc=DC1;namespace=namespace1;action=remove"asinfo -v "set-config:context=xdr;dc=DC1;namespace=namespace1;action=add;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.
-
-
The following example completely restarts shipment for datacenter
DC2and namespacenamespace2: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"Terminal window asinfo -v "set-config:context=xdr;dc=DC2;namespace=namespace2;action=remove"asinfo -v "set-config:context=xdr;dc=DC2;namespace=namespace2;action=add;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.
-
Disassociate the namespace from the datacenter.
Terminal window asadm -e "enable; manage config xdr dc DC_NAME remove namespace NAMESPACE_NAME"Terminal window asinfo -v "set-config:context=xdr;dc=DC_NAME;namespace=NAMESPACE_NAME;action=remove" -
Dynamically configure
ship-only-specified-setsfor that namespace. These parameters must be set while the namespace is disassociated; they cannot be changed after theaction=addstep.Terminal window asadm -e "enable; manage config xdr dc DC_NAME namespace NAMESPACE_NAME param ship-only-specified-sets to true"Terminal window asinfo -v "set-config:context=xdr;dc=DC_NAME;namespace=NAMESPACE_NAME;ship-only-specified-sets=true" -
Specify which sets to ship.
Terminal window asadm -e "enable; manage config xdr dc DC_NAME namespace NAMESPACE_NAME param ship-set to SETNAME"Terminal window asinfo -v "set-config:context=xdr;dc=DC_NAME;namespace=NAMESPACE_NAME;ship-set=SETNAME" -
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"Terminal window asinfo -v "set-config:context=xdr;dc=DC_NAME;namespace=NAMESPACE_NAME;action=add;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 setrecovery-threadsto 1, then changemax-recoveries-interleavedto the desired value. - When switching from interleaved to parallel mode: To change
recovery-threadswhenmax-recoveries-interleaved>= 0, first setmax-recoveries-interleavedto 0, then changerecovery-threadsto the desired value.