Skip to content

Find Primary #918

Answered by DimCitus
simontuohy asked this question in Q&A
Aug 8, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

See #875 and also the blog post at https://www.citusdata.com/blog/2021/02/12/reconnecting-your-app-after-a-postgres-failover/ which addresses the same question. The idea is to use multi-hosts connection strings, and use the target-session-attrs=read-write to ensure that if connected first to a standby, then the connection is dropped and attempted again with the next host on the list, until a primary is reached.

If the following connection string snippet makes sense when using Django (I just don't know), then I think it would make sense to allow for a specific switch such as pg_autoctl show uri --django that would output just that:

DATABASES = {
    'default': {
        'ENGINE': _db_engine,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@simontuohy
Comment options

Answer selected by DimCitus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants