Creating Raft subgroups using TPA v5
The TPAexec configure
command enables Raft subgroups if the --enable_proxy_routing local
option is set. TPA uses the term locations to reflect the common use case of subgroups that map to physical/regional domains. When the configuration is generated, the location name given is stored under the generated group name, which is based on the location name.
Creating Raft subgroups using TPA
This example creates a two-location cluster with three data nodes in each location. The nodes in each location are part of a PGD Raft subgroup for the location.
The top-level group's name is pgdgroup
.
The top-level group has two locations: us_east
and us_west
. These locations are mapped to two subgroups: us_east_subgroup
and us_west_subgroup
.
Each location has four nodes: three data nodes and a barman backup node. The three data nodes also cohost PGD Proxy. The configuration can be visualized like this:
The barman nodes don't participate in the subgroup and, by extension, the Raft group. They're therefore not shown. This diagram is a snapshot of a potential state of the cluster with the West Raft group having selected west_1 as write leader and west_2 as its own Raft leader. On the East, east_1 is write leader while east_3 is Raft leader. The entire cluster is contained within the top-level Raft group. There, west_3 is currently Raft leader.
To create this configuration, you run:
Where hostnames.txt
contains:
The configuration file
The generated config.yml
file has a bdr_node_groups
section that contains the top-level group pgdgroup
and the two subgroups us_east_subgroup
and us_west_subgroup
. Each of those subgroups has a location set (us_east
and us_west
) and two other options that are set to true:
enable_raft
, which activates the subgroup Raft in the subgroupenable_proxy_routing
, which enables the pgd_proxy routers to route traffic to the subgroup’s write leader
Here's an example generated by the sample tpaexec command:
Every node instance has an entry in the instances list. In that entry, bdr_child_group
appears in the variables section, set to the subgroup the node belongs to. Here's an example generated by the sample tpaexec command:
The one node in this location that doesn't have a bdr_child_group
setting is the barman node because it doesn't participate in the Raft decision-making process.