mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-28 03:06:29 +00:00
@@ -36,7 +36,7 @@ For quick local example, use the Docker Compose environment provided:
|
|||||||
docker-compose up
|
docker-compose up
|
||||||
|
|
||||||
# In a new terminal:
|
# In a new terminal:
|
||||||
psql -h 127.0.0.1 -p 6432 -c 'SELECT 1'
|
PGPASSWORD=postgres psql -h 127.0.0.1 -p 6432 -U postgres -c 'SELECT 1'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Config
|
### Config
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ admin_password = "postgres"
|
|||||||
# configs are structured as pool.<pool_name>
|
# configs are structured as pool.<pool_name>
|
||||||
# the pool_name is what clients use as database name when connecting
|
# the pool_name is what clients use as database name when connecting
|
||||||
# For the example below a client can connect using "postgres://sharding_user:sharding_user@pgcat_host:pgcat_port/sharded"
|
# For the example below a client can connect using "postgres://sharding_user:sharding_user@pgcat_host:pgcat_port/sharded"
|
||||||
[pools.sharded]
|
[pools.postgres]
|
||||||
# Pool mode (see PgBouncer docs for more).
|
# Pool mode (see PgBouncer docs for more).
|
||||||
# session: one server connection per connected client
|
# session: one server connection per connected client
|
||||||
# transaction: one server connection per client transaction
|
# transaction: one server connection per client transaction
|
||||||
@@ -84,7 +84,7 @@ primary_reads_enabled = true
|
|||||||
sharding_function = "pg_bigint_hash"
|
sharding_function = "pg_bigint_hash"
|
||||||
|
|
||||||
# Credentials for users that may connect to this cluster
|
# Credentials for users that may connect to this cluster
|
||||||
[pools.sharded.users.0]
|
[pools.postgres.users.0]
|
||||||
username = "postgres"
|
username = "postgres"
|
||||||
password = "postgres"
|
password = "postgres"
|
||||||
# Maximum number of server connections that can be established for this user
|
# Maximum number of server connections that can be established for this user
|
||||||
@@ -95,14 +95,8 @@ pool_size = 9
|
|||||||
# Maximum query duration. Dangerous, but protects against DBs that died in a non-obvious way.
|
# Maximum query duration. Dangerous, but protects against DBs that died in a non-obvious way.
|
||||||
statement_timeout = 0
|
statement_timeout = 0
|
||||||
|
|
||||||
[pools.sharded.users.1]
|
|
||||||
username = "postgres"
|
|
||||||
password = "postgres"
|
|
||||||
pool_size = 21
|
|
||||||
statement_timeout = 15000
|
|
||||||
|
|
||||||
# Shard 0
|
# Shard 0
|
||||||
[pools.sharded.shards.0]
|
[pools.postgres.shards.0]
|
||||||
# [ host, port, role ]
|
# [ host, port, role ]
|
||||||
servers = [
|
servers = [
|
||||||
[ "postgres", 5432, "primary" ],
|
[ "postgres", 5432, "primary" ],
|
||||||
@@ -111,37 +105,16 @@ servers = [
|
|||||||
# Database name (e.g. "postgres")
|
# Database name (e.g. "postgres")
|
||||||
database = "postgres"
|
database = "postgres"
|
||||||
|
|
||||||
[pools.sharded.shards.1]
|
[pools.postgres.shards.1]
|
||||||
servers = [
|
servers = [
|
||||||
[ "postgres", 5432, "primary" ],
|
[ "postgres", 5432, "primary" ],
|
||||||
[ "postgres", 5432, "replica" ],
|
[ "postgres", 5432, "replica" ],
|
||||||
]
|
]
|
||||||
database = "postgres"
|
database = "postgres"
|
||||||
|
|
||||||
[pools.sharded.shards.2]
|
[pools.postgres.shards.2]
|
||||||
servers = [
|
servers = [
|
||||||
[ "postgres", 5432, "primary" ],
|
[ "postgres", 5432, "primary" ],
|
||||||
[ "postgres", 5432, "replica" ],
|
[ "postgres", 5432, "replica" ],
|
||||||
]
|
]
|
||||||
database = "postgres"
|
database = "postgres"
|
||||||
|
|
||||||
|
|
||||||
[pools.simple_db]
|
|
||||||
pool_mode = "session"
|
|
||||||
default_role = "primary"
|
|
||||||
query_parser_enabled = true
|
|
||||||
primary_reads_enabled = true
|
|
||||||
sharding_function = "pg_bigint_hash"
|
|
||||||
|
|
||||||
[pools.simple_db.users.0]
|
|
||||||
username = "postgres"
|
|
||||||
password = "postgres"
|
|
||||||
pool_size = 5
|
|
||||||
statement_timeout = 0
|
|
||||||
|
|
||||||
[pools.simple_db.shards.0]
|
|
||||||
servers = [
|
|
||||||
[ "postgres", 5432, "primary" ],
|
|
||||||
[ "postgres", 5432, "replica" ]
|
|
||||||
]
|
|
||||||
database = "postgres"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user