Setup XDR to replicate from DC1 to DC2
Plan is to do it in two phases.
Phase 1 :
In this phase both XDR stanza and namespace stanzas will be modified in aerospike.conf
We will first add the XDR stanza as follows:
## XDR Stanza Configurations
xdr {
enable-xdr true # static setting required to be true to start XDR
namedpipe-path /tmp/xdr_pipe
digestlog-path /etc/aerospike/digestlog 30000000000 #30GB # circular buffer to hold records digest
errorlog-path /var/log/asdxdr.log
xdr-pidfile /var/run/aerospike/asxdr.pid
local-node-port 3000
info-port 3004
datacenter DC2 {
dc-node-address-port Aerospike_Node1 3000
dc-node-address-port Aerospike_Node2 3000
dc-node-address-port Aerospike_Node3 3000
}
}
NAMESPACE configuration
Then Add the following two settings to each namespace: enable-xdr false xdr-remote-datacenter DC2
namespace Namespace1 {
enable-xdr false
xdr-remote-datacenter DC2
replication-factor 2
memory-size 2G
default-ttl 4d
storage-engine device {
file /opt/aerospike/data/file.dat
filesize 4G
data-in-memory true
}
}
namespace Namespace2 {
enable-xdr false
xdr-remote-datacenter DC2
replication-factor 2
memory-size 2G
default-ttl 4d
storage-engine device {
file /opt/aerospike/data/file2.dat
filesize 4G
data-in-memory true
}
}
and do a rolling restart of asd on each nodes to load XDR stanza
This is required to load new XDR static configs into asd.
Phase 2: Enable XDR and Start XDR process from command line :
Enable XDR for replicating namespaces.
asmonitor -e "asinfo -v 'set-config:context=namespace;id=Namespace1;enable-xdr=true'"
asmonitor -e "asinfo -v 'set-config:context=namespace;id=Namespace2;enable-xdr=true'"
Verify XDR is enabled by running asmonitor to get config
asmonitor -e "asinfo -v 'get-config:'"|tr ";" "\n"|egrep ':3000|xdr'
asmonitor -e "asinfo -v 'namespace/Namespace1'"|tr ";" "\n"|egrep ':3000|xdr'
asmonitor -e "asinfo -v 'namespace/Namespace2'"|tr ";" "\n"|egrep ':3000|xdr'
Start XDR on each nodes of DC1
sudo service aerospike_xdr start
Verify XDR status through AMC or via command line
asmonitor -e 'info XDR'
Make changes persistent in aerospike.conf
enable-xdr to true for each of the namespaces being replicated in aerospike.conf for changes to persist after a restart