How to change the ip of docker-file to run on different machines?

0

I installed this cluster of postgres using pgpool here on my machine:

link

So far so good, but everything is running locally and I want the cluster to run on several different machines, so I will create several different machines to install docker and run each container in their respective machine, but I know it will not work only doing this, because how will the other machines know where the other machines are? Since one can be on the Amazon server and another on the DigitalOcean server.

I know the configuration file is yml:

link

But I have no idea where exactly I have to put the machine ips to make it work.

I'm not asking someone to reinstall the cluster and test to answer this question, I just want to know how exactly the ips and hostname works in this file docker-file. For example if my pgslave1 machine has 176.66.66.2 listening on port 5432, should I replace every occurrence of the name pgslave1 with this ip?

pgpool:
    build:
        context: ../src
        dockerfile: Pgpool-3.7-Postgres-10.Dockerfile
    environment:
        PCP_USER: pcp_user
        PCP_PASSWORD: pcp_pass
        WAIT_BACKEND_TIMEOUT: 60

        CHECK_USER: monkey_user
        CHECK_PASSWORD: monkey_pass
        CHECK_PGCONNECT_TIMEOUT: 3 #timout for checking if primary node is healthy
        SSH_ENABLE: 1
        DB_USERS: monkey_user:monkey_pass # in format user:password[,user:password[...]]
        BACKENDS: "0:pgmaster:5432:1:/var/lib/postgresql/data:ALLOW_TO_FAILOVER,1:pgslave1::::,3:pgslave3::::,2:pgslave2::::" #,4:pgslaveDOES_NOT_EXIST::::
                  # in format num:host:port:weight:data_directory:flag[,...]
                  # defaults:
                  #   port: 5432
                  #   weight: 1
                  #   data_directory: /var/lib/postgresql/data
                  #   flag: ALLOW_TO_FAILOVER
        REQUIRE_MIN_BACKENDS: 3 # minimal number of backends to start pgpool (some might be unreachable)
        CONFIGS: "num_init_children:250,max_pool:4"
                  # in format variable1:value1[,variable2:value2[,...]] if CONFIGS_DELIMITER_SYMBOL=, and CONFIGS_ASSIGNMENT_SYMBOL=:
                  # used for pgpool.conf file
    ports:
        - 5430:5432
        - 9898:9898 # PCP
    networks:
        cluster:
            aliases:

- pgpool

    
asked by anonymous 27.04.2018 / 16:36

0 answers