Re: PgBouncer error - psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.6432"?

From: Igor Neyman <ineyman(at)perceptron(dot)com>
To: Ali Aktar <aktarali(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PgBouncer error - psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.6432"?
Date: 2015-07-06 17:38:55
Message-ID: A76B25F2823E954C9E45E32FA49D70ECCD4BC3EB@mail.corp.perceptron.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Ali Aktar
Sent: Monday, July 06, 2015 11:04 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] PgBouncer error - psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.6432"?

Hi Guys;

Can I please get some assistance:

I have postgres server running on the localhost:
-bash-4.2$ telnet localhost 5432
Trying ::1...
Connected to localhost.
Escape character is '^]'.

-bash-4.2$ psql -U postgres
psql (9.4.4)
Type "help" for help.

postgres=# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(4 rows)

pgbouncer.ini:
[databases]
template1 = host=127.0.0.1 port=5432 dbname=template1
[pgbouncer]
listen_port = 6432
listen_addr = 127.0.0.1
auth_type = trust
auth_file = /etc/pgbouncer/userslist.txt
logfile = /var/log/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
admin_users = postgres

-bash-4.2$ telnet localhost 6432
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

2015-07-06 15:02:00.233 11993 DEBUG C-0x2549910: (nodb)/(nouser)@127.0.0.1:44274<http://127.0.0.1:44274> P: got connection: 127.0.0.1:44274<http://127.0.0.1:44274> -> 127.0.0.1:6432<http://127.0.0.1:6432>

But here is the weird thing:
When I try to run:
-bash-4.2$ psql -p 6432 pgbouncer
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.6432"?

Please tell me what Im doing wrong?

And another question, if I want to specify remote postgres DB's in the .ini file. How do I do that?

Thanks
Ali.

You should specify pgbouncer with ā€œ-dā€ option:

-bash-4.2$ psql -p 6432 ā€“d pgbouncer

Regards,
Igor Neyman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert DiFalco 2015-07-06 17:41:10 Average New Users Per DOW
Previous Message Jimit Amin 2015-07-06 17:27:39 Re: String match function required like utl_match in oracle