|
2 | 2 |
|
3 | 3 | ##Cluster information functions
|
4 | 4 |
|
5 |
| -*`mtm.get_nodes_state()` — Shows the status of nodes in the cluster. |
6 |
| -* id, integer -node ID. |
7 |
| -* enabled, bool -shows whether nodewas excluded from cluster.Nodecan only be disableddue to missingresponses to heartbeatsduring`heartbeat_recv_timeout`. When nodewill startresponding tohearbeats it will be recoveredandturnedback to enabled state. Automatic recovery only possiblewhenreplication slot is active. Otherwise see section[manualnoderecovery]. |
8 |
| -* connected, bool -shows thatnode connected toour walsender. |
9 |
| -* slot_active, bool - node has active replication slot. For a disabled nodeslotwill beactive until`max_recovery_lag`will be reached. |
10 |
| -* stopped, bool -shows whether replication to this node was stopped by`mtm.stop_node()` function.Stoppednode acts as a disabled one, butwill notbe automatically recovered. Call`mtm.recover_node()` to enableit again. |
11 |
| -* catchUp -duringrecovery showsthat noderecoveredtill`min_recovery_lag`. |
12 |
| -* slotLag -amount ofWALsthat replication slot holds for disabled/stoped node.Slot will be droppedwhneslotLag reaches`max_recovery_lag`. |
13 |
| -* avgTransDelay - averagedelay to transactioncommitimposedby this node,usecs. |
14 |
| -* lastStatusChange -last time when node changedit's status (enabled/disabled). |
15 |
| -* oldestSnapshot - oldest global snapshot existing on this node. |
16 |
| -* SenderPid -pidofWALSender. |
17 |
| -* SenderStartTime -time when WALSender was started. |
18 |
| -* ReceiverPid -pidofWALReceiver. |
19 |
| -* ReceiverStartTime -time when WALReceiver was started. |
20 |
| -* connStr -connection string to this node. |
21 |
| -* connectivityMask -bitmask representing connectivity to neighbor nodes. Each bitmeans connection to node. |
22 |
| -* nHeartbeats -number ofhearbeat responses received fromthat node. |
23 |
| - |
24 |
| -*`mtm.collect_cluster_state()` - Collectsoutput of`mtm.get_cluster_state()` from all available nodes.Note: forthis function to work pg_hba should also allow ordinaryconnections (in addition to replication)to node with specifiedconnstring. |
25 |
| - |
26 |
| -*`mtm.get_cluster_state()` -Get info about interanal stateof multimaster extension. |
27 |
| -* status - Node status.Can be"Initialization", "Offline", "Connected", "Online", "Recovery", "Recovered", "InMinor", "OutOfService". |
28 |
| -* disabledNodeMask -bitmask of disabled nodes. |
29 |
| -* disconnectedNodeMask -bitmask of disconnected nodes. |
30 |
| -* catchUpNodeMask -bitmask of nodes that completedtheir recovery. |
31 |
| -* liveNodes -number of enabled nodes. |
32 |
| -* allNodes -number ofallnodesadded to cluster.Decisions aboutmajority of alive nodes based onthat parameter. |
33 |
| -* nActiveQueries -number of queries being currently processed on this node. |
34 |
| -* nPendingQueries -number of queriesavaiting their turn on this node. |
35 |
| -* queueSize -size of pending queue in bytes. |
36 |
| -* transCount - totalamount of replicated transactions processed by this node. |
37 |
| -* timeShift -global snapshotshit due to unsynchronized clocks on nodes,usec. |
38 |
| -* recoverySlot -during recovery procedurenodegrabs changes from this node. |
39 |
| -* xidHashSize -size of xid2state hash. |
40 |
| -* gidHashSize -size of gid2state hash. |
41 |
| -* oldestXid - oldestxid on this node. |
42 |
| -* configChanges -number of state changes (enabled/disabled) since last reboot. |
43 |
| -* stalledNodeMask -bitmask of nodes for which replicationslot was dropped. |
44 |
| -* stoppedNodeMask -bitmask of nodes that were stopped by`mtm.stop_node()`. |
45 |
| -* lastStatusChange -timestamp whenlast state change happend. |
| 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 whetherthenodeis excluded fromthecluster.The nodecan only be disabledifresponses to heartbeatsare not received within the`heartbeat_recv_timeout` time interval. Whenthenodestartsresponding toheartbeats,`multimaster` can automatically restore the nodeandswitch itback totheenabled state. Automatic recoveryisonly possibleif thereplication slot isstillactive. Otherwise, you can restore thenodemanually. |
| 8 | +* connected, bool -Shows whether thenodeisconnected tothe WAL sender. |
| 9 | +* slot_active, bool -Shows whether thenode hasanactive replication slot. For a disabled node, theslotremainsactive untilthe`max_recovery_lag`value is reached. |
| 10 | +* stopped, bool -Shows whether replication to this node was stopped bythe`mtm.stop_node()` function.A stoppednode acts as a disabled one, butcannotbe automatically recovered. Call`mtm.recover_node()` tore-enablesuch a node. |
| 11 | +* catchUp -During the noderecovery, showswhether the data isrecoveredup to the`min_recovery_lag` value. |
| 12 | +* slotLag -Size ofthe WAL datathatthereplication slot holds foradisabled/stopped node.The slot is droppedwhen`slotLag` reachesthe`max_recovery_lag` value. |
| 13 | +* avgTransDelay -Anaverage commitdelay causedby this node,in microseconds. |
| 14 | +* lastStatusChange -Last time whenthenode changedits status (enabled/disabled). |
| 15 | +* oldestSnapshot -Theoldest global snapshot existing on this node. |
| 16 | +* SenderPid -Process IDofthe WAL sender. |
| 17 | +* SenderStartTime -WAL sender start time. |
| 18 | +* ReceiverPid -Process IDofthe WAL receiver. |
| 19 | +* ReceiverStartTime -WAL receiver start time. |
| 20 | +* connStr -Connection string to this node. |
| 21 | +* connectivityMask -Bitmask representing connectivity to neighbor nodes. Each bitrepresents a connection to node. |
| 22 | +* nHeartbeats -Number ofheartbeat responses received fromthis node. |
| 23 | + |
| 24 | +*`mtm.collect_cluster_state()` - Collectsthe data returned by the`mtm.get_cluster_state()`functionfrom all available nodes.Forthis function to work, in addition to replicationconnections, pg_hba.conf must allow ordinary connectionstothenode withthespecifiedconnection string. |
| 25 | + |
| 26 | +*`mtm.get_cluster_state()` -Shows the statusofthemultimaster 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 completedthe recovery. |
| 31 | +* liveNodes -Number of enabled nodes. |
| 32 | +* allNodes -Number of nodesin the cluster.Themajority of alive nodesis calculatedbased onthis parameter. |
| 33 | +* nActiveQueries -Number of queries being currently processed on this node. |
| 34 | +* nPendingQueries -Number of querieswaiting for execution on this node. |
| 35 | +* queueSize -Size ofthependingqueryqueue, in bytes. |
| 36 | +* transCount -Thetotalnumber of replicated transactions processed by this node. |
| 37 | +* timeShift -Global snapshotshift caused by unsynchronized clocks on nodes,in microseconds. |
| 38 | +* recoverySlot -The node from which a failednodegets data updates during automatic recovery. |
| 39 | +* xidHashSize -Size of xid2state hash. |
| 40 | +* gidHashSize -Size of gid2state hash. |
| 41 | +* oldestXid -Theoldesttransaction ID on this node. |
| 42 | +* configChanges -Number of state changes (enabled/disabled) since the last reboot. |
| 43 | +* stalledNodeMask -Bitmask of nodes for which replicationslots were dropped. |
| 44 | +* stoppedNodeMask -Bitmask of nodes that were stopped by`mtm.stop_node()`. |
| 45 | +* lastStatusChange -Timestamp of thelast state change. |
46 | 46 |
|
47 | 47 |
|
48 | 48 | ##Node management functions
|
|