Currently having a problem with my pgbouncer setup.
I am using pgbouncer with Odoo and Odoo requires connecting to postgres database for framework purposes.
Below is the log I received from pgbouncer. It said that there were no such database.
2024-01-07 19:19:38.080 UTC [1] LOG C-0x7f19b3eeb3d0: (nodb)/[email protected]:37798 login attempt: db=postgres user=odoo tls=no
2024-01-07 19:19:38.080 UTC [1] LOG C-0x7f19b3eeb3d0: (nodb)/[email protected]:37798 login failed: db=postgres user=odoo
2024-01-07 19:19:38.080 UTC [1] LOG C-0x7f19b3eeb3d0: (nodb)/[email protected]:37798 closing because: no such database: postgres (age=0s)
2024-01-07 19:19:38.080 UTC [1] WARNING C-0x7f19b3eeb3d0: (nodb)/[email protected]:37798 pooler error: no such database: postgres
While connecting to the application database had no problem.
2024-01-07 19:14:23.733 UTC [1] LOG S-0x7f19b3e76b00: mandaladb/[email protected]:5432 new connection to server (from 172.10.0.7:36534)
2024-01-07 19:14:23.738 UTC [1] LOG S-0x7f19b3e76b00: mandaladb/[email protected]:5432 SSL established: TLSv1.3/TLS_AES_256_GCM_SHA384/ECDH=prime256v1
2024-01-07 19:14:24.806 UTC [1] LOG S-0x7f19b3e76850: mandaladb/[email protected]:5432 new connection to server (from 172.10.0.7:48656)
2024-01-07 19:14:24.811 UTC [1] LOG S-0x7f19b3e76850: mandaladb/[email protected]:5432 SSL established: TLSv1.3/TLS_AES_256_GCM_SHA384/ECDH=prime256v1
I have tested connecting to my database server from my server terminal (that has pgbouncer on top) and there was no issue.
devops@id-dcvs-oddo-prod:~/clinicmandala$ psql -h fhcaredb -U odoo -d postgres
Password for user odoo:
psql (14.10 (Ubuntu 14.10-0ubuntu0.22.04.1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=#
This is problematic, I can’t access the application without successful postgres database connection.
What should I change in my setup? What should I check?
2
Answers
It turns out * is the way to go. If you use docker, it means do not set db_name environment variable.
And just use dbfilter configuration so user does not have to know which database to select.
"no such database" is a pgbouncer-specific message, not a PostgreSQL one (PostgreSQL phrases its analog of this message differently: ‘database "postgres" does not exist’.) You need to change the pgbouncer .ini file so it accepts connections for ‘postgres’ and then passes them on to the database server. You could do that by either adding another line to ‘[databases]’ section, or by changing an existing line to work for ‘*’ rather than only for a particular named database.