r/distributed • u/sharedmocha • Mar 07 '19
How can we utilize distributed Databases in multiple regions ?
Hello All,
I am trying to learn Distributed computing and one topic always confuses me. Can anyone please share there thought on this ?
Lets say, We have Cloud DNS which distributed traffic to Asia and America servers which internal fetch data from databases and present to users. Now,can we have these databases also located in Asia and America so that serves can directly call them ?Can this be possible? If so how can we achieve this?
1
Upvotes
View all comments
Show parent comment
2
u/semi_competent Mar 08 '19 edited Mar 08 '19
In both you'd use service discovery, or DNS paired with application environment variables in each datacenter to discover the local DB servers. In Cassandra you also tell it to limit connections to the local DC by setting a policy in the driver.
For option3, you typically have an abstraction layer over two connections, one for the writes, one for the reads. Depending on which request gets made your application code would need to route the query to the correct DB connection.