I have postgres with hba configuration file and pgbouncer for connection pooling.
I want to connect to pgbouncer (instead of postgres) only by changing the port number of the connection string (6543 instead of 5432). Both postgres and pgbouncer run on the same server.
So far, I've been able to have pgbouncer run with its own hba file with duplicated user/password. It's not maintainable (or at least very painful) to manually sync postgres and pgbouncer user/password.
Is there any way I can make pgbouncer forward user/password login attempts to postgres as-is? Or am I trying to work my conf against the way things should go?
Which version of pgbouncer do you use? Starting from 1.6 it is able to load users/passwords directly from database. You just need to specify "auth_query"
in your config file.
https://pgbouncer.github.io/config.html
Related
I have PostgreSQL 12, pgbouncer, and Geoserver 2.21.0 running on my Ubuntu 20.04 Virtual Machine (VM). Postgres is behind pgbouncer (connection pooling) and pgbouncer.ini, among other things, specifies the max number of connections, idle timeouts, etc.
I have also connected Geoserver to the postgres via pgbouncer. Since geoserver also has an internal connection pool given by the following options (while adding postgis store), my question is, how do I handle these settings? For the time being, I have kept the default options. But, should these settings (e.g. max_connections, idle) be aligned with the pgbouncer configuration?
Today I set up pgpool-II on one of my company servers for database replication purposes and I'm trying to connect to it from my application located on another server. Previously it connected to database on the same server where pgpool is now installed without problems - I just needed to provide something like this link in config file:
database: postgresql://user:password#host:port/db_name
I have changed port to the one on which pgpool listens for connections and provided user and password from pcp.conf, but then I get a list of errors after starting app, all of them of the same type:
OperationalError: (OperationalError) unable to open database file None None
Doesn't matter if I'm authenticating as postgresql or pgpool user and if I provide md5 encrypted or plaintext password, errors are the same. How can I properly connect to my database then?
Problem solved days ago, needed to change administrative database in pgpool config from "template1" to "postgres". IDK why it doesn't default to that.
I have a Cloud66 hosted web app and Postgres database (on a dedicated server)
I'd like to connect to the Postgres DB via PGAdmin3 but I have been unable to configure Postgres to accept my connection.
I have added the following line to pg_hba.conf
host all all 86.161.230.162/32 md5
I have checked that postgresql.conf has the following setting:
listen_addresses = '*'
Any ideas?
The doubt in my mind is - Am I editing the correct version of these files? They took me a while to find and now I'm wondering if maybe there not the correct versions. These files are located in the directory
./usr/local/pgsql/data/
Advice/guidance all appreciated.
School boy error.
Of course. Firewall!
Doh.
I am using pgAdmin to connect remotely to my database as phpPgAdmin is a bit limited in its features. Only problem is if I leave the SQL window open without running a query for a few minutes, then it says I need to reconnect.
Is this a setting I need to change in my database to keep remote connections alive for longer or is it a pgAdmin setting?
It is client setting.
You need specify connect_timeout in your config file.
29.1. Database Connection Control Functions
29.14. The Connection Service File
I run a Glassfish app server (3.1.2) with a JDBC pool connecting to 1 DB instance.
Now I created a replication setup with a second DB node. I like to loadbalance the DB by allowing read access to the replication slave.
Can I do this by GF configuration or does my application implementation need to take care of this ?
Thanks for any light
Sven
PgBouncer PgBouncer Wiki does this job.
You still connect to 1 DB IP (the pgbouncer instance) and it will handle the Postgres Side with 2 or more DB instances.