postgresqlpostgresql-11

Is there a way to make postgresql listen on different ports?


I am running PostgreSQL and I have to change between ports 5432 and 5433.

How can I be able to configure Postgres to listen to both ports at the same time?


Solution

  • It can't be possible to run the Postgres server in multiple ports. But you can use socat or ip tables in Linux or use proxy like pgbouncer

    But sample way you can use socat connection for listening in another port

    # Postgres service listen in port 5432
    socat -dddd TCP4-LISTEN:5433,reuseaddr,fork TCP4:my-postgres-address:5432