pg_restore to a port where nobody is listening?

From: Daniel Westermann <daniel(dot)westermann(at)dbi-services(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_restore to a port where nobody is listening?
Date: 2016-12-21 17:22:23
Message-ID: 409717180.4468952.1482340943327.JavaMail.zimbra@dbi-services.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a PostgreSQL 9.5.4 and a PostgreSQL 9.6.1 instance installed on the same host. I dump the 9.5.4 instance with:

pg_dump -h localhost -p 5438 -C -c -F d -j 2 -f /var/tmp/exp/ test

.. which runs fine. I get the output as expected:
postgres(at)pgbox:/home/postgres/ [PG954] ls /var/tmp/exp/
3016.dat.gz 3017.dat.gz toc.dat

Source instance:
(postgres(at)[local]:5438) [postgres] > show port;
port
------
5438
(1 row)

Time: 0.328 ms
(postgres(at)[local]:5438) [postgres] > select version();
-[ RECORD 1 ]-----------------------------------------------------------------------------------------------------------------------
version | PostgreSQL 9.5.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit

Now I try to import into 9.6.1 => the instance is not running but the environment is set:

postgres(at)pgbox:/home/postgres/ [PG961] netstat -na | grep 5439
postgres(at)pgbox:/home/postgres/ [PG961] echo $PGPORT
5439

postgres(at)pgbox:/home/postgres/ [PG961] pg_restore -V
pg_restore (PostgreSQL) 9.6.1
postgres(at)pgbox:/home/postgres/ [PG961] pg_restore -h localhost -p 5439 -F d -C -j 2 /var/tmp/exp/

This runs fine but where does it connect to? Nothing is listening on port 5439.

postgres(at)pgbox:/home/postgres/ [PG961] netstat -tulpen
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 15929 -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 17460 -
tcp 0 0 0.0.0.0:5438 0.0.0.0:* LISTEN 1000 18923 2829/postgres
tcp6 0 0 :::22 :::* LISTEN 0 15938 -
tcp6 0 0 ::1:25 :::* LISTEN 0 17461 -
tcp6 0 0 :::5438 :::* LISTEN 1000 18924 2829/postgres
udp 0 0 0.0.0.0:68 0.0.0.0:* 0 14940 -
udp 0 0 0.0.0.0:49566 0.0.0.0:* 0 14929 -
udp6 0 0 :::40307 :::* 0 14930 -

postgres(at)pgbox:/home/postgres/ [PG961] psql -h localhost -p 5439
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5439?
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 5439?

What do I miss? I can give any port to pg_restore and it just seems to be fine. Even this seems to working (the copy from stdin is displayed on the screen):
postgres(at)pgbox:/home/postgres/ [PG961] pg_restore -h localhost -p ===6666 -F d -C /var/tmp/exp/

Thanks
Daniel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-12-21 17:32:57 Re: pg_restore to a port where nobody is listening?
Previous Message Adrian Klaver 2016-12-21 16:58:58 Re: error updating a tuple after promoting a standby