We have datacenter in 3 zone and 3 different url. Connect to database postgres is psql "hostname=url1,url2,url3 \port=......" Yandex understand what is master now and if master with url1 broken, Yandex start using url2 or url3. url2, url3- slave. But in backend we can't pass 3 url. We connect to database with "hostname=url1 \port=......" We have only 1 url and can't using slave. Can we pass 3 url to backend(asp.net core). If database in datacenter1 work correctly - using url1, if datacenter1 broken- using url2 in datacenter2
Asked
Active
Viewed 94 times
0
-
At some momrnt we need switch database1 to database2 with another url – tourist2000 Apr 08 '22 at 07:05
1 Answers
0
There are two particular FQDN types in Yandex Cloud managed databases that can help you here: one always points to the master, second always points to the least lagging replica.
How does it work? When the master is switching in your managed Postgres cluster, a script goes to the DNS and amends the master pointing FQDN, resolving it into the correct IP. The exact process handles the consistency of the replica pointed FQDN.
You don’t have to pass three hosts. Use the master FQDN instead.
https://cloud.yandex.com/en/docs/managed-postgresql/operations/connect#special-fqdns