4 cnDBTier APIs

This chapter describes the APIs used in cnDBTier and their parameters.

Note:

The "occne-cndbtier" namespace name used in this section is only an example. Ensure that you configure the namespace name according to your environment.

4.1 cnDBTier Cluster Events APIs

cnDBTier cluster events APIs are used to retrieve or update the following details about a cnDBTier cluster:
  • Retrieve information about the events that occur in a cluster. The following table provides information about the cluster events:

    Table 4-1 Cluster Event Types

    Cluster Event Description
    START This event is recorded when the cluster is installed.
    RESTART This event is recorded when the cluster is restarted after the cluster is disconnected and started.
    RESTORE This event is recorded when the cluster is restored from the backup during Georeplication.
    RE_SYNC This event is recorded when the cluster is synced after the cluster is restored and georeplication channels are established, and after all the data is synced from remote sites after the restore is performed.
    FAILURE This event is recorded when the cluster is in failed state.
    CHECKPOINT This event is recorded when the database is completely restored from the remote site, from this timestamp, it means that the database is in sync with remote sites until other restarts.
    UNAVAILABLE_GRR_RESTORE_IN_PROGRESS This event is returned when the Geo Replication Recovery is in progress in this cluster.
    UNAVAILABLE_GRR_RESTORE_FAILED This event is returned when the Geo Replication Recovery is Failed in this cluster.
    UNAVAILABLE_UNKNOWN This event is returned when the Site is marked as Failed and Geo Replication Recovery is not started in the cluster.
  • Reset the counter value of cluster_restart_disconnect to 0 to indicate that the cluster is in healthy state currently.
These details can be used to determine if there is a data loss due to the events in a cluster. These APIs are hosted by the DB monitor service.

Table 4-2 cnDBTier Cluster Events APIs

Rest API URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/db-tier/reset/parameter/cluster_restart_disconnect This API is used to reset the counter value of cluster_restart_disconnect to zero in the current cluster to indicate that the cluster is currently healthy.

Service Type: Realtime. This API provides real time data.

POST NA
  • 200 OK Successfully Updated cluster_restart_disconnect to 0.
  • 500 INTERNAL SERVER ERROR - failed to reset cluster_restart_disconnect.
NA
http://<base-uri>/db-tier/reset/cluster/{cluster-name}/parameter/cluster_restart_disconnect This API is used to reset the counter value of cluster_restart_disconnect to zero in the specified cluster to indicate that the cluster is currently healthy.

Service Type: Realtime. This API provides real time data.

POST NA
  • 200 OK Successfully Updated cluster_restart_disconnect to 0.
  • 404 Not Found - The cluster name has not been configured.
  • 500 INTERNAL SERVER ERROR - failed to reset cluster_restart_disconnect.
NA
http://<base-uri>/db-tier/cluster/status This API is used to retrieve the timestamps of the events from the current cluster along with details of the latest event that occurred in the cluster.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Successfully fetched the cluster status with the last event occurred.
  • 500 INTERNAL SERVER ERROR - Unable to fetch cluster status with the last event occurred.
{
  "clusterName": "<cluster name>",
  "currentTS": "<current timestamp in UTC format>",
  "lastStartTS": "<last start Time Stamp if present else blank>",
  "lastRestoreTS": "<last restore Time Stamp if present else blank>",
  "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
  "lastRestartTS": "<last Restart Time Stamp if present else blank>",

  "lastFailureTS": "<last Failure Time Stamp if present else blank>",
  "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
  "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
  "clusterDisconnectCount": "<Cluster Disconnect Count>",
  "eventsList": [
    {
      "eventType": "<event Type>",
      "eventTS": "<Time Stamp at which event occurred>"
    }
  ],
  "remoteSitesMonitorTS": [
    {
      "clusterName": "<cluster name>",
      "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
    },
    {
      "clusterName": "<cluster name>",
      "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
    }
  ]
}
http://base-uri/db-tier/cluster/status/events/{numberOfLastEvents} This API is used to retrieve the timestamps of the events from the current cluster along with details of the specified number of latest events that occurred in the cluster.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK: Successfully fetched the cluster status with the last the last <numberOfLastEvents> events occurred.
  • 400 BAD REQUEST - If {numberOfLastEvents} exceeds the configured max count which is by default 10
  • 500 INTERNAL SERVER ERROR: Unable to fetch cluster status with the last event occurred.
{
  "clusterName": "<cluster name>",
  "currentTS": "<current timestamp in UTC format>",
  "lastStartTS": "<last start Time Stamp if present else blank>",
  "lastRestoreTS": "<last restore Time Stamp if present else blank>",
  "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
  "lastRestartTS": "<last Restart Time Stamp if present else blank>",

  "lastFailureTS": "<last Failure Time Stamp if present else blank>",
  "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
  "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
  "clusterDisconnectCount": "<Cluster Disconnect Count>",
  "eventsList": [
    {
      "eventType": "<event Type>",
      "eventTS": "<Time Stamp at which event occurred>"
    },

    {
      "eventType": "<event Type>",
      "eventTS": "<Time Stamp at which event occurred>"
    }
  ],
  "remoteSitesMonitorTS": [
    {
      "clusterName": "<cluster name>",
      "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
    },
    {
      "clusterName": "<cluster name>",
      "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
    }
  ]
}
http://<base-uri>/db-tier/all/cluster/status/ This API is used to retrieve the timestamps of events from all the clusters along with details of the latest event occurred in the clusters.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Successfully fetched the cluster status with the last event occurred.
  • 500 INTERNAL SERVER ERROR - Unable to fetch cluster status with the last event occurred.
[
    {
    
      "clusterName": "<cluster name>",
      "currentTS": "<current timestamp in UTC format>",
      "lastStartTS": "<last start Time Stamp if present else blank>",
      "lastRestoreTS": "<last restore Time Stamp if present else blank>",
      "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
      "lastRestartTS": "<last Restart Time Stamp if present else blank>",

      "lastFailureTS": "<last Failure Time Stamp if present else blank>",
      "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
      "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
      "clusterDisconnectCount": "<Cluster Disconnect Count>",
      "eventsList": [
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        }
      ],
      "remoteSitesMonitorTS": [
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        },
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        }
      ]
    },
    
    
    {
      "clusterName": "<cluster name>",
      "currentTS": "<current timestamp in UTC format>",
      "lastStartTS": "<last start Time Stamp if present else blank>",
      "lastRestoreTS": "<last restore Time Stamp if present else blank>",
      "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
      "lastRestartTS": "<last Restart Time Stamp if present else blank>",

      "lastFailureTS": "<last Failure Time Stamp if present else blank>",
      "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
      "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
      "clusterDisconnectCount": "<Cluster Disconnect Count>",
      "eventsList": [
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        }
      ],
      "remoteSitesMonitorTS": [
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        },
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        }
      ]
    }
]
http://<base-uri>/db-tier/all/cluster/status/events/{numberOfLastEvents} This API is used to retrieve the timestamps of events from all the clusters along with details of the specified number of latest events that occurred in the clusters.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK: Successfully fetched the cluster status with the last the last <numberOfLastEvents> events occurred.
  • 400 BAD REQUEST - If {numberOfLastEvents} exceeds the configured max count which is by default 10.
  • 500 INTERNAL SERVER ERROR: Unable to fetch cluster status with the last event occurred.
[
    {
    
      "clusterName": "<cluster name>",
      "currentTS": "<current timestamp in UTC format>",
      "lastStartTS": "<last start Time Stamp if present else blank>",
      "lastRestoreTS": "<last restore Time Stamp if present else blank>",
      "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
      "lastRestartTS": "<last Restart Time Stamp if present else blank>",

      "lastFailureTS": "<last Failure Time Stamp if present else blank>",
      "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
      "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
      "clusterDisconnectCount": "<Cluster Disconnect Count>",
      "eventsList": [
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        },
    
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        }
      ],
      "remoteSitesMonitorTS": [
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        },
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        }
      ]
    },
    
    
    {
      "clusterName": "<cluster name>",
      "currentTS": "<current timestamp in UTC format>",
      "lastStartTS": "<last start Time Stamp if present else blank>",
      "lastRestoreTS": "<last restore Time Stamp if present else blank>",
      "lastDBResyncTS": "<last DB Resync Time Stamp if present else blank>",
      "lastRestartTS": "<last Restart Time Stamp if present else blank>",

      "lastFailureTS": "<last Failure Time Stamp if present else blank>",
      "lastCheckpointTS": "<last Checkpoint Time Stamp if present else blank>",
      "lastMonitorPollTS": "<last Monitor Poll Time Stamp if present else blank>",
      "clusterDisconnectCount": "<Cluster Disconnect Count>",
      "eventsList": [
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        },
    
        {
          "eventType": "<event Type>",
          "eventTS": "<Time Stamp at which event occurred>"
        }
      ],
      "remoteSitesMonitorTS": [
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        },
        {
          "clusterName": "<cluster name>",
          "monitorTS": "<Last Monitor Time Stamp for the cluster If present else blank>"
        }
      ]
    }
]

Note:

Replace the value of <base-uri> in the REST URL with <db-monitor-svc service name>.<namespace>:8080.
Refer to the following examples to use these REST APIs to update or retrieve the cluster details:
$ curl -X POST http://<base-uri>/db-tier/reset/parameter/cluster_restart_disconnect
$ curl -X POST http://<base-uri>/db-tier/reset/cluster/{cluster-name}/parameter/cluster_restart_disconnect
$ curl -X GET http://<base-uri>/db-tier/cluster/status 
$ curl -X GET http://<base-uri>/db-tier/cluster/status/events/{numberoflastevents} 
$ curl -X GET http://<base-uri>/db-tier/all/cluster/status 
$ curl -X GET http://<base-uri>/db-tier/all/cluster/status/events/{numberoflastevents} 

4.2 cnDBTier APIs for CNC Console

cnDBTier APIs facilitate CNC Console to determine the status of cnDBTier and the associated cross-site replication. The DB replication service hosts these APIs.

Table 4-3 cnDBTier APIs for CNC Console

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/ocdbtier/status/replication/realtime/{remoteSiteName} This API provides site-specific replication status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Fetched the list of backups present in cnDBTier.
  • 400 Bad Request
  • 404 Not Found
  • 500 Internal Server Error.
  • 503 Service Unavailable - Cross-site replication is not enabled.
  • 200 OK:
    {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
      "replicationGroupDelay": [
        {
          "replchannel_group_id": "1",
          "secondsBehindRemote": <seconds>,
          "channelDetails": [
            {
              "remote_replication_ip": "127.0.0.1",
              "role": "ACTIVE"
            },
            {
              "remote_replication_ip": "127.0.0.2",
              "role": "STANDBY"
            }
          ]
        },
        {
          "replchannel_group_id": "2",
          "secondsBehindRemote": <seconds>,
          "channelDetails": [
            {
              "remote_replication_ip": "127.0.0.3",
              "role": "ACTIVE"
            },
            {
              "remote_replication_ip": "127.0.0.4",
              "role": "STANDBY"
            }
          ]
        }
      ]
    }
  • 400 Bad Request:
    {
      "title": "Bad Request",
      "status": 400,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 503 Service Unavailable - Cross-site replication is not enabled:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/status/replication/realtime This API provides the overall replication status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Cross-site replication is active
  • 500 Internal Server Error
  • 503 Service Unavailable - Cross-site replication is not enabled
  • 200 OK - Cross-site replication is active:
    {
     [
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
          "replicationGroupDelay":
         [{
             replchannel_group_id: 1,
             secondsBehindRemote: <seconds>
          },
          {
             replchannel_group_id: 2,
             secondsBehindRemote: <seconds>
         }]
       },
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
          "replicationGroupDelay":
         [{
             replchannel_group_id: 1,
             secondsBehindRemote: <seconds>
          },
          {
             replchannel_group_id: 2,
             secondsBehindRemote: <seconds>
         }]
       }
     ]
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 503 Service Unavailable - Cross-site replication is not enabled:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/status/cluster/local/realtime This API provides the local cluster status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK- The local NDB cluster is UP or DOWN
  • 500 Internal Server Error
  • 200 OK- The local NDB cluster is UP or DOWN:
    {
      "clusterName":"<current-cluster-name>",
      "clusterStatus":"UP/DOWN"
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
     "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/version This API provides the cnDBTier version.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 500 Internal Server Error
  • 200 OK:
    {
      "cndbtier_version": "25.1.201",
      "ndb_version": "ndb-8.4.3"
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
     "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/list/backups This API provides the list of backups completed in the current site.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Fetched the Heart Beat Status of every replication service running on the current cluster
  • 404 NOT FOUND Table Missing
  • 500 Internal Server Error
  • 200 OK:
    {
      "localSiteName": "<current_site_name>",
      "backupDetails": [
        {
          "backupId": "<backup identifier>",
          "backupSize": "<size of backup>",
          "creationTimeStamp": "<timestamp at which backup was initiated>"
        },
        {
          "backupId": "<backup identifier>",
          "backupSize": "<size of backup>",
          "creationTimeStamp": "<timestamp at which backup was initiated>"
        },
        {
          "backupId": "<backup identifier>",
          "backupSize": "<size of backup>",
          "creationTimeStamp": "<timestamp at which backup was initiated>"
        }
      ]
    }
  • 404 NOT FOUND Table Missing:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "DBTIER_BACKUP_INFO table doesn't exist in the current site so cannot list the backup",
      "cause": null,
      "invalidParams": null
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "Could not list the backups",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/statistics/report/dbinfo This API provides database statistic reports.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 500 INTERNAL_SERVER_ERROR
  • 503 SERVICE_UNAVAILABLE
  • 200 OK:
    {
      "databaseCount": <database count>,
      "databaseTablesCount": [
        {
          "dbName": "<database name>",
          "tableCount": <table count>
        },
        {
          "dbName": "<database name>",
          "tableCount": <table count>
        }
    
      ],
      "databaseTableRowsCount": [
        {
          "dbName": "<database name>",
          "tables": [
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            }
          ]
        },
        {
          "dbName": "<database name>",
          "tables": [
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            },
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            }
          ]
        }
      ]
    
    }
  • 500 INTERNAL_SERVER_ERROR:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "<Exception Details>",
      "cause": null,
      "invalidParams": null
    }
  • 503 SERVICE_UNAVAILABLE:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "<Exception details>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/heartbeat/status This API provides the overall HeartBeat Status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 503 SERVICE_UNAVAILABLE - Not able to query the Database
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The HeartBeat Status
  • 200 OK:
    {
      "heartBeatDetails": [
        {
          "remoteSiteName": "<remote_site_name>",
          "heartBeatStatus": "<SUCCESS/FAILURE>",
          "heartBeatLag": "<Heart Beat Lag in Seconds>",
          "replicationChannelGroupId": <replication channel group id>
        },
        {
          "remoteSiteName": "<remote_site_name>",
          "heartBeatStatus": "<SUCCESS/FAILURE>",
          "heartBeatLag": "<Heart Beat Lag in Seconds>",
          "replicationChannelGroupId": <replication channel group id>
        }
      ],
      "siteName": "<current_site_name>", }
  • 503 SERVICE_UNAVAILABLE - Not able to query the Data Base:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "Not able to query the Data Base",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The HeartBeat Status:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "Could Not Check The HeartBeat Status",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/on-demand/backup/initiate This API initiates an on-demand backup.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 404 NOT FOUND
  • 500 INTERNAL_SERVER_ERROR
  • 200 OK:
    {
        "siteName": "<current_site_name>",
        "drStatus": "<drStatus>",
        "backupId": "<backupId>",
        "backupStatus": "<backupStatus>",
        "remoteTransferStatus": "<remoteTransferStatus>",
        "initiateBackup": false/true,
        "transferStatus": "<transferStatus>"
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL_SERVER_ERROR:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "<Exception message>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/on-demand/backup/initiate This API initiates on-demand backup as per the provided requirements.

Service Type: Realtime. This API provides real time data.

POST { "siteName": "<current_site_name>", "drStatus": "<drStatus>", "backupId": "<backupId>", "backupStatus": "<backupStatus>", "remoteTransferStatus": "<remoteTransferStatus>", "initiateBackup":false/true, "transferStatus": "<transferStatus>" }
  • 200 OK
  • 400 BAD REQUEST
  • 404 NOT FOUND
  • 500 INTERNAL_SERVER_ERROR
  • 200 OK:
    {
      "siteName": "<current_site_name>",
      "drStatus": "<drStatus>",
      "backupId": "<backupId>",
      "backupStatus": "<backupStatus>",
      "remoteTransferStatus": "<remoteTransferStatus>",
      "initiateBackup": false/true,
      "transferStatus": "<transferStatus>"
    }
  • 404 BAD REQUEST:
    {
      "title": "Bad Request",
      "status": 400,
      "detail": "Couldn't initiate the backup when initiateBackup flag is set to false",
      "cause": null,
      "invalidParams": [
        {
          "param": "initiateBackup",
          "reason": "Couldn't initiate the backup when initiateBackup flag is set to false"
        }
      ]
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL_SERVER_ERROR:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "BACKUP_INITIATION_FAILED",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/health-info/replication-svc/status This API provides the health status of the replication service.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 503 SERVICE_UNAVAILABLE - Replication Service IP is empty
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Replication Health Status
  • 200 OK:
    {
        "localSiteName": "<siteName>",
        "healthStatusDetails": [
            {
                "serviceName": "<serviceName>",
                "serviceStatus": "UP/DOWN",
                "connectionToDbStatus": "UP/DOWN",
                "overAllReplicationServiceHealth": "UP/DOWN"
            },
            {
                "serviceName": "<serviceName>",
                "serviceStatus": "UP/DOWN",
                "connectionToDbStatus": "UP/DOWN",
                "overAllReplicationServiceHealth": "UP/DOWN"
            }.......
        ]
    }
  • 503 SERVICE_UNAVAILABLE - Replication Service IP is empty:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "Replication Service IP is empty",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Replication Health Status:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "Could Not Check The Health Status",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/health-info/monitor-svc/status This API provides the health status of monitor service.

Service Type: Realtime. This API provides real time data.

GET NA 200 OK (Monitor Service is healthy) 200 OK:
{
  "serviceName": "mysql-cluster-db-monitor-svc",
  "connectionToDbStatus": "UP",
  "metricScrapeStatus": "UP",
  "overAllMonitorServiceHealth": "UP"
}
http://<base-uri>/ocdbtier/health-info/ndb-svc/status This API provides the overall health status of NDB data service.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 404 NOT FOUND - sitename not found
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Health Status
  • 200 OK:
    {
        "localSiteName": "<siteName>",
        "ndbHealthStatusDetails": [
            {
                "serviceName": "<serviceName>",
                "serviceStatus": "UP/DOWN",
                "pvcHealthStatus": "UP/DOWN"
            },
            {
                "serviceName": "<serviceName>",
                "serviceStatus": "UP/DOWN",
                "pvcHealthStatus": "UP/DOWN"
            }.......
        ]
    }
  • 404 NOT FOUND - sitename not found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "sitename not found",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Health Status:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "Could Not Check The Health Status",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/health-info/backup-mgr-svc/status This API provides the health status of the backup manager service.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Health Status
  • 200 OK:
    {
      "serviceName": "mysql-cluster-db-backup-manager-svc",
      "connectionToDbStatus": "UP",
      "serviceStatus": "UP",
      "backupExecutorHealthStatus": [
        {
          "nodeId": 2,
          "connectionToDbStatus": "UP"
        },
        {
          "nodeId": 1,
          "connectionToDbStatus": "UP"
        }
      ],
      "overAllBackupManagerHealth": "UP"
    }
  • 500 INTERNAL_SERVER_ERROR - Could Not Check The Health Status:
    {
      "title": "Internal Server Error",
      "status": 500,
      "detail": "Could Not Check The Health Status",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/list/clusterdetails This API provides the cnDBTier cluster details.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 404 NOT FOUND
  • 500 INTERNAL SERVER ERROR
  • 200 OK:
    [
      {
        "clusterName": "<clusterName>",
        "clusterId": "1",
        "status": "ACTIVE/FAILED"
      },
      {
        "clusterName": "<clusterName>",
        "clusterId": "2",
        "status": "ACTIVE/FAILED"
      },
      {
        "clusterName": "<clusterName>",
        "clusterId": "3",
        "status": "ACTIVE/FAILED"
      }
    ]
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "title": "INTERNAL_SERVER_ERROR",
      "status": 500,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/markcluster/failed This API fetches information about failed cnDBTier clusters.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 404 NOT FOUND
  • 500 INTERNAL SERVER ERROR
  • 200 OK:
    {
      "clusterNameTobeMarkedAsFailed": "",
      "failedClusterNames": [
        "<failedcluster1>",
        "<failedcluster2>"
      ]
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "title": "INTERNAL_SERVER_ERROR",
      "status": 500,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/markcluster/failed This API is used to mark cnDBTier clusters as Failed.

Service Type: Realtime. This API provides real time data.

PUT
{
  "clusterNameTobeMarkedAsFailed": "<failedcluster>",
  "failedClusterNames": []
}
  • 200 OK
  • 400 BAD REQUEST
  • 404 NOT FOUND
  • 500 INTERNAL SERVER ERROR
  • 503 SERVICE_UNAVAILABLE
  • 200 OK:
    {
      "clusterNameTobeMarkedAsFailed": "",
      "failedClusterNames": [
        "<failedcluster1>",
        "<failedcluster2>"
      ]
    }
  • 400 BAD REQUEST:
    {
      "title": "BAD_REQUEST",
      "status": 400,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "title": "INTERNAL_SERVER_ERROR",
      "status": 500,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 503 SERVICE_UNAVAILABLE:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/faultrecovery/status This API is used to monitor the status of georeplication recovery.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 404 NOT FOUND
  • 500 INTERNAL SERVER ERROR
  • 200 OK:
    {
      "localClusterName": "<local cluster name>",
      "faultRecoverStatus": [
        {
          "clusterName": "<clusterName>",
          "faultRecoverState": "<faultRecoverState>"
        },
        {
          "clusterName": "<clusterName>",
          "faultRecoverState": "<faultRecoverState>"
        },
        {
          "clusterName": "<clusterName>",
          "faultRecoverState": "<faultRecoverState>"
        }
      ]
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "title": "INTERNAL_SERVER_ERROR",
      "status": 500,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
http://<base-uri>/ocdbtier/faultrecovery/start This API is used to start georeplication recovery.

Service Type: Realtime. This API provides real time data.

PUT { "backupClusterName": "<backup cluster name>", "failedClusterName": "<failed cluster name>" }
  • 200 OK
  • 400 BAD REQUEST
  • 404 NOT FOUND
  • 409 CONFLICT
  • 500 INTERNAL SERVER ERROR
  • 503 SERVICE_UNAVAILABLE
  • 200 OK:
    {
        "backupClusterName": "<backup cluster name>",
        "failedClusterName": "<failed cluster name>"
    }
  • 400 BAD REQUEST:
    {
      "title": "INVALID INPUT",
      "status": 400,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 404 NOT FOUND:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 409 CONFLICT:
    {
      "title": "Conflict",
      "status": 409,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "title": "INTERNAL_SERVER_ERROR",
      "status": 500,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
  • 503 SERVICE_UNAVAILABLE:
    {
      "title": "Service Unavailable",
      "status": 503,
      "detail": "<Error message>",
      "cause": null,
      "invalidParams": null
    }
http://base-uri/ocdbtier/backup/status This API is used to to check the status of NDB backup.

Service Type: Realtime. This API provides real time data.

GET Not Applicable
  • 200 OK
  • 500 INTERNAL SERVER ERROR
  • 200 OK
    {
      "currentTimestamp":"<current timestamp",
       "isNdbBackupInProgress":true/false,
       "nextBackupScheduleTime":"<next backup scheduled time>"
    }
  • 500 INTERNAL SERVER ERROR
    {
      "title": "Internal Server Error",
      "status": 500,
     "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }

Note:

Replace the value of <base-uri> in the URL with <db-monitor-svc service name>.<namespace>:8080.

For example: curl http://mysql-cluster-db-monitor-svc.occne-cndbtier:8080/ocdbtier/status/replication/realtime

4.3 cnDBTier Backup APIs

cnDBTier backup APIs are used to create on-demand database backups and check the status of the backups in cnDBTier. The cnDBTier backup API is hosted by the DB backup manager service.

Table 4-4 cnDBTier Backup API

Rest URL   HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/db-tier/on-demand/backup/initiate This API is used to initiate site-specific on-demand backup creation.

Service Type: Realtime. This API provides real time data.

POST NA
  • 200 OK - Successfully started the on-demand backup
  • 400 BAD REQUEST request is invalid
  • 409 CONFLICT backup is already going on
  • 500 INTERNAL SERVER ERROR - Could not initiate on-demand backup.
  • 503 SERVICE UNAVAILABLE data node is down
  • 200 OK:
    {
      "backup_id":"<Backup id>",
      "status":"<Backup Initiation Status>"
      "backup_encryption_flag": "<backup encryption enabled/disabled>"
    }
  • 400 BAD REQUEST request is invalid:
    {
      "backup_id":"",
      "status":"BACKUP_INITIATION_FAILED"
      "backup_encryption_flag": "true/false"
    }
  • 409 CONFLICT backup is already going on:
    {
      "backup_id":"",
      "status":"BACKUP_INITIATION_FAILED"
      "backup_encryption_flag": "true/false"
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "error_type":"<error type>",
      "error_message":"<error message>"
    }
  • 503 SERVICE UNAVAILABLE data node is down:
    {
      "backup_id":"",
      "status":"BACKUP_INITIATION_FAILED"
      "backup_encryption_flag": "true/false"
    }
http://<base-uri>/db-tier/on-demand/backup/<BACKUP_ID_INITIATED>/status This API is used to get site-specific on-demand backup status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Successfully started the on-demand backup
  • 400 BAD REQUEST Request is invalid
  • 404 NOT FOUND backup_id does not exist
  • 500 INTERNAL SERVER ERROR - Could not check the status for the specified on-demand backup ID
  • 200 OK:

    Response payload when .Values.global.remotetransfer.enable is set to true:

    
    {
      "backup_status":"<Backup status>",
      "transfer_status":"<Transfer Status>"
    }

    Note: The "transfer_status" parameter in the response payload indicates the backup transfer status from db-backup-manager-svc to db-replication-svc and not to the remote server.

    Response payload when .Values.global.remotetransfer.enable is set to false:
    {
       "status": "<Backup status>"
    }
  • 400 BAD REQUEST Request is invalid:
    {
      "error_description": "<error_description>",
      "error_type": "<error type>"
    }
  • 404 NOT FOUND backup_id does not exist:
    {
      "error_description": "<error_description>",
      "error_type": "<error type>"
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "error_type":"<error type>",
      "error_message":"<error message>"
    }
http://<base-uri>/db-tier/health This API is used to perform a cnDBTier health check.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 500 INTERNAL SERVER ERROR
  • 200 OK:
    {
        "is_connected_to_db": "<true|false>", 
        "overall_status": "<true|false>",
        "service_name": "<mysql-cluster-db-backup-manager-svc>"
        "executor_status_list": 
        [
            {
                "_node_id": "<node_id>",
                "_is_connected_to_db": "<true|false>",
                "_is_running": "<true|false>"
            },
            ...
        ]
    }
  • 500 INTERNAL SERVER ERROR:
    {
      "error_type":"<error type>",
      "error_message":"<error message>"
    }
This API is used to get the cnDBTier NDB backup status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK
  • 500 INTERNAL SERVER ERROR
  • 200 OK:
    {
      "isNdbBackupInProgress": "<true if an NDB backup is in progress; otherwise, false>",
      "nextBackupScheduleTime": "<UTC timestamp for the next scheduled routine backup>",
      "currentTimestamp": "<Current UTC timestamp from the NDB cluster>"
    }
    
  • 500 INTERNAL SERVER ERROR:
    Not able to fetch Current NDB Backup Status

Note:

Replace the value of <base-uri> in the URL with <db-backup-manager-svc svc>: 8080.
For example,
  • Run the following command to get the db-backup-manager-svc pod name from cnDBTier cluster:
    $ kubectl -n <namespace of cnDBTier cluster> get pods | grep "db-backup-manager-svc" | awk  '{print $1}'
  • Run the following command get the db-backup-manager-svc svc name from cnDBTier cluster:
    $ kubectl -n <namespace of cnDBTier cluster> get svc | grep "db-backup-manager-svc" | awk  '{print $1}'
    
  • Run the following commands to login to the db-backup-manager-svc pod, use the REST APIs to create an on-demand backup, and check the backup status:
    $ kubectl -n <namespace of cnDBTier cluster> exec -it <db-backup-manager-svc pod> -- bash
    $ curl -i -X POST http://<db-backup-manager-svc svc>:8080/db-tier/on-demand/backup/initiate
    $ curl -i -X GET http://<db-backup-manager-svc svc>:8080/db-tier/on-demand/backup/<BACKUP_ID_INITIATED>/status

4.4 cnDBTier Replication Service APIs

This section provides details about cnDBTier replication service APIs.

4.4.1 cnDBTier Switchover APIs

cnDBTier Switchover APIs are used to start or stop switchovers on replication services.

Table 4-5 cnDBTier Switchover APIs

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} This API is used to start replication switchover for a site with respect to remote site and group ID.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"start"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} This API is used to stop replication switchover for a site with respect to remote site and group ID.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"stop"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName}/remotesitename/{remoteSiteName} This API is used to start replication switchover for a site with respect to remote site name.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"start"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName}/remotesitename/{remoteSiteName} This API is used to stop replication switchover for a site with respect to remote site name.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"stop"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName} This API is used to start replication switchover with respect to site name.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"start"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName} This API is used to stop replication switchover for a site with respect to site name.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "replicationSwitchOver":"stop"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }

Note:

The value of <base-uri> in the REST URL is <db-replication-svc Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>.
Depending on your scenario, choose one of the following methods to obtain the LoadBalancer IP and LoadBalancer Port of the replication service in a cnDBTier cluster:
  • When HTTP is enabled in a cnDBTier cluster:
    • Run the following command to get the LoadBalancer IP of the replication service for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the LoadBalancer Port of the replication service for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1)
    • Sample command to call the REST API:
      $ curl -X PUT http://$IP:$PORT/ocdbtier/georeplication/switchover/start/sitename/{siteName}
  • When HTTPS is enabled in a cnDBTier cluster:
    • Obtain the client certificate which is present in the secret configured in "/global/https/secrets/clientSecret". For example, client-cert.pem and client-key.pem.
    • Obtain the CA certificate which is present in the secret configured by user in "/global/https/secrets/caSecret" for example, combine-ca.pem.
    • Run the following command to get the LoadBalancer IP of the replication service for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the LoadBalancer Port of the replication service for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl --cert client-cert.pem --cert-type PEM --key client.key.pem --key-type PEM --cacert combine-ca.pem -X https://$IP:$PORT/ocdbtier/georeplication/switchover/start/sitename/{siteName}

4.4.2 cnDBTier Stop Replica APIs

cnDBTier Stop Replica APIs are used to stop a replication channel.

Table 4-6 cnDBTier Stop Replica APIs

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} This API is used to stop replication on a site with respect to remote site name and replication channel group ID.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "stopReplica":"stop"
    }  
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName}/remotesitename/{remoteSiteName} This API is used to stop replication on a site with respect to remote site names.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "stopReplica":"stop"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
       "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName} This API is used to stop replica on a site with respect to site name.

Service Type: Realtime. This API provides real time data.

PUT NA
  • 200 OK
  • 404 Not Found
  • 500 Internal Server Error
  • 200 OK:
    {
       "stopReplica":"stop"
    } 
  • 404 Not Found:
    {
      "title": "Not Found",
      "status": 404,
      "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }
  • 500 Internal Server Error:
    {
      "title": "Internal Server Error",
      "status": 500,
     "detail": "<Exception details>",
      "cause": <cause>,
      "invalidParams": <params>
    }

Note:

  • This section provides only the definition of the Stop Replica API. If you want to stop the replication between the sites, follow the procedure given in the "Stopping cnDBTier Georeplication Service" section in Oracle Communications Cloud Native Core, cnDBTier User Guide.
  • The value of <base-uri> in the REST URL is <db-replication-svc Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>.
Depending on your scenario, choose one of the following methods to obtain the LoadBalancer IP and LoadBalancer Port of the replication service in a cnDBTier cluster:
  • When HTTP is enabled in a cnDBTier cluster:
    • Run the following command to get the LoadBalancer IP of the replication service for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the LoadBalancer Port of the replication service for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl -X PUT http://$IP:$PORT/ocdbtier/georeplication/stopreplica/sitename/{siteName}
  • When HTTPS is enabled in a cnDBTier cluster:
    • Obtain the client certificate which is present in the secret configured in "/global/https/secrets/clientSecret". For example, client-cert.pem and client-key.pem.
    • Obtain the CA certificate which is present in the secret configured in "/global/https/secrets/caSecret". For example, combine-ca.pem.
    • Run the following command to get the LoadBalancer IP of the replication service for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the LoadBalancer Port of the replication service for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl --cert client-cert.pem --cert-type PEM --key client.key.pem --key-type PEM -cacert combine-ca.pem -X PUT https://$IP:$PORT/ocdbtier/georeplication/stopreplica/sitename/{siteName}

4.4.3 cnDBTier Listbackups API

cnDBTier Listbackups API is used to determine the backups present in the cnDBTier. The cnDBTier Listbackups API is hosted by the DB Replication service.

Table 4-7 cnDBTier Listbackups API

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/db-tier/backup/site/{siteName}/listbackups This API is used to list site-specific backups.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Fetched the list of backups present in cnDBTier.
  • 404 Not Found - Improper Site details or missing table.
  • 503 INTERNAL SERVER ERROR - Could not list the backups.
  • 200 OK:
    {
      "localSiteName":"<current_site_name>",
      "backupDetails":[
        {
          "backupId":"<backup>",
          "backupSize":"<size of backup>",
          "creationTimeStamp":"<timestamp at which backup was initiated>"
        },
        {
          "backupId":"<backup_id>",
          "backupSize":"<size of backup>",
          "creationTimeStamp":"<timestamp at which backup was initiated>"
        },
        {
          "backupId":"<backup_id>",
          "backupSize":"<size of backup>",
          "creationTimeStamp":"<timestamp at which backup was initiated>"
        }
      ]
    }
  • 404 Not Found: The response payload can be one of the following:
    • Site Name is null so cannot list the backup
    • Site: <siteName> doesn't match with the current site Name so cannot list the backup
    • DBTIER_BACKUP_INFO table doesn't exist in the current site so cannot list the backup
  • 503 INTERNAL SERVER ERROR: Could not list the backups, <Exception Message>

Note:

The value of <base-uri> in the REST URL is <db-replication-svc Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>.
Depending on your scenario, refer to the following points to obtain the LoadBalancer IP and LoadBalancer Port of a cnDBTier cluster:
  • When HTTP is enabled in a cnDBTier cluster:
    • Run the following command to get the replication service LoadBalancer IP for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the replication service LoadBalancer Port for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl -i -X GET http://$IP:$PORT/db-tier/backup/site/cluster1/listbackups
  • When HTTPS is enabled in a cnDBTier cluster:
    • Obtain the client certificate which is present in the secret configured in "/global/https/secrets/clientSecret". For example, client-cert.pem and client-key.pem.
    • Obtain the CA certificate which is present in the secret configured in "/global/https/secrets/caSecret". For example, combine-ca.pem.
    • Run the following command to get the replication service LoadBalancer IP for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the replication service LoadBalancer Port for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl --cert client-cert.pem --cert-type PEM --key client.key.pem --key-type PEM -cacert combine-ca.pem -X PUT https://$IP:$PORT/ocdbtier/georeplication/stopreplica/sitename/{siteName}

4.4.4 cnDBTier Replication Service Heartbeat API

cnDBTier Replication Service Heartbeat API is used to provide the Heartbeat statuses of all replication services running on the current cluster.

Table 4-8 cnDBTier Replication Service Heartbeat API

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/db-tier/status/db-replication-svc/realtime This API is used to list site-specific heartbeat status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Fetched the heartbeat status of each replication service running on the current cluster.
  • 503 SERVICE_UNAVAILABLE - Not able to query the database
  • 503 INTERNAL SERVER ERROR - Could not check the replication service status.
  • 200 OK:
    {
      "localSiteName":"<current_site_name>",
      "heartBeatDetails":[
        {
          "remoteSiteName":"<remote_site_name>",
          "heartBeatStatus":"<SUCCESS/FAILURE>",
          "heartBeatLag":"<Heart Beat Lag in Seconds>",
          "replicationChannelGroupId":<replication channel group id>
        },
        {
          "remoteSiteName":"<remote_site_name>",
          "heartBeatStatus":"<SUCCESS/FAILURE>",
          "heartBeatLag":"<Heart Beat Lag in Seconds>",
          "replicationChannelGroupId":<replication channel group id>
        }
      ]
    }
  • 503 SERVICE_UNAVAILABLE:

    Not able to query the Data Base

  • 500 INTERNAL_SERVER_ERROR:

    Could not check the replication service status, <Exception Message>

Note:

The value of <base-uri> in the REST URL is <db-replication-svc Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>.
Depending on your scenario, refer to the following points to obtain the LoadBalancer IP and LoadBalancer Port of a cnDBTier cluster:
  • When HTTP is enabled in a cnDBTier cluster:
    • Run the following command to get the replication service LoadBalancer IP for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the replication service LoadBalancer Port for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl -i -X GET http://$IP:$PORT/db-tier/status/db-replication-svc/realtime
  • When HTTPS is enabled in a cnDBTier cluster:
    • Obtain the Client certificate which is present in the secret configured by user in "/global/https/secrets/clientSecret". For Ex - client-cert.pem and client-key.pem
    • Obtain the CA certificate which is present in the secret configured in "/global/https/secrets/caSecret". For example, combine-ca.pem.
    • Run the following command to get the replication service LoadBalancer IP for cluster1:
      $ IP=$(kubectl get svc -n cluster1 | grep repl | awk '{print $4}' | head -n 1 )
    • Run the following commands to get the replication service LoadBalancer Port for cluster1:
      $ PORT=$(kubectl get svc -n cluster1 | grep repl | awk '{print $5}' |  cut -d '/' -f 1 |  cut -d ':' -f 1 | head -n 1) 
    • Sample command to call the REST API:
      $ curl --cert client-cert.pem --cert-type PEM --key client.key.pem --key-type PEM -cacert combine-ca.pem -X PUT https://$IP:$PORT/ocdbtier/georeplication/stopreplica/sitename/{siteName}

4.5 cnDBTier Status APIs

cnDBTier Status APIs enable the NF applications to determine the status of cnDBTier and the associated cross-site replication. The DB Monitor service hosts the cnDBTier Status APIs.

Table 4-9 cnDBTier Status API

Rest URL Description HTTP Method Request Payload Response Code Response Payload
http://<base-uri>/db-tier/status/replication/{mate-site-name}/realtime This API is used to get site-specific replication status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Cross-site replication is enabled.
  • 400 Bad Request.
  • 404 Not Found - The indicated mate site has not been configured.
  • 503 Service Unavailable - Cross-site replication is not enabled and/or DOWN.
  • 200 OK:
    {
         "replicationStatus": "UP"    
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
         "replicationGroupDelay":
         [{
             replchannel_group_id: 1,
             secondsBehindRemote: <seconds>
          },
          {
             replchannel_group_id: 2,
             secondsBehindRemote: <seconds>
         }]
         "siteDetails":
         [{
             remote_replication_ip: 127.0.0.1,
             role: ACTIVE
          },
          {
             remote_replication_ip: 127.0.0.2,
             role: STANDBY
          }, 
          {
             remote_replication_ip: 127.0.0.2,
             role: ACTIVE
          },
          {
             remote_replication_ip: 127.0.0.3,
             role: STANDBY
         }]
    }
  • 404 Not Found: NA
  • 503 Service Unavailable: NA
http://<base-uri>/db-tier/status/replication/realtime This API is used to get the overall replication status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Cross-site replication is enabled.
  • 503 Service Unavailable - Cross-site replication is not enabled and/or DOWN.
  • 200 OK:
    {
     [
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
          "replicationGroupDelay":
         [{
             replchannel_group_id: 1,
             secondsBehindRemote: <seconds>
          },
          {
             replchannel_group_id: 2,
             secondsBehindRemote: <seconds>
         }]
       },
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
         "secondsBehindRemote": "<greater_secondsBehindRemote_of_multiplegroups_withremotesite>"
          "replicationGroupDelay":
         [{
             replchannel_group_id: 1,
             secondsBehindRemote: <seconds>
          },
          {
             replchannel_group_id: 2,
             secondsBehindRemote: <seconds>
         }]
       }
     ]
    }
    
    
  • 503 Service Unavailable: NA
http://<base-uri>/db-tier/status/local This API is used to get the local cluster status.

Service Type: Cached. This API doesn't provide real time data. This API is deprecated and will be removed in a future release.

GET NA
  • 200 OK - The local NDB cluster is available.
  • 503 Service Unavailable - The local NDB cluster is not available.
NA
http://<base-uri>/db-tier/status/replication/{mate-site-name} This API is used to get site-specific replication status.

Service Type: Cached. This API doesn't provide real time data. This API is deprecated and will be removed in a future release.

GET NA
  • 200 OK - Cross-site replication is enabled.
  • 400 Bad Request.
  • 404 Not Found - The indicated mate site has not been configured.
  • 503 Service Unavailable - Cross-site replication is not enabled and/or DOWN.
  • 200 OK:
    {
      "replicationStatus": "UP/DOWN/INITIALIZING",
    "siteDetails":[
    {
    "remote_replication_ip":"<ip>",
    "role":"ACTIVE/STANDBY/FAILED"
    },
    {
           "remote_replication_ip":"<ip>",
           "role":"STANDBY/STANDBY/FAILED"
         }
       ]
    }
  • 404 Not Found: NA
  • 503 Service Unavailable: NA
http://<base-uri>/db-tier/status/replication This API is used to get the overall replication status.

Service Type: Cached. This API doesn't provide real time data. This API is deprecated and will be removed in a future release.

GET NA
  • 200 OK - Cross-site replication is enabled.
  • 503 Service Unavailable - Cross-site replication is not enabled and/or DOWN.
  • 200 OK:
    {
     [
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
       },
       {
         "localSiteName":"<current-site-name>",
         "remoteSiteName":"<remote-site-name>",
         "replicationStatus":"UP/DOWN/INITIALIZING"
       }
     ]
    }
  • 503 Service Unavailable: NA
http://<base-uri>/db-tier/status/cluster/local/realtime This API is used to get the local cluster status.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - The local NDB cluster is available.
  • 503 Service Unavailable - The local NDB cluster is not available.
NA
http://<base-uri>/db-tier/statistics/dbinfo This API is used to get database statistics reports.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - Data is available.
  • 503 Service Unavailable - DB statistics report is empty.
  • 500 INTERNAL SERVER ERROR - Could not list DB statistics reports
  • 200 OK:
    {
      "databaseCount": <database count>,
      "databaseTablesCount": [
        {
          "dbName": "<database name>",
          "tableCount": <table count>
        },
        {
          "dbName": "<database name>",
          "tableCount": <table count>
        }
    
      ],
      "databaseTableRowsCount": [
        {
          "dbName": "<database name>",
          "tables": [
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            }
          ]
        },
        {
          "dbName": "<database name>",
          "tables": [
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            },
            {
              "tableName": "<table name>",
              "rowCount": <row count>
            }
          ]
        }
      ]
    }
  • 503 Service Unavailable: NA
  • 500 INTERNAL SERVER ERROR: NA
http://<base-uri>/db-tier/version This API is used to get the cnDBTier version.

Service Type: Realtime. This API provides real time data.

GET NA
  • 200 OK - cnDBTier version retrieved successfully.
  • 500 INTERNAL SERVER ERROR - failed to get the cnDBTier version.
  • 200 OK:
    {
      "cndbtier_version": "23.2.0",
      "ndb_version": "ndb-8.4.3"
    }
  • 500 INTERNAL SERVER ERROR:

    "failed to get version"

Note:

The value of base-uri in the table is <db-monitor-svc service name>.<namespace>:8080.

For example: curl http://mysql-cluster-db-monitor-svc.occne-cndbtier:8080/db-tier/status/replication/realtime