Skip to content
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

"No pool configured for database" when trying to connect to pgcat instance #746

Closed
mismaah opened this issue May 20, 2024 · 2 comments
Closed

Comments

@mismaah
Copy link

mismaah commented May 20, 2024

This is my config.

[general]
port = 6432
admin_username = "admin_user"
admin_password = "admin_pass"

[pools.db]
pool_mode = "session"
default_role = "any"
query_parser_enabled = false
primary_reads_enabled = true
sharding_function = "pg_bigint_hash"

[pools.db.users.0]
# both pg instances have this user with same password
username = "superuser"
password = "pwd"
pool_size = 5

[pools.db.shards.0]
servers = [
    [ "192.168.155.73", 5432, "primary" ],
    [ "192.168.155.74", 5432, "replica" ]
]
database = "test"

I run this in docker and it runs fine without errors:

INFO ThreadId(07) pgcat::pool: Creating a new server connection Address { id: 0, host: "192.168.155.73", port: 5432, shard: 0, database: "test", role: Primary, replica_number: 0, address_index: 0, username: "superuser", pool_name: "db", mirrors: [], stats: AddressStats { total: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, current: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages_updated: false }, error_count: 0 }    
INFO ThreadId(06) pgcat::pool: Creating a new server connection Address { id: 1, host: "192.168.155.74", port: 5432, shard: 0, database: "test", role: Replica, replica_number: 0, address_index: 1, username: "superuser", pool_name: "db", mirrors: [], stats: AddressStats { total: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, current: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages: AddressStatFields { xact_count: 0, query_count: 0, bytes_received: 0, bytes_sent: 0, xact_time: 0, query_time: 0, wait_time: 0, errors: 0 }, averages_updated: false }, error_count: 0 }

However when I try to connect to it with psql -h 192.168.155.73 -p 6432 -U admin_user db
I get the following error even though the pool name matches.
Note that I am running this command on 192.168.155.73
In pgcat logs, I see this error

WARN ThreadId(04) pgcat: Client disconnected with error ClientGeneralError("Invalid pool name", ClientIdentifier { application_name: "psql", username: "admin_user", pool_name: "db" })

On the client side, I see this error

psql: error: connection to server at "192.168.155.73", port 6432 failed: FATAL:  No pool configured for database: "db", user: "admin_user"

Am I missing something in the config? Or is this a bug?

Originally posted by @mismaah in #742

@eortigoza5
Copy link

try this

[pools.db1.users.0]
username = "superuser"
password = "pwd"
pool_size = 5
[pools.db1.shards.0]
servers = [
[ "192.168.155.73", 5432, "primary" ],
[ "192.168.155.74", 5432, "replica" ]
]
database = "db1"

[pools.db2.users.0]
username = "superuser"
password = "pwd"
pool_size = 5
[pools.db2.shards.0]
servers = [
[ "192.168.155.73", 5432, "primary" ],
[ "192.168.155.74", 5432, "replica" ]
]
database = "db2"

[pools.test.users.0]
username = "superuser"
password = "pwd"
pool_size = 5
[pools.test.shards.0]
servers = [
[ "192.168.155.73", 5432, "primary" ],
[ "192.168.155.74", 5432, "replica" ]
]
database = "test"

@mismaah
Copy link
Author

mismaah commented May 23, 2024

Found the issue.
I was trying to connect with psql using the pgcat admin creds rather than the pools...users.0 creds.

@mismaah mismaah closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants