There a settable options on the Database handle for the Machine and Datacenter ID.
I have configured two set of fdb process with two datacenter_id
(DC01
and DC02
*), but left untouched the machine_id
in foundationdb.conf
.
Looking at the output of status json
for one of the nodes, I see in the locality
object:
So I can safely assume that for the datacenter id, I can pass the string “DC01” (or “DC02”). But the machine id looks like a hash from some string unique to the host.
How can a local application, running on the same host, know about that ID to set the corresponding option on the database handle?
Do I need to explicitly set the machine_id
in the foundationdb.conf
of each host to a known value (probably using the host name), so that the application can also set the same value?
What would happen if an application would set a datacenter or machine id option with a value that is not valid anymore ?
I’m looking for a way to have each client automatically prefer the local node (if there is one present) without having to check out of band to get the correct value.