Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access from outside the compose application? #4

Open
coyhile opened this issue Jun 27, 2022 · 4 comments
Open

Access from outside the compose application? #4

coyhile opened this issue Jun 27, 2022 · 4 comments

Comments

@coyhile
Copy link

coyhile commented Jun 27, 2022

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.

@teutat3s
Copy link

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

@coyhile
Copy link
Author

coyhile commented Jun 28, 2022

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

@misterbisson
Copy link
Contributor

misterbisson commented Jun 28, 2022

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.

@coyhile
Copy link
Author

coyhile commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants