group set leader v5.6

Switches a group over to new write leader

Synopsis

Switches over to new write leader. Use the method fast for immediate switchover. Use strict to wait until lag is less than route_writer_max_lag on the given target node. If switchover fails due to timeout or any other issue, BDR might elect a write leader that's different from the given target node.

pgd group set leader [flags]

Options

FlagFlag, long          ValueDescription
--group-namegroupnamegroup name of group where write leader will change
--node-namenodenamenode name of proposed new write leader
--methodstrict
|fast
switchover method. Default strict
--timeoutdurationtimeout period when switchover method is strict. Default 10s

Switchover methods

  • strict - waits until lag on given node is less than route_writer_max_lag (default).
  • fast - immediate switchover, route_writer_max_lag is ignored.

Examples

With defaults

In this example, we use the option defaults. This means the method defaults to strict and uses the default 10s timeout.

$ pgd group set leader --group-name group_a --node-name bdr-a1
Output
switchover is complete

With options

In this example, we explicitly use the strict method but set the timeout to 15s.

$ pgd group set leader --group-name group_a --node-name bdr-a1 --method strict --timeout 15s
Output
switchover is complete

Immediate switchover

In this example, we use the fast method for immediate switchover.

$ pgd group set leader --group-name group_a --node-name bdr-a1 --method fast
Output
switchover is complete