Re: Installed. Now what?

From: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgbouncer-general(at)pgfoundry(dot)org
Subject: Re: Installed. Now what?
Date: 2011-11-19 18:50:56
Message-ID: CAFWfU=tNFnh4VA6UNCL4DX-_1hi1P5K-ZBO0-FQExbrf5FJ7rQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Nov 20, 2011 at 2:39 AM, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:
> On Sun, Nov 20, 2011 at 2:13 AM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
>>
>> http://pgbouncer.projects.postgresql.org/doc/config.html
>>
>> I have never used pgbouncer, but from above it would seem you need to set up a
>> [databases] section to tie pgbouncer to the Postgres server.
>> See:
>> SECTION [databases]
>
>
>
> Thanks Adrian. All this is done.
>
> The config file link just describes what each option means. There's
> zero information about how to actually tweak or wisely set the stuff!
> :(
>
> Anyway, with half a day of googling or so, and looking at sundry blogs
> and such, I have pgbouncer running on port 6432. PG runs on the usual
> 5432.
>
> I still keep seeing the "Sorry, too many clients already" error.
>
> From my PHP code, what line should I use? This does NOT work:
>
>  $link   = pg_connect("host=localhost dbname=$db user=$user password=$pass");
>
> If I remove the port number, it works. Is it then connecting straight
> to the DB? What am I missing? Pgbouncer is working, but not accepting
> PHP pg_connect() call. The username and password are correct for sure.
>
> Any thoughts?

I mean this does not work:

$link   = pg_connect("host=localhost port=6432 dbname=$db
user=$user password=$pass");

When I remove that port number, it works. I suppose it connects
directly to PG. And this is still leading to too many connections.

Also, this does NOT work:

psql snipurl -E "snipurl_snipurl" -p 6543

Shows me this error:

psql: ERROR: no working server connection

How come? The pgbouncer is on!

> ps aux | grep pgbouncer
postgres 5567 0.0 0.0 16880 508 ? R 13:50 0:00
pgbouncer -d /etc/pgbouncer.ini
root 5583 0.0 0.0 61188 764 pts/2 R+ 13:50 0:00
grep pgbouncer

Any thoughts? How can I make my PHP connect to the pgbouncer?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob_pg 2011-11-19 19:12:10 Re: How could I find the last modified procedure in the database?
Previous Message Phoenix Kiula 2011-11-19 18:39:42 Re: Installed. Now what?