0

I have set up a 2-node PG 9.4 system with BDR. Replication works great.

Now, let's suppose that one of the two nodes needs to be replaced. In fact, let's be more specific. Let's say that the node on which I ran the command to create the group : SELECT bdr.bdr_group_create() has to be replaced.

What is the procedure to do this?

Thanks

Huy Vu
  • 1
  • 2

1 Answers1

1

We used to do the following:

1- Create a new node

2- Copy data from the node that you want to keep

sudo -u postgres \
    /usr/lib/postgresql/9.4/bin/pg_basebackup \
    -h $HOST_TO_CLONE -p 5432 -D $DATADIR

3- Join the cluster:

sudo -u postgres  /usr/lib/postgresql/9.4/bin/bdr_init_copy \
    -d "host=$HOST_TO_CLONE dbname=$DB_NAME port=5432" \ 
    '--local-dbname="host=$LOCAL_IP dbname=$DB_NAME port=5432" \ 
    -n $LOCAL_IP -D $DATADIR

After bdr_init_copy finishes, you can delete the node that you want to replace by running on it the following command:

SELECT bdr.bdr_part_by_node_names(ARRAY(SELECT(bdr.bdr_get_local_node_name()));

This works ok in our installation.

mustaccio
  • 28,207
  • 24
  • 60
  • 76
Eloy Coto
  • 41
  • 4