Our great sponsors
-
pgcat
Discontinued PostgreSQL pooler with sharding, load balancing and failover support. [Moved to: https://github.com/postgresml/pgcat] (by levkk)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
yugabyte-db
YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
-
PostgreSQL
Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see https://wiki.postgresql.org/wiki/Submitting_a_Patch
I created a pool called "yugabyte" (pools.yugabyte), with pool mode 'session', so that a session remains connected to a backend. I created a pool of servers in pools.yugabyte.shards.0 (yugabyte shards pool 0), with all three of the YSQL nodes in the YugabyteDB cluster, and gave one the role of "primary" and the two others the role of "replica". For YugabyteDB YSQL this does not make sense. Currently, pgcat allows to have the roles to be all "replica", but not have more than one "primary".
Of course an external connection pool like this should only be used if you cannot use an application connection pool, and for the use of YugabyteDB, if you can use a YugabyteDB driver, such as our java jdbc driver, it's highly recommended to do so!
I created a pool called "yugabyte" (pools.yugabyte), with pool mode 'session', so that a session remains connected to a backend. I created a pool of servers in pools.yugabyte.shards.0 (yugabyte shards pool 0), with all three of the YSQL nodes in the YugabyteDB cluster, and gave one the role of "primary" and the two others the role of "replica". For YugabyteDB YSQL this does not make sense. Currently, pgcat allows to have the roles to be all "replica", but not have more than one "primary".
Please mind that the default setting binds to port 5432 on all network interfaces, which can conflict with a local running PostgreSQL database. The port can be set using port = 6432 (example for using the default pgbouncer port). Also mind that YugabyteDB by default binds to port 5433.
pgcat is a connection pool like pgbouncer, and shares part of the logical way it's working, but it has a fundamental difference: it allows to use multiple databases for a single client connection. pgbouncer only ever connects a client to a single database. It should be mentioned that there is a way to perform load balancing by using the pgbouncer so_reuseport setting to allow multiple pgbouncers to run on the same port.
Now that the configuration is done, run pgcat using cargo: