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 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-1 cnDBTier APIs for CNC Console
Resource | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Site specific real time replication status | http://<base-uri> /ocdbtier/status/replication/realtime/{remoteSiteName}
|
GET | NA |
|
|
Realtime |
Real time overall replication status | http://<base-uri> /ocdbtier/status/replication/realtime
|
GET | NA |
|
|
Realtime |
Real time local cluster status | http://<base-uri> /ocdbtier/status/cluster/local/realtime
|
GET | NA |
|
|
Realtime |
cnDBTier version | http://<base-uri> /ocdbtier/version
|
GET | NA |
|
|
Realtime |
List completed backups of the current site | http://<base-uri> /ocdbtier/list/backups
|
GET | NA |
|
|
Realtime |
Database Statistic Reports | http://<base-uri> /ocdbtier/statistics/report/dbinfo
|
GET | NA |
|
|
Realtime |
Overall HeartBeat Status | http://<base-uri> /ocdbtier/heartbeat/status
|
GET | NA |
|
|
Realtime |
On-demand Backup | http://<base-uri> /ocdbtier/on-demand/backup/initiate
|
GET | NA |
|
|
Realtime |
Initiate on-demand backup | http://<base-uri> /ocdbtier/on-demand/backup/initiate
|
POST | { "siteName": "<current_site_name>", "drStatus": "<drStatus>", "backupId": "<backupId>", "backupStatus": "<backupStatus>", "remoteTransferStatus": "<remoteTransferStatus>", "initiateBackup":false/true, "transferStatus": "<transferStatus>" } |
|
|
Realtime |
Health status of replication service | http://<base-uri> /ocdbtier/health-info/replication-svc/status
|
GET | NA |
|
|
Realtime |
Health status of monitor service |
http://<base-uri> /ocdbtier/health-info/monitor-svc/status
|
GET | NA | 200 OK (Monitor Service is healthy) | 200
OK:
|
Realtime |
Overall health status of NDB data service | http://<base-uri> /ocdbtier/health-info/ndb-svc/status
|
GET | NA |
|
|
Realtime |
Health status of backup manager service | http://<base-uri> /ocdbtier/health-info/backup-mgr-svc/status
|
GET | NA |
|
|
Realtime |
cnDBTier Cluster Details |
http://<base-uri> /ocdbtier/list/clusterdetails
|
GET | NA |
|
|
Realtime |
Get Failed cnDBTier Clusters | http://<base-uri> /ocdbtier/markcluster/failed
|
GET | NA |
|
|
Realtime |
Mark cnDBTier Clusters As Failed | http://<base-uri> /ocdbtier/markcluster/failed
|
PUT |
|
|
|
Realtime |
Monitor Georeplication Recovery Status | http://<base-uri> /ocdbtier/faultrecovery/status
|
GET | NA |
|
|
Realtime |
Start Georeplication Recovery | http://<base-uri> /ocdbtier/faultrecovery/start
|
PUT | { "backupClusterName": "<backup cluster name>", "failedClusterName": "<failed cluster name>" } |
|
|
Realtime |
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.2 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-2 cnDBTier Backup API
Resource | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Site Specific On-demand Backup Creation | http://<base-uri> /db-tier/on-demand/backup/initiate
|
POST | NA |
|
|
Realtime |
Site Specific On-demand Backup Status | http://<base-uri> /db-tier/on-demand/backup/<BACKUP_ID_INITIATED>/status
|
GET | NA |
|
|
Realtime |
Health Check | http://<base-uri> /db-tier/health
|
GET | NA |
|
|
Realtime |
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.3 cnDBTier Replication Service APIs
This section provides details about cnDBTier replication service APIs.
4.3.1 cnDBTier Switchover APIs
cnDBTier Switchover APIs are used to start or stop switchovers on replication services.
Table 4-3 cnDBTier Switchover APIs
Resource | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Start replication switchover for a site with respect to remote site and group ID | http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} | PUT | NA |
|
|
Realtime |
Stop replication switchover for a site with respect to remote site and group ID | http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} | PUT | NA |
|
|
Realtime |
Start replication switchover for a site with respect to remote site name | http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName}/remotesitename/{remoteSiteName} | PUT | NA |
|
|
Realtime |
Stop replication switchover for a site with respect to remote site name | http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName}/remotesitename/{remoteSiteName} | PUT | NA |
|
|
Realtime |
Start replication switchover with respect to site name | http://<base-uri>/ocdbtier/georeplication/switchover/start/sitename/{siteName} | PUT | NA |
|
|
Realtime |
Stop replication switchover for a site with respect to site name | http://<base-uri>/ocdbtier/georeplication/switchover/stop/sitename/{siteName} | PUT | NA |
|
|
Realtime |
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.3.2 cnDBTier Stop Replica APIs
cnDBTier Stop Replica APIs are used to stop a replication channel.
Table 4-4 cnDBTier Stop Replica APIs
Resource | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Stop replication on a site with respect to remote site name and replication channel group ID | http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName}/remotesitename/{remoteSiteName}/replchannelgroupid/{replChannelGroupId} | PUT | NA |
|
|
Realtime |
Stop replication on a site with respect to remote site names | http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName}/remotesitename/{remoteSiteName} | PUT | NA |
|
|
Realtime |
Stop replica on a site with respect to site name | http://<base-uri>/ocdbtier/georeplication/stopreplica/sitename/{siteName} | PUT | NA |
|
|
Realtime |
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/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.3.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-5 cnDBTier Listbackups API
cnDBTier Listbackups API | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Site Specific Listing the Backups | http://<base-uri>/db-tier/backup/site/{siteName}/listbackups | GET | NA |
|
|
Realtime |
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.3.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-6 cnDBTier Replication Service Heartbeat API
cnDBTier Replication Service Heartbeat API | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Site Specific Listing the Heartbeat Status | http://<base-uri>/db-tier/status/db-replication-svc/realtime | GET | NA |
|
|
Realtime |
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.4 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-7 cnDBTier Status API
cnDBTier Status API | Rest URL | HTTP Method | Request Payload | Response Code | Response Payload | Service Type |
---|---|---|---|---|---|---|
Site Specific Real Time Replication Status | http://<base-uri>/db-tier/status/replication/{mate-site-name}/realtime | GET | NA |
|
|
Realtime |
Real Time Overall Replication Status | http://<base-uri>/db-tier/status/replication/realtime | GET | NA |
|
|
Realtime |
Local Cluster Status | http://<base-uri>/db-tier/status/local | GET | NA |
|
NA | CachedNote: This API is deprecated and will be removed in a future release. |
Site Specific Replication Status | http://<base-uri>/db-tier/status/replication/{mate-site-name} | GET | NA |
|
|
CachedNote: This API is deprecated and will be removed in a future release. |
Overall Replication Status | http://<base-uri>/db-tier/status/replication | GET | NA |
|
|
CachedNote: This API is deprecated and will be removed in a future release. |
Real Time Local Cluster Status | http://<base-uri>/db-tier/status/cluster/local/realtime | GET | NA |
|
NA | Realtime |
Database Statistics Reports API | http://<base-uri>/db-tier/statistics/dbinfo | GET | NA |
|
|
Realtime |
cnDBTier Version | http://<base-uri>/db-tier/version | GET | NA |
|
|
Realtime |
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