paunin/PostDock

Use the same volume of old pgmaster when brings it back to the cluster

fhbenatti opened this issue · 1 comments

Guys, sorry for rising up this question again, but i need some instructions to how recreate a service for pgmaster to join in the cluster like slave.

After read some posted issues i noticed witch the correct manner to do this is removed the old service pgmaster and creates a new one:

#4 (comment)

If I understand all of this correct, you should change master to standby config before returning it in cluster or using PARTNERS_NODE
Here described how to return master to cluster:
https://stackoverflow.com/questions/37710868/how-to-promote-master-after-failover-on-postgresql-with-docker
And here we had had discussion about its process:
#178
If I'm wrong, please attach your configuration for more clear understanding.
Originally posted by @Kealman in #184 (comment)

But, is it possible to reuse a previous volume used for old master?

I always need to create a new volume to add a new service pgmaster, otherwise, i get the same error mentioned in issue #184. I want to reuse a previous volume to avoid a full backup (doing a rewind, instead) for the new instance master.

Just for testing, i'd created a new docker-compose file to create a new service for pgmaster:

AddNewNode.docker-compose.yml

pgmaster:
    image: postdock/postgres:latest-postgres10-repmgr40
    environment:
      NODE_ID: 3
      NODE_NAME: node1
      CLUSTER_NODE_NETWORK_NAME: pgmaster
      SSH_ENABLE: 0
      PARTNER_NODES: 'pgmaster,pgslave1'
      REPLICATION_PRIMARY_HOST: pgslave1
      CLEAN_OVER_REWIND: 1
      CONFIGS_DELIMITER_SYMBOL: ;
      CONFIGS: 'max_replication_slots:10'
    ports:
      - 5422:5432
    volumes:
      - pgmaster:/var/lib/postgresql/data
      - ./ssh:/home/postgres/.ssh/keys
    networks:
      cluster:
        aliases:
          - pgmaster

And then, run:

docker-compose -f "AddNewNode.docker-compose.yml" up

As i said, I got the same error mentioned in issue #184.

Is there any wrong parameter in my AddNewNode.docker-compose.yml file?

Any update about this issue please ?