Re: Installed. Now what? - Mailing list pgsql-general

From Phoenix Kiula
Subject Re: Installed. Now what?
Date
Msg-id CAFWfU=u3GiUihGTdcTo3suNenStDunZKTcnkrVj7OG2C+ZjcgQ@mail.gmail.com
Whole thread Raw
In response to Re: Installed. Now what?  (Phoenix Kiula <phoenix.kiula@gmail.com>)
Responses Re: Installed. Now what?
List pgsql-general
On Sun, Nov 20, 2011 at 7:52 PM, Phoenix Kiula <phoenix.kiula@gmail.com> wrote:
> On Sun, Nov 20, 2011 at 7:43 PM, Scott Mead <scottm@openscg.com> wrote:
>>
>>
>> On Sun, Nov 20, 2011 at 6:21 AM, Marko Kreen <markokr@gmail.com> wrote:
>>>
>>> On Sun, Nov 20, 2011 at 8:32 AM, Phoenix Kiula <phoenix.kiula@gmail.com>
>>> wrote:
>>> > The password I am entering in the terminal is right for sure. I've
>>> > tried it a few times, checked the caps lock, etc. Also, if the log
>>> > carries this "FATAL password authentication failed", why does the
>>> > terminal give the vague error "no working server connection"?
>>
>> ISTM that either your connect string is bad to the database or you already
>> have too many clients connected to the db.  Have you tried:
>>   show max_clients;
>>   select count(1) from pg_stat_activity;
>>   In postgres?  Is it possible that there are just too many clients already
>> connected?
>
>
> You may be on to something. And the queries results are below. (5
> connections are reserved for "superusers" so you may be right.)
>
>
> MYDB=# show max_connections;
>  max_connections
> -----------------
>  150
> (1 row)
>
> Time: 0.517 ms
>
>
> MYDB=#   select count(1) from pg_stat_activity;
>  count
> -------
>   144
> (1 row)
>
> Time: 1.541 ms
>
>
>
> But isn't the point to connect to pgbouncer (instead of PG directly)
> and have it manage connections? Even when I restart PG so that its
> connection count is fresh and low, and immediately try to connect to
> pgbouncer, it still shows me an error.
>
> How can I debug that the connections are the problem?
>
> The error message in the pgbouncer log points to some "FATAL password
> authentication".
>
>
>
> If not, then it's probably just your connect string ( in
>> pgbouncer.ini) not being quite
>  right.  You are using 127.0.0.1 for
>> connecting, is postgres even listening?
>>   netstat -lntp | grep 5432
>
>
>
> Yes. It is.
>
>
>> netstat -lntp | grep 5432
> tcp        0      0 127.0.0.1:5432              0.0.0.0:*
>     LISTEN      26220/postmaster
> tcp        0      0 :::5432                     :::*
>     LISTEN      26220/postmaster
>
>
>> netstat -lntp | grep 6432
> tcp        0      0 127.0.0.1:6432              0.0.0.0:*
>     LISTEN      10854/pgbouncer
>
>
> Any ideas?



Just to add, the connection string I try for pgbouncer is EXACTLY the
same as the one I use to connect directly to PG, but I add the port
number.

For Direct PG  (works) --
pg_connect("host=localhost dbname=$db user=myuser password=mypass");

For Pgbouncer  (does NOT work) --
pg_connect("host=localhost dbname=$db port=6432 user=myuser password=mypass");

Given that both PG and postgresql are alive and kicking on 5432 and
6432 ports respectively, as shown in the netstat output above, I
wonder if the connection string is the problem.

pgsql-general by date:

Previous
From: Phoenix Kiula
Date:
Subject: Re: Installed. Now what?
Next
From: deepak
Date:
Subject: Re: 0.0.0.0 addresses in postgresql.conf on Windows