Search code examples
postgresqlpgpool

can you run two pgpool instances on a single host?


Is it possible to run two pgpool instances on a single host? We're working through configuring that now, just wanted to check that there's no commonly known "oh, no that will never work" out there.


Solution

  • There's no reason you can't run multiple PgPool-II instances on a single server. You can run multiple instances of almost anything on one server.

    The only restriction with PgPool is that, like any other TCP/IP server that accepts connectoins, the instances must listen on different ports and/or addresses. You can't have two servers listening on the same port on the same address.

    Valid configurations would include both listening on all addresses on different ports:

    Server1: 0.0.0.0:5432
    Server2: 0.0.0.0:5433
    

    or both listening on the same port on different addresses (if your machine has multiple network interfaces or multiple addresses assigned to a single interface):

    Server1: 192.168.1.2:5432
    Server2: 192.168.1.3:5432
    

    but this would not be valid because the listening ranges overlap:

    Server1: 192.168.1.2:5432
    Server2: 0.0.0.0:5432
    

    Finally, if you're listening on different addresses but the same port, you may have to disable the unix socket for one or both instances, or set different unix socket directories. Otherwise the listening unix sockets will clash too, since they're assigned based on directory and port number.