Re: Installed. Now what?

From: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
To: Scott Mead <scottm(at)openscg(dot)com>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, Amitabh Kant <amitabhkant(at)gmail(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: Installed. Now what?
Date: 2011-11-20 11:56:18
Message-ID: CAFWfU=u3GiUihGTdcTo3suNenStDunZKTcnkrVj7OG2C+ZjcgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Nov 20, 2011 at 7:52 PM, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:
> On Sun, Nov 20, 2011 at 7:43 PM, Scott Mead <scottm(at)openscg(dot)com> wrote:
>>
>>
>> On Sun, Nov 20, 2011 at 6:21 AM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>>>
>>> On Sun, Nov 20, 2011 at 8:32 AM, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message deepak 2011-11-20 12:46:06 Re: 0.0.0.0 addresses in postgresql.conf on Windows
Previous Message Phoenix Kiula 2011-11-20 11:52:10 Re: Installed. Now what?