Consul's has built-in support for operation in multiple data centers. These data centers can be named.
The data center name can be set in the consul.json with the addition of a "datacenter": "<name>" key, *or with the addition of a -datacenter command line argument.
The Triton data center name can be found using mdata-get:
/native/usr/sbin/mdata-get sdc:datacenter_name
The name can be injected in the config file at preStart using a mechanism similar to how the advertise IP is set:
if [ -f "/native/usr/sbin/mdata-get" ]; then
DATACENTER_NAME=$(/native/usr/sbin/mdata-get sdc:datacenter_name)
fi
sed -i "s/DATACENTER_NAME/${DATACENTER_NAME:-dc1}/" /etc/consul/consul.json
Consul's has built-in support for operation in multiple data centers. These data centers can be named.
The data center name can be set in the
consul.jsonwith the addition of a"datacenter": "<name>"key, *or with the addition of a-datacentercommand line argument.The Triton data center name can be found using
mdata-get:The name can be injected in the config file at
preStartusing a mechanism similar to how the advertise IP is set: