"Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

cancel
Showing results for 
Search instead for 
Did you mean: 
sumit
Active Member

"Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

I have installed Alfresco community 5.2 in linux with inbuild postgresql. On alfresco start postgresql is getting started successfully and alfresco runs well. But on a server reboot it gives me error "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections".

postgresql is not getting started. While a alfresco start manually through alfresco.sh starts postgresql and everything goes well. But this problem is on server reboot.

While I don't think this happens always with all the servers.

Note : I have installed alfresco with a non root user.

Can I have some help please? Thanks 

1 Solution

Accepted Solutions
sumit
Active Member

Re: "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

Hi Jeff Potts,

Thanks for your responses.

I have resolved this. Here the problem was that NAS disk mounts(using fstab entry) Alfresco alf_data after started Alfresco. Therefore Alfresco was unable to connect Postgresql at the time of need Postgresql connection. I have set alfresco start after 120 seconds of server reboot and till the time all disk mounts gets completed. All these problems was happening because of a slow mount speed of NAS disks.

-Sumit

View solution in original post

4 Replies
jpotts
Professional

Re: "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

What happens when you run sudo service alfresco start to start up Alfresco (instead of running /opt/alfresco/alfresco.sh start)?

sumit
Active Member

Re: "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

I have installed Alfresco by a non root user. Alfresco does not install as a service if installing by a non root user. I have added a crontab entry(@reboot /opt/alfresco_installation_dir/alfresco.sh start) in that Alfresco installed user's crontab file to start Alfresco on reboot. And this is working in all other servers but not here. 

I have also try an another postgresql port then 5432. But no success.

Thanks for your response.

-Sumit

jpotts
Professional

Re: "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

It is good that you installed Alfresco as a non-root user. Alfresco should never be installed as root.

You can always add your own init.d script so that it will properly start Alfresco as a service. You can use the same init.d script that would have been installed had you installed as root, but with minor modifications to specify the alfresco user. If you don't have an installation you can copy it from you might take a look at what others have done. For example you could leverage the init.d script from Peter Löfgren's install script or at least use it as an example.

Did you install PostgreSQL yourself or are you using Alfresco's installation? If you installed it yourself, remember that you often have to edit pg_hba.conf to set/change how PostgreSQL handles authentication, see postgresql - postgres: localhost not connecting - Stack Overflow 

sumit
Active Member

Re: "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections" on server reboot

Jump to solution

Hi Jeff Potts,

Thanks for your responses.

I have resolved this. Here the problem was that NAS disk mounts(using fstab entry) Alfresco alf_data after started Alfresco. Therefore Alfresco was unable to connect Postgresql at the time of need Postgresql connection. I have set alfresco start after 120 seconds of server reboot and till the time all disk mounts gets completed. All these problems was happening because of a slow mount speed of NAS disks.

-Sumit