Routing functions#

bdr.create_proxy#

Create a proxy

Synopsis#

bdr.create_proxy(proxy_name text, node_group text);

Parameters#

  • proxy_name — Name of the new proxy.

  • node_group — Name of the group to be used by the proxy.

bdr.alter_proxy_option#

Change a proxy

Synopsis#

bdr.alter_proxy_option(proxy_name text, config_key text, config_value text);

Parameters#

  • proxy_name — Name of the proxy to be changed.

  • config_key — Key of the option in the proxy to be changed.

  • config_value — New value to be set for the given key.

The proxy options that can be changed using this function are:

  • listen_address — Address for the proxy to listen on. Default is ‘{0.0.0.0}’.

  • listen_port — Port for the proxy to listen on. Default is ‘6432’.

  • max_client_conn — Maximum number of connections for the proxy to accept. Default is ‘32767’.

  • max_server_conn — Maximum number of connections the proxy can make to the Postgres node. Default is ‘32767’.

  • server_conn_timeout — Connection timeout for server connections. Default is ‘2’ (seconds).

  • server_conn_keepalive — Keepalive interval for server connections. Default is ‘10’ (seconds).

  • consensus_grace_period — Duration for which proxy continues to route even upon loss of a Raft leader. If set to 0s, proxy stops routing immediately. Default is generally ‘6’ (seconds) for local proxies and ‘12’ (seconds) for global proxies. These values will be overriden if raft_response_timeout , raft_global_election_timeout or raft_group_election_timeout are changed from their defaults.

bdr.drop_proxy#

Drop a proxy

Synopsis#

bdr.drop_proxy(proxy_name text);

Parameters#

  • proxy_name — Name of the proxy to be dropped.

bdr.routing_leadership_transfer#

Changing the routing leader transfers the leadership of the node group to another node

Synopsis#

bdr.routing_leadership_transfer(node_group_name text,
              leader_name text,
              transfer_method text DEFAULT strict,
              transfer_timeout interval DEFAULT 10s);

Parameters#

  • node_group_name — Name of group where the leadership transfer is requested.

  • leader_name — Name of node that will become write leader.

  • transfer_method — Type of the transfer, it can be “fast” or the default “strict” that checks the maximum lag.

  • transfer_timeout — Timeout of the leadership transfer, default is 10 seconds.