Tracking the Database Restore and Replication Status

Mashery Local slave node registration process provides a status endpoint that helps to track the asynchronous steps of database restore and replication status. However, these steps are processed in the background, so there is no active feedback on completion or failure of processes.
Note: The status endpoint (registration_status.py) is an experimental API and is subject to change in later implementations.

There is no need to Enable API Access on the node for this endpoint to function. See Configuring OAuth 2.0 API Access.

To obtain the database restore and replication status, type the URL of the endpoint in your browser. For example: https://<Mashery_Local_Slave_IP>:5480/service/mashery/cgi/replication_status.py

The endpoint returns the following JSON:
{
  "replication_status": 
  {
    "restore": {
               "error": false,
               "errors": "",
               "log": "1. transfer backup from master\nMon Aug 22 18:38:04 UTC       
                       2016\n\n2. unzip backup\nMon Aug 22 18:38:41 UTC 2016\n\n3.  
                       stop slave\nSlave stopped\nMon Aug 22 18:38:41 UTC 
                       2016\n\n4. restore from backup\nMon Aug 22 20:36:18 UTC 
                       2016\n\n5. start slave\nSlave started\nMon Aug 22 20:36:18 
                       UTC 2016\n\n6. done\nMon Aug 22 20:36:18 UTC 2016\n\n",
               "complete": true
               },
  "replication": {
                 "last_error": "",
                 "seconds_behind_master": "250832\n",
                 "slave_io_running": "Yes\n",
                 "slave_sql_running": "Yes\n"
                 }
  },
  "error": null
}
The following table provides details about the JSON that is returned by the status endpoint:
JSON Node Value in JSON Description
Database restore log

replication_status.restore.log

Provides database restore log.

replication_status.restore.complete

true

Implies that the database restore step is done.

false

Implies that the database restore step is not complete.

replication_status.restore.error

true

Implies that there are errors during the process. Refer to the replication_status.restore.errors node to get more details for the errors.

false

Implies that there are errors during the process.

Database replication status

replication_status.replication

Provides replication-specific information from “show slave status”.

replication_status. replication.last_error

<error>

Provides the details for the errors (if any).

replication_status.replication. seconds_behind_master

<time in milliseconds>

Provides an estimate of how long it takes the slave node to catch up to the master.

replication_status.replication.slave_io_running or replication_status.replication.slave_sql_running

No

Yes

Replication is not running and last_error provides the details for the errors (if any).

Replication starts, seconds_behind_master provides an estimate of how long it takes the slave node to catch up to the master.

Note: When the restore step is in process, replication is disabled. Therefore, the value of slave_io_running and slave_sql_running is No.