postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Connection pooler configuration

Open gorbak25 opened this issue 3 years ago • 1 comments

I'm trying to enable server_fast_close in the connection pooler, the CRD doesn't expose this. The operator should expose more configuration options for the connection pooler directly in the CRD.

gorbak25 avatar Jun 11 '22 12:06 gorbak25

We can think of including the connection pooler image to the OS repo, so that you can configure it yourself. But, the idea once was that you can also specify your own pgBouncer image in the operator. But, I guess it would require the following function:

CREATE SCHEMA IF NOT EXISTS pooler;

CREATE OR REPLACE FUNCTION pooler.user_lookup(
    in i_username text, out uname text, out phash text)
RETURNS record AS $$
BEGIN
    SELECT usename, passwd FROM pg_catalog.pg_shadow
    WHERE usename = i_username INTO uname, phash;
    RETURN;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

REVOKE ALL ON FUNCTION pooler.user_lookup(text) FROM public, pooler;
GRANT EXECUTE ON FUNCTION pooler.user_lookup(text) TO pooler;
GRANT USAGE ON SCHEMA pooler TO pooler;

And we are also patching pgBouncer. I'm not sure if it would work out-of-the box with your own pgBouncer image.

FxKu avatar Jun 15 '22 17:06 FxKu