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
- 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. - Reset the counter value of
cluster_restart_disconnect
to 0 to indicate that the cluster is in healthy state currently.
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 |
|
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 |
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
Note:
Replace the value of<base-uri>
in the REST URL with <db-monitor-svc
service name>.<namespace>:8080
.
$ 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 |
|
|
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 |
|
|
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 |
|
|
http://<base-uri> /ocdbtier/version
|
This API provides the cnDBTier version.
Service Type: Realtime. This API provides real time data. |
GET | NA |
|
|
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 |
|
|
http://<base-uri> /ocdbtier/statistics/report/dbinfo
|
This API provides database statistic reports.
Service Type: Realtime. This API provides real time data. |
GET | NA |
|
|
http://<base-uri> /ocdbtier/heartbeat/status
|
This API provides the overall HeartBeat
Status.
Service Type: Realtime. This API provides real time data. |
GET | NA |
|
|
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 |
|
|
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>" } |
|
|
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 |
|
|
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:
|
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 |
|
|
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 |
|
|
http://<base-uri> /ocdbtier/list/clusterdetails
|
This API provides the cnDBTier cluster
details.
Service Type: Realtime. This API provides real time data. |
GET | NA |
|
|
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 |
|
|
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 |
|
|
|
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 |
|
|
http://<base-uri> /ocdbtier/faultrecovery/start
|
This PAI is used to start georeplication
recovery.
Service Type: Realtime. This API provides real time data. |
PUT | { "backupClusterName": "<backup cluster name>", "failedClusterName": "<failed cluster name>" } |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
This API is used to get the cnDBTier NDB backup
status.
Service Type: Realtime. This API provides real time data. |
GET | NA |
|
|
Note:
Replace the value of<base-uri>
in the URL with <db-backup-manager-svc
svc>: 8080
.
- 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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
Note:
The value of<base-uri>
in the REST URL is <db-replication-svc
Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>
.
- 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}
- Run the following command to get the LoadBalancer IP of
the replication service for
cluster1:
- When HTTPS is enabled in a cnDBTier cluster:
- Create the key PEM file (file.key.pem) and cert PEM file (file.crt.pem) using the p12 certificate (replicationcertificate.p12). Use the same p12 certificate that was used to enable the HTTPS while installing cnDBTier.
- 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 file.crt.pem --cert-type PEM --key file.key.pem --key-type PEM --pass PUT NextGenCne 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 |
|
|
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 |
|
|
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 |
|
|
Note:
- Run the
Stop Switchover
API before running theStop Replica
API else, if you stop the replica without first stopping the switchover, a switchover will still occur afterwards, resulting in the replication channel not being stopped. - The value of
<base-uri>
in the REST URL is<db-replication-svc Loadbalancer IP>: <db-replication-svc Loadbalancer PORT>
.
- 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}
- Run the following command to get the LoadBalancer IP of
the replication service for
cluster1:
- When HTTPS is enabled in a cnDBTier cluster:
- Create the key PEM file (file.key.pem) and cert PEM file (file.crt.pem) using the p12 certificate (replicationcertificate.p12). Use the same p12 certificate that was used to enable the HTTPS while installing cnDBTier.
- 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 file.crt.pem --cert-type PEM --key file.key.pem --key-type PEM --pass NextGenCne 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 |
|
|
Note:
The value of<base-uri>
in the REST URL is
<db-replication-svc Loadbalancer IP>: <db-replication-svc
Loadbalancer PORT>
.
- 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
- Run the following command to get the replication service
LoadBalancer IP for
cluster1:
- When HTTPS is enabled in a cnDBTier cluster:
- Create the key PEM file (file.key.pem) and cert PEM file (file.crt.pem) using the p12 certificate (replicationcertificate.p12). Use the same p12 certificate that was used to enable the HTTPS while installing cnDBTier.
- 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 file.crt.pem --cert-type PEM --key file.key.pem --key-type PEM --pass NextGenCne https://$IP:$PORT/db-tier/backup/site/cluster1/listbackups
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 |
|
|
Note:
The value of<base-uri>
in the REST URL is
<db-replication-svc Loadbalancer IP>: <db-replication-svc
Loadbalancer PORT>
.
- 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
- Run the following command to get the replication service
LoadBalancer IP for
cluster1:
- When HTTPS is enabled in a cnDBTier cluster:
- Create the key PEM file (file.key.pem) and cert PEM file (file.crt.pem) using the p12 certificate (replicationcertificate.p12). Use the same p12 certificate that was used to enable the HTTPS while installing cnDBTier.
- 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 file.crt.pem --cert-type PEM --key file.key.pem --key-type PEM --pass NextGenCne https://$IP:$PORT/db-tier/status/db-replication-svc/realtime
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 |
|
|
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 |
|
|
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 |
|
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 |
|
|
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 |
|
|
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 |
|
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 |
|
|
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 |
|
|
Note:
The value ofbase-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