Connection pool

Connection Pool creation

The connection pool to create must be specified in the openproxy.toml file.

simple_db connection pool creation

Before creating a connection pool, create a PostgreSQL database to use. some_db database is created in this example.

Connection Pool to create : simple_db

  • Create a section [pools.simple_db] in openproxy.toml.

    [pools.simple_db]
    pool_mode = "session"
    query_parser_enabled = true
    query_parser_read_write_splitting = true
    primary_reads_enabled = true
    sharding_function = "pg_bigint_hash"

Set Connection Pool user information

  • Create a section [pools.simple_db.users.0] in openproxy.toml.

List the cluster address and database to connect to

  • Create a section in openproxy.toml called [pools.simple_db.shard.0].

Full example of a simple_db connection pool creation configuration file


OpenProxy Execution

Execute the OpenProxy with the openproxy.toml file that sets up the connection pool to create.


Connection Pool Verification

Check the Connection Pool created by psql -h 127.0.0.1 -p 6432 -d openproxy -U postgres command.

Last updated