[Asterisk-Users] Asterisk with PostgreSQL

asterisk at spindrift.on.ca asterisk at spindrift.on.ca
Thu Jun 24 13:27:34 MST 2004


Caleb,

postgresql is usually run under user postgres and is very sensitive to 
config files permissions. Both postgres.conf and pg_hba.conf should be 
owned by postgres:postgres and have 0600 permissions. I often get the 
same error after editing these files and leaving them owned by root :)

Ivan Gostev

Caleb Kow wrote:
> Hi Sam,
> 
> I have tried adding in the -i flag into the postgresql startup command
> line but it displays the following upon starting up of Asterisk:
> 
> Jun 25 02:00:02 ERROR[1074494336]: cdr_pgsql.c:298 my_load_module:
> cdr_pgsql: Unable to connect to database server localhost.  Calls will
> not be logged!
> Jun 25 02:00:02 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module:
> cdr_pgsql: Reason: FATAL:  Missing or erroneous pg_hba.conf file, see
> postmaster log for details
> 
> Very strangely, the pg_hba.conf file is right there, at
> /var/lib/pgsql/pg_hba.conf
> 
> On Thu, 24 Jun 2004 23:27:46 +1000, Sam Tilders
> <sam at jovianprojects.com.au> wrote:
> 
>>On Thu, Jun 24, 2004 at 09:05:42PM +0800, Caleb Kow wrote:
>>
>>>Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module:
>>>cdr_pgsql: Reason: could not connect to server: Connection refused
>>>        Is the server running on host localhost and accepting
>>>        TCP/IP connections on port 5432?
>>>
>>>However, the strange thing is that when I try to connect to this
>>>database using the command prompt, it puts me through! :) Only when
>>>Asterisk tries to connect to the postgresql database does it not work.
>>>Any idea why this is happening?
>>
>>Asterisk is trying to connect to the postgresql postmaster.
>>
>>"netstat -na |grep 5432" should show a line with LISTEN, if it
>>does not then postgres is not accepting tcp connections.
>>
>>postmaster needs the -i option to accept tcp connections.
>>
>>The startup script, perhaps /etc/init.d/postgresql needs
>>the command line to pg_ctl add the -i option to
>>postmaster's command line. Something like:
>>/usr/bin/pg_ctl -p /usr/bin/postmaster -o '-p 5432 -i' start
>>with whatever other options are already there.
>>
>>Then after a restart, asterisk should be able to connect to
>>postgres.
>>
>>--
>>--
>>Sam Tilders
>>sam at jovianprojects.com.au
>>(Move to Jupiter)
>>_______________________________________________
>>Asterisk-Users mailing list
>>Asterisk-Users at lists.digium.com
>>http://lists.digium.com/mailman/listinfo/asterisk-users
>>To UNSUBSCRIBE or update options visit:
>>  http://lists.digium.com/mailman/listinfo/asterisk-users
>>
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> .
> 



More information about the asterisk-users mailing list