Skip to content

Access from outside the compose application? #4

Open

Description

@coyhile

With no CNS names setup or anything else, how would one determine the address of the master in order to access the database? If I add a label: triton.cns.servivces=mydb, that's set on every instance, not just the writeable instance.

Activity

  1. teutat3s commented on Jun 28, 2022

    @teutat3s

    The general assumption is that the first container created will be the read/write primary. You could anticipate its auto-created CNS record with the $NAME.inst.$UUID.cns.domain record.
    For example:
    postgres-db-1.inst.fb75e85c-4e77-4e18-bb36-4b3e272baddd.basement.cns.coyhile.com

  2. coyhile commented on Jun 28, 2022

    @coyhile
    Author

    Ah, thank you! I never remember the foobar.inst. names get created. But, what about when a failure occurs?

  3. misterbisson commented on Jun 28, 2022

    @misterbisson
    Contributor

    We had discussed a feature to support adding/removing CNS names at runtime (as would be necessary to use CNS when an instance is promoted to primary to replace a failed primary), but I don't believe this was ever implemented IIRC.

    If you're looking for a one-off answer, I'd check your Consul cluster to see which pg instance has the lock as the primary.

    If you're looking to do this at scale, I'd strongly consider implementing Consul-based dynamic discovery/configuration to the client app. Second to that, a proxy could perform that task, running either in the client instance, the pg host instance, or something in between.

  4. coyhile commented on Oct 11, 2022

    @coyhile
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions