Check replication status
On a switch with a hot stand-by server, the database is replicated from the leader host to the follower host. These methods tell you whether replication is on, which hosts take part and how far the follower lags behind. Use them in your monitoring. Only the root customer may call them.
The methods support trusted mode with i_customer.
getReplicationStatus
Section titled “getReplicationStatus”Returns the replication setup and whether it is healthy.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_environment |
int | yes | Environment to check |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
replication_enabled |
boolean | True when replication is on |
master |
string | The leader host |
slave |
string | The follower host |
replication_ok |
boolean | True when there is no replication lag |
Example
Section titled “Example”call("getReplicationStatus", {"i_environment": 1}){ "result": "OK", "replication_enabled": True, "master": "192.0.2.10", "slave": "192.0.2.11", "replication_ok": True,}getReplicationLag
Section titled “getReplicationLag”Returns the replication lag, measured in two ways.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_environment |
int | yes | Environment to check |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
st_lag_time |
string | Lag reported by the replication engine |
replication_test_lag |
string | Lag measured with a test record written on the leader and read on the follower |
Example
Section titled “Example”call("getReplicationLag", {"i_environment": 1}){"result": "OK", "st_lag_time": "00:00:02", "replication_test_lag": "00:00:01"}Related
Section titled “Related”- Get monitoring graphs: Hot Stand-by DB Size
- List environments