Hello,
I'm a PostgreSQL user on Windows and encountered trouble running pg_upgrade with the following error [1], ultimately due to blocked ports in Windows added via OS updates.
A workaround is to run pg_upgrade with lower range ports for the old/new servers via the -p/-P parameters.
##################################
> pg_upgrade
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
*failure*
Consult the last few lines of "pg_upgrade_server_start.log" or "pg_upgrade_server.log" for
the probable cause of the failure.
connection to database failed: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 50432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 50432?
could not connect to source postmaster started with the command:
"C:/program files/postgresql/12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "C:/program files/postgresql/12/data" -o "-p 50432 -b " start
##################################
The block list as of writing for me is:
##################################
> netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
5357 5357
44376 44376
49683 49782
49783 49882
49883 49982
50000 50059 *
50265 50364
50370 50469
50849 50948
51049 51148
51149 51248
51349 51448
51449 51548
51549 51648
51649 51748
56959 57058
57059 57158
62662 62662
* - Administered port exclusions.
##################################
A silly problem, but perhaps pg_upgrade could look to use different ports not in the Windows block list to prevent this issue.
Kind regards,
Andrew