|
2 | 2 |
|
3 | 3 | ## Cluster information functions
|
4 | 4 |
|
5 |
| -* `mtm.get_nodes_state()` — show status of nodes in cluster. Returns tuple of following values: |
6 |
| - * id, integer |
7 |
| - * disabled, bool |
8 |
| - * disconnected, bool |
9 |
| - * catchUp, bool |
10 |
| - * slotLag, bigint |
11 |
| - * avgTransDelay, bigint |
12 |
| - * lastStatusChange, timestamp |
13 |
| - * oldestSnapshot, bigint |
14 |
| - * SenderPid integer |
15 |
| - * SenderStartTime timestamp |
16 |
| - * ReceiverPid integer |
17 |
| - * ReceiverStartTime timestamp |
18 |
| - * connStr text |
19 |
| - * connectivityMask bigint |
20 |
| - |
21 |
| -* `mtm.get_cluster_state()` -- show whole cluster status |
22 |
| - * status, text |
23 |
| - * disabledNodeMask, bigint |
24 |
| - * disconnectedNodeMask, bigint |
25 |
| - * catchUpNodeMask, bigint |
26 |
| - * liveNodes, integer |
27 |
| - * allNodes, integer |
28 |
| - * nActiveQueries, integer |
29 |
| - * nPendingQueries, integer |
30 |
| - * queueSize, bigint |
31 |
| - * transCount, bigint |
32 |
| - * timeShift, bigint |
33 |
| - * recoverySlot, integer |
34 |
| - * xidHashSize, bigint |
35 |
| - * gidHashSize, bigint |
36 |
| - * oldestXid, bigint |
37 |
| - * configChanges, integer |
| 5 | +* `mtm.get_nodes_state()` — Shows the status of nodes in the cluster. Returns a tuple of the following values: |
| 6 | + * id, integer - Node ID. |
| 7 | + * enabled, bool - Shows whether the node is excluded from the cluster. The node can only be disabled if responses to heartbeats are not received within the `heartbeat_recv_timeout` time interval. When the node starts responding to heartbeats, `multimaster` can automatically restore the node and switch it back to the enabled state. Automatic recovery is only possible if the replication slot is still active. Otherwise, you can restore the node manually. |
| 8 | + * connected, bool - Shows whether the node is connected to the WAL sender. |
| 9 | + * slot_active, bool - Shows whether the node has an active replication slot. For a disabled node, the slot remains active until the `max_recovery_lag` value is reached. |
| 10 | + * stopped, bool - Shows whether replication to this node was stopped by the `mtm.stop_node()` function. A stopped node acts as a disabled one, but cannot be automatically recovered. Call `mtm.recover_node()` to re-enable such a node. |
| 11 | + * catchUp - During the node recovery, shows whether the data is recovered up to the `min_recovery_lag` value. |
| 12 | + * slotLag - Size of the WAL data that the replication slot holds for a disabled/stopped node. The slot is dropped when `slotLag` reaches the `max_recovery_lag` value. |
| 13 | + * avgTransDelay - An average commit delay caused by this node, in microseconds. |
| 14 | + * lastStatusChange - Last time when the node changed its status (enabled/disabled). |
| 15 | + * oldestSnapshot - The oldest global snapshot existing on this node. |
| 16 | + * SenderPid - Process ID of the WAL sender. |
| 17 | + * SenderStartTime - WAL sender start time. |
| 18 | + * ReceiverPid - Process ID of the WAL receiver. |
| 19 | + * ReceiverStartTime - WAL receiver start time. |
| 20 | + * connStr - Connection string to this node. |
| 21 | + * connectivityMask - Bitmask representing connectivity to neighbor nodes. Each bit represents a connection to node. |
| 22 | + * nHeartbeats - Number of heartbeat responses received from this node. |
| 23 | + |
| 24 | +* `mtm.collect_cluster_state()` - Collects the data returned by the `mtm.get_cluster_state()` function from all available nodes. For this function to work, in addition to replication connections, pg_hba.conf must allow ordinary connections to the node with the specified connection string. |
| 25 | + |
| 26 | +* `mtm.get_cluster_state()` - Shows the status of the multimaster extension. Returns a tuple of the following values: |
| 27 | + * status - Node status. Possible values are: "Initialization", "Offline", "Connected", "Online", "Recovery", "Recovered", "InMinor", "OutOfService". The <literal>inMinor</literal> status indicates that the corresponding node got disconnected from the majority of the cluster nodes. Even though the node is active, it will not accept write transactions until it is reconnected to the cluster. |
| 28 | + * disabledNodeMask - Bitmask of disabled nodes. |
| 29 | + * disconnectedNodeMask - Bitmask of disconnected nodes. |
| 30 | + * catchUpNodeMask - Bitmask of nodes that completed the recovery. |
| 31 | + * liveNodes - Number of enabled nodes. |
| 32 | + * allNodes - Number of nodes in the cluster. The majority of alive nodes is calculated based on this parameter. |
| 33 | + * nActiveQueries - Number of queries being currently processed on this node. |
| 34 | + * nPendingQueries - Number of queries waiting for execution on this node. |
| 35 | + * queueSize - Size of the pending query queue, in bytes. |
| 36 | + * transCount - The total number of replicated transactions processed by this node. |
| 37 | + * timeShift - Global snapshot shift caused by unsynchronized clocks on nodes, in microseconds. |
| 38 | + * recoverySlot - The node from which a failed node gets data updates during automatic recovery. |
| 39 | + * xidHashSize - Size of xid2state hash. |
| 40 | + * gidHashSize - Size of gid2state hash. |
| 41 | + * oldestXid - The oldest transaction ID on this node. |
| 42 | + * configChanges - Number of state changes (enabled/disabled) since the last reboot. |
| 43 | + * stalledNodeMask - Bitmask of nodes for which replication slots were dropped. |
| 44 | + * stoppedNodeMask - Bitmask of nodes that were stopped by `mtm.stop_node()`. |
| 45 | + * lastStatusChange - Timestamp of the last state change. |
38 | 46 |
|
39 | 47 |
|
40 | 48 | ## Node management functions
|
41 | 49 |
|
42 |
| -* `mtm.add_node(conn_str text)` -- add node to the cluster. |
43 |
| -* `mtm.drop_node(node integer, drop_slot bool default false)` -- exclude node from the cluster. |
44 |
| -* `mtm.poll_node(nodeId integer, noWait boolean default FALSE)` -- wait for node to become online. |
45 |
| -* `mtm.recover_node(node integer)` -- create replication slot for the node which was previously dropped together with it's slot. |
| 50 | +* `mtm.add_node(conn_str text)` -- Adds a new node to the cluster. |
| 51 | + * `conn_str` - Connection string for the new node. For example, for the database `mydb`, user `myuser`, and the new node `node4`, the connection string is `"dbname=mydb user=myuser host=node4"`. Type: `text` |
| 52 | + |
| 53 | + |
| 54 | +* `mtm.stop_node(node integer, drop_slot bool default false)` -- Excludes a node from the cluster. |
| 55 | + * `node` - ID of the node to be dropped that you specified in the `multimaster.node_id` variable. Type: `integer` |
| 56 | + * `drop_slot` - Optional. Defines whether the replication slot should be dropped together with the node. Set this option to true if you do not plan to restore the node in the future. Type: `boolean` Default: `false` |
| 57 | + |
| 58 | + |
| 59 | +* `mtm.recover_node(node integer)` -- Creates a replication slot for the node that was previously dropped together with its slot. |
| 60 | + * `node` - ID of the node to be restored. |
| 61 | + |
| 62 | + |
| 63 | +* `mtm.poll_node(nodeId integer, noWait boolean default FALSE)` -- Waits for the node to become online. |
| 64 | + |
46 | 65 |
|
47 | 66 | ## Data management functions
|
48 | 67 |
|
49 |
| -* `mtm.make_table_local(relation regclass)` -- stop replication for a given table |
| 68 | +* `mtm.make_table_local(relation regclass)` -- Stops replication for the specified table. |
| 69 | + * `relation` - The table you would like to exclude from the replication scheme. Type: `regclass` |
50 | 70 |
|
51 | 71 | ## Debug functions
|
52 | 72 |
|
|
0 commit comments