Connection String for Connecting to Cluster #1962
-
Hello, How can I format connection string to connect to multiple instances of postgresql (yugabytedb) in a cluster? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If any node in your cluster can accept read and write queries (which I do not know off the top of my head if Yugabyte does, I know Cockroach does) then you should give your cluster a DNS name and have all the IPs in the cluster as records on that DNS name. Another option would be to put something like a load balancer in front of the cluster. This would also be beneficial as the load balancer could perform health checks so as nodes restart (if they ever do) your application would not need to do anything to handle it, as the load balancer would handle it gracefully. |
Beta Was this translation helpful? Give feedback.
If any node in your cluster can accept read and write queries (which I do not know off the top of my head if Yugabyte does, I know Cockroach does) then you should give your cluster a DNS name and have all the IPs in the cluster as records on that DNS name.
Then using the DNS name in your connection string will connect you in a "round-robin"-esque fashion to your clsuter.
Another option would be to put something like a load balancer in front of the cluster. This would also be beneficial as the load balancer could perform health checks so as nodes restart (if they ever do) your application would not need to do anything to handle it, as the load balancer would handle it gracefully.