pgd raft set-leader#

Synopsis#

The pgd raft set-leader command manually triggers a leadership transfer within a Raft group. It instructs the current leader to step down and facilitates the election of the specified target node as the new Raft leader.

Users and roles#

Requires the bdr_superuser role. See User roles .

Syntax#

pgd raft set-leader [OPTIONS] <LEADER>

Arguments#

Argument

Description

<LEADER>

The name of the node to become the new Raft leader.

Options#

The following options are available for the pgd raft set-leader command:

Short

Long

Description

--group

The name of the group in which to change the leader. If omitted, the global group is used.

--wait-for-completion

If set, the CLI will block and monitor the cluster state until the target node successfully assumes leadership or the operation times out.

See Global Options for common global options.

Examples#

Change the leader of the global group#

pgd raft set-leader kaboom
__OUTPUT__
Command submitted successfully

Attempt to set a node that is already the leader#

pgd raft set-leader kaftan --group dc1_subgroup
__OUTPUT__
Node kaftan is already the raft leader

Change the leader and wait for completion#

Using the --wait-for-completion flag sets a 60-second statement timeout. The CLI will attempt to verify the new leader using the existing connection, or retry with a new connection if a proxy (like Connection Manager) reroutes the traffic.

pgd raft set-leader kaolin --group dc1_subgroup --wait-for-completion
__OUTPUT__
Command executed successfully