Postgresql backup issue -

0

Hi

 

We are following the steps for upgrade from 6.1.0 to 7.1.0 using this link:

https://community.jaspersoft.com/documentation/tibco-jasperreports-server-upgrade-guide/v71/upgrading-60-63-71-0#upgrading_562921741_1114058

As per the command:

PostgreSQL

cd <path>/JS_BACKUP

pg_dump --username=postgres  jasperserver  >  js-db-dump.sql

 

We received an error message:

pg_dump: [archiver (db)] connection to database "jasperserver" failed: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

 

-----------

To get rid of ths error tried the following command for backup:

pg_dump jasperserver -U jasperdb -h localhost > js-db-dump-13FEB2020.sql

Although when jasperserver started using ctlscript.sh and showed that postgresql started on port 5433, I'm getting the following error message for the backup comand shown above:

connection to database "jasperserver" failed: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

 

How to resolve this?

 

Thanks in advance for your help.

aparnagl's picture
Joined: Apr 6 2010 - 12:09am
Last seen: 1 day 12 hours ago

2 Answers:

0

The error represents a connection problem to the postgres database. 

So it is essential to firstly know whether the postgres is running and on what port number (default port is 5432). 

Once you know this information, you can use this to force the connection with extra parameters passed with the pg_dump command :

-h host 
-p port
-U username
-W

You can use this postgres command line reference as a guide:

https://www.postgresql.org/docs/9.3/app-pgdump.html

If it is still an issue and the error that you are getting remains EXACTLY the same then probably there is an incorrect path to socket. Backup tried to connect to /var/run/postgresql/.s.PGSQL.5432 but it does not exist. You can check this article:

https://stackoverflow.com/questions/31645550/why-psql-cant-connect-to-se...

to check for the location of the socket file and verify the config files  pg_hba.conf and postgresql.conf accordingly.

There are a few comments that mentions to check for unix_socket_directories parameter setting.

I also recommend to check the for this setting as well:

listen_addresses = '*'

vchiem's picture
8192
Joined: May 1 2017 - 5:33pm
Last seen: 14 hours 58 min ago
0

Finally managed to resolve it by using the following command:

pg_dump --username=postgres --host=127.0.0.1 --port=5433 jasperserver > jasperserver_14FEB2020_1046.sql

This worked and the dump file got created sucessfully

aparnagl's picture
Joined: Apr 6 2010 - 12:09am
Last seen: 1 day 12 hours ago
Feedback
randomness