Skip to content

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

Closed
@mismaah

Description

@mismaah

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions