Skip to content

Fix docker-compose #193

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

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For quick local example, use the Docker Compose environment provided:
docker-compose up

# 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
Expand Down
37 changes: 5 additions & 32 deletions examples/docker/pgcat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ admin_password = "postgres"
# configs are structured as pool.<pool_name>
# 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"
[pools.sharded]
[pools.postgres]
# Pool mode (see PgBouncer docs for more).
# session: one server connection per connected client
# transaction: one server connection per client transaction
Expand Down Expand Up @@ -84,7 +84,7 @@ primary_reads_enabled = true
sharding_function = "pg_bigint_hash"

# Credentials for users that may connect to this cluster
[pools.sharded.users.0]
[pools.postgres.users.0]
username = "postgres"
password = "postgres"
# Maximum number of server connections that can be established for this user
Expand All @@ -95,14 +95,8 @@ pool_size = 9
# Maximum query duration. Dangerous, but protects against DBs that died in a non-obvious way.
statement_timeout = 0

[pools.sharded.users.1]
username = "postgres"
password = "postgres"
pool_size = 21
statement_timeout = 15000

# Shard 0
[pools.sharded.shards.0]
[pools.postgres.shards.0]
# [ host, port, role ]
servers = [
[ "postgres", 5432, "primary" ],
Expand All @@ -111,37 +105,16 @@ servers = [
# Database name (e.g. "postgres")
database = "postgres"

[pools.sharded.shards.1]
[pools.postgres.shards.1]
servers = [
[ "postgres", 5432, "primary" ],
[ "postgres", 5432, "replica" ],
]
database = "postgres"

[pools.sharded.shards.2]
[pools.postgres.shards.2]
servers = [
[ "postgres", 5432, "primary" ],
[ "postgres", 5432, "replica" ],
]
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"