Creating Subscriber-only groups and nodes#
The process of creating a Subscriber-only node or nodes starts with creating a Subscriber-only group to contain the node or nodes. Perform this step on an existing fully joined node in the PGD cluster.
Creating a Subscriber-only group manually#
To create a Subscriber-only group, you must specify the
node_group_type as subscriber-only when creating the group. For
example, here we are logged into the node “node-one” running on
“host-one”. It’s a member of it’s own data group and as for all nodes, a
member of the top-level group, here called topgroup . Log into this
node directly to create a new Subscriber-only group named sogroup
with the following SQL command:
select bdr.create_node_group(sogroup, topgroup, false, subscriber-only);
or more explicitly with parameter names:
select bdr.create_node_group(node_group_name:=sogroup,
parent_group_name:=topgroup,
join_node_group:=false,
node_group_type:=subscriber-only);
This creates a Subscriber-only group named sogroup which is a child
of the topgroup group. The false parameter for join_node_group
indicates that the node executing this command shouldn’t join to the
newly created group. Automatically joining the group is the default
behavior, which in this case needs to be supressed.
Adding a node to a new Subscriber-only group manually#
You can now initialize a new data node and then add it to the Subscriber-only group. Create a data node and configure the bdr extension on it as you would for any other data node.
You now have to create this new node as a subscriber-only node. To
do this, log into the new node and run the following SQL command:
select bdr.create_node(so-node-1, host=so-host-1 dbname=pgddb port=5444, subscriber-only);
Then, log into that new node and add it to the sogroup group with
the following SQL command:
select bdr.join_node_group(host=host-one dbname=pgddb port=5444,sogroup);
or more explicitly with parameter names:
select bdr.join_node_group(dsn:=host=host-one dbname=pgddb port=5444,
node_group_name:=sogroup);
This instructs the new node to join the sogroup group. As it has no
knowledge of the cluster topology, it will connect to the node specified
in the DSN to receive the necessary information to join the group. In
this example, this happens to be the same node as we used to create the
subscriber-only group, but it could be any node that’s fully joined to
the cluster.