Replication#
This section describes the following API operations that are supported for replication.
Create replica#
POST /{version}/{accountId}/instances
Creates a replica of the source instance, as specified by the value of the
replica_of
attribute.
This operation asynchronously provisions a replica for the specified source
database instance. This call requires the user to specify a flavor and a
volume size. It also requires specifying the source database instance using
the replica_of
attribute. The service then provisions the replica with
the requested flavor and sets up a volume of the specified size.
Note
The replica will be created with the default configuration. If you wish to apply the same configuration as the source database instance or another configuration, you will need to apply that configuration to the replica. Refer to Update database instance for details.
Since the process of creating a replica makes a backup behind the scenes, the user calling the Create replica operation will need access to Cloud Files.
Warning
Adding a replica will restart the MySQL service on the source database
instance. The state of the source instance switches to RESTART
for this
period and back to ACTIVE
when service restart completes.
Note
You can create only one database instance per
POST
request.You can create a database instance with one or more databases, and users associated to those databases.
The default binding for the database instance is port 3306.
When used with the
restorePoint
attribute, this call performs the Restore Backup operation, creating a new database instance to store the backup.For information about using SSL with your database instance, refer to Using SSL for Cloud Database instances.
The following table lists the required and optional attributes for Create replica:
Applies To
Name
Description
Required
Instance
flavorRef
Reference (href) to a flavor as specified in the response from the List Flavors API call. This is the actual URI as specified by the href field in the link. Refer to the List Flavors response examples that follow for an example of the flavorRef. Note: Rather than the flavor URI, you can also pass the flavor id (integer) as the value for flavorRef. Refer to List flavors for details.
Yes
(volume) size
Specifies the volume size in gigabytes (GB). The value specified must be between 1 and 300.
Yes
name
Name of the instance to create. The length of the name is limited to 255 characters and any characters are permitted
No
replica_of
Identifier of the source instance to replicate.
Yes
configuration
Identifier of the configuration group to associate with the instance.
No
(datastore) version / type
Name or uuid of the datastore version and type to associate with the instance. If the datastore is not specified, it defaults to mysql.
No
Database
name
Specifies database names for creating databases on instance creation. Refer to Create database for the required json format.
No
character_set
Set of symbols and encodings. The default character set is
utf8
.No
collate
Set of rules for comparing characters in a character set. The default value for collate is
utf8_general_ci
.No
User
name
Specifies user name for the database on instance creation. Refer to Create user for the required json format.
No
password
Specifies password for those users on instance creation. Refer to Create user for the required json format.
No
(database) name
Specifies names of databases that those users can access on instance creation. Refer to Create user for the required json format.
No
host
Specifies the host from which a user is allowed to connect to the database. Possible values are a string containing an IPv4 address or “%” to allow connecting from any host. Refer to User access restriction by host for details. If
host
is not specified, it defaults to “%”.No
Restore
restorePoint
Specifies the backup id from which to restore the database instance. Note: When you execute the Restore Backup operation, a new database instance is created to store the backup whose id is specified by the
restorePoint
attribute. All users/passwords/access that were on the instance at the time of the backup will be restored along with the databases. You can create new users or databases if you want, but they cannot be the same as the ones from the instance that was backed up. Refer to the Create Database Instance Restore Request and Response examples for the required json format and details.No
Refer to Database instance status for a list of possible database instance statuses that may be returned.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
200 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
Example Create replica: JSON request
The following example shows the Create replica request:
POST /v1.0/1234/instances HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
{
"instance": {
"volume": {
"size": 1
},
"flavorRef": "9",
"name": "t2s1_ALT_GUEST",
"replica_of": "6bdca2fc-418e-40bd-a595-62abda61862d"
}
}
Response#
Example Create replica: JSON response
The following example shows the Create replica response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 697
Date: Thu, 13 Feb 2014 21:47:17 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
{
"instance": {
"status": "BUILD",
"updated": "2014-10-14T18:42:15",
"name": "t2s1_ALT_GUEST",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/5919009/instances/8367c312-7c40-4a66-aab1-5767478914fc",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/8367c312-7c40-4a66-aab1-5767478914fc",
"rel": "bookmark"
}
],
"created": "2014-10-14T18:42:15",
"id": "8367c312-7c40-4a66-aab1-5767478914fc",
"volume": {
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/5919009/flavors/9",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"replica_of": {
"id": "6bdca2fc-418e-40bd-a595-62abda61862d",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/5919009/instances/6bdca2fc-418e-40bd-a595-62abda61862d",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/6bdca2fc-418e-40bd-a595-62abda61862d",
"rel": "bookmark"
}
]
}
}
}
For convenience, notice in the response example above that resources contain
links to themselves. This allows a client to easily obtain resource URIs rather
than to construct them. There are two kinds of link relations associated with
resources. A self
link contains a versioned link to the resource. These
links should be used in cases where the link will be followed immediately. A
bookmark
link provides a permanent link to a resource that is appropriate
for long term storage.
List all replicas and replica source database instances#
GET /{version}/{accountId}/instances
Lists the status and information for all replicas and replica sources.
This operation lists the status and information for all replicas and replica sources.
Refer to Database instance status for a list of possible database instance statuses that may be returned.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
200 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
This table shows the query parameters for the request:
Name |
Type |
Description |
---|---|---|
include_replicas |
String (Optional) |
When
|
This operation does not accept a request body.
Example List all replicas and replica source database instances: JSON request
The following example shows the List all replicas and replica sources request:
GET /v1.0/1234/instances HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
Example List all instances/replica sources and filter out replicas: JSON request
The following example shows the List all instances/replica sources and filter out replicas request:
GET /v1.0/1234/instances?include_replicas=false HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
GET /v1.0/1234/instances HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
Response#
Example List all replicas and replica source database instances: JSON response
The following example shows the List all replicas or replica sources response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 697
Date: Thu, 13 Feb 2014 21:47:17 GMT
Server: Jetty(8.0.y.z-SNAPSHOT
{
"instances": [
{
"status": "ACTIVE",
"name": "slave1",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel": "bookmark"
}
],
"ip": [
"10.0.0.3"
],
"id": "1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"volume": {
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"replica_of": {
"id": "df9e5206-cc95-4131-9ea4-f928c99f1aec",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "bookmark"
}
]
}
},
{
"status": "ACTIVE",
"name": "slave2",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel": "bookmark"
}
],
"ip": [
"10.0.0.4"
],
"id": "3ac8641f-293d-4533-ab7a-9be25070b98f",
"volume": {
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"replica_of": {
"id": "df9e5206-cc95-4131-9ea4-f928c99f1aec",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "bookmark"
}
]
}
},
{
"status": "ACTIVE",
"name": "master1",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel": "bookmark"
}
],
"replicas": [
{
"id": "1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"name": "slave1",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel": "bookmark"
}
]
},
{
"id": "3ac8641f-293d-4533-ab7a-9be25070b98f",
"name": "slave2",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel": "bookmark"
}
]
}
],
"ip": [
"10.0.0.2"
],
"id": "df9e5206-cc95-4131-9ea4-f928c99f1aec",
"volume": {
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel": "self"
},
{
"href": "https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
}
}
]
}
Example List all instances/replica sources and filter out replicas: JSON response
The following example shows the List all instances/replica sources and filter out replicas response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 697
Date: Thu, 13 Feb 2014 21:47:17 GMT
Server: Jetty(8.0.y.z-SNAPSHOT
{
"instances":[
{
"status":"ACTIVE",
"name":"master1",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"bookmark"
}
],
"replicas":[
{
"id":"1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"name":"slave1",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel":"bookmark"
}
]
},
{
"id":"3ac8641f-293d-4533-ab7a-9be25070b98f",
"name":"slave2",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel":"bookmark"
}
]
}
],
"ip":[
"10.0.0.2"
],
"id":"df9e5206-cc95-4131-9ea4-f928c99f1aec",
"volume":{
"size":1
},
"flavor":{
"id":"9",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel":"bookmark"
}
]
},
"datastore":{
"version":"5.6",
"type":"mysql"
}
}
]
}
List replica source#
GET /{version}/{accountId}/instances/{instanceId}
Lists status and details for a specified replica source instance.
This operation lists the status and details of the specified replica source instance. The operation also lists the configuration group id/name if the running instance has been associated with a configuration group.
This operation lists the volume size in gigabytes (GB) and the approximate GB used.
Note
After instance creation, the used
size of your volume will be greater
than 0. This is expected and due to the automatic creation of non-empty
transaction logs for database optimization. The used
attribute is not
returned in the response when the status for the instance is BUILD, REBOOT,
RESIZE, or ERROR.
Refer to Database instance status for a list of possible database instance statuses that may be returned.
The list operations return a DNS-resolvable hostname associated with the database instance instead of an IP address. Since the hostname always resolves to the correct IP address of the database instance, this relieves the user from the task of maintaining the mapping. Note that although the IP address may likely change on resizing, migrating, and so forth, the hostname always resolves to the correct database instance.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
200 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
{instanceId} |
String |
The instance ID for the specified database instance. |
This operation does not accept a request body.
Example List replica source: JSON request
The following example shows the List replica source request:
GET /v1.0/1234/instances/8b499b45-52d6-402d-b398-f9d8f279c69a HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
Response#
Example List replica source: JSON response
The following example shows the List replica source response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 718
Date: Thu, 13 Feb 2014 21:47:15 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
{
"instance": {
"status": "ACTIVE",
"updated": "2014-09-26T19:15:57",
"name": "t1_ALT_GUEST",
"links": [
{
"href": " https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/8b499b45-52d6-402d-b398-f9d8f279c69a",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/instances /8b499b45-52d6-402d-b398-f9d8f279c69a",
"rel": "bookmark"
}
],
"created": "2014-09-26T19:15:50",
"ip": [
"10.0.0.2"
],
"replicas": [
{
"id": "3c691f06-bf9a-4618-b7ec-2817ce0cf254",
"links": [
{
"href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances /3c691f06-bf9a-4618-b7ec-2817ce0cf254",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/instances /3c691f06-bf9a-4618-b7ec-2817ce0cf254",
"rel": "bookmark"
}
]
}
],
"id": "8b499b45-52d6-402d-b398-f9d8f279c69a",
"volume": {
"used": 0.54,
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": “https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
}
}
}
List replica details#
GET /{version}/{accountId}/instances/{instanceId}
Lists status and details for a specified replica.
This operation lists the status and details of the specified replica. The operation also lists the configuration group id/name if the running instance has been associated with a configuration group.
This operation lists the volume size in gigabytes (GB) and the approximate GB used.
Note
After instance creation, the used
size of your volume will be greater
than 0. This is expected and due to the automatic creation of non-empty
transaction logs for database optimization. The used
attribute is not
returned in the response when the status for the instance is BUILD, REBOOT,
RESIZE, or ERROR.
Refer to Database instance status for a list of possible database instance statuses that may be returned.
The list operations return a DNS-resolvable hostname associated with the database instance instead of an IP address. Since the hostname always resolves to the correct IP address of the database instance, this relieves the user from the task of maintaining the mapping. Note that although the IP address may likely change on resizing, migrating, and so forth, the hostname always resolves to the correct database instance.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
200 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
{instanceId} |
String |
The instance ID for the specified database instance. |
This operation does not accept a request body.
Example List replica details: JSON request
The following example shows the List replica details request:
GET /v1.0/1234/instances/1131f914-571c-4cd1-a5e5-0c2235eaa66f HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
Response#
Example List replica details: JSON response
The following example shows the List replica details response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 718
Date: Thu, 13 Feb 2014 21:47:15 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
{
"instance": {
"status": "ACTIVE",
"updated": "2014-10-21T19:54:55",
"name": "t1s1_ALT_GUEST",
"links": [
{
"href": " https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances /1131f914-571c-4cd1-a5e5-0c2235eaa66f",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/instances /1131f914-571c-4cd1-a5e5-0c2235eaa66f",
"rel": "bookmark"
}
],
"created": "2014-10-21T19:54:00",
"ip": [
"10.0.0.3"
],
"id": "1131f914-571c-4cd1-a5e5-0c2235eaa66f",
"volume": {
"used": 0.06,
"size": 1
},
"flavor": {
"id": "9",
"links": [
{
"href": " https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors /9",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/flavors /9",
"rel": "bookmark"
}
]
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"replica_of": {
"id": "8215d522-d66a-479b-83c0-fbacc5dd05fc",
"links": [
{
"href": "https https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances /8215d522-d66a-479b-83c0-fbacc5dd05fc",
"rel": "self"
},
{
"href": " https://ord.databases.api.rackspacecloud.com/instances /8215d522-d66a-479b-83c0-fbacc5dd05fc",
"rel": "bookmark"
}
]
}
}
}
Detach replica#
PATCH /{version}/{accountId}/instances/{instanceId}
Detaches the specified replica instance from its replication source instance.
This operation detaches the specified replica instance from its replication source instance. This call requires the user to specify id of the replica instance to detach.
Note
Detaching a replica will change the database instance status to DETACH_REPLICA. The status will change back to ACTIVE once the replica is completely detached from the source and is no longer a replica.
The following table lists the required attributes for Detach replica:
Applies To |
Name |
Description |
Required |
---|---|---|---|
Instance |
replica_of |
Identifier of the source instance to replicate. |
Yes |
Refer to Database instance status for a list of possible database instance statuses that may be returned.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
202 |
Accepted |
The request has been accepted for processing. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
{instanceId} |
String |
The instance ID for the specified database instance. |
Example Detach replica: JSON request
The following example shows the Detach replica request:
PATCH /v1.0/1234/instances/d4603f69-ec7e-4e9b-803f-600b9205576f HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
{
"instance": {
"replica_of": ""
}
}
Response#
Example Detach replica: JSON response
The following example shows the Detach replica response:
HTTP/1.1 202 Accepted
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 0
Date: Tue, 21 Oct 2014 21:47:15 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
List replicas for source instance#
GET /{version}/{accountId}/instances/{instanceId}/replicas
Lists replicas for a specified source instance.
This operation lists replicas for a specified source instance.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
200 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
{instanceId} |
String |
The instance ID for the specified database instance. |
This operation does not accept a request body.
Example List replicas for source instance: JSON request
The following example shows the List replicas for source instance request:
GET /v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec/replicas HTTP/1.1
User-Agent: python-troveclient
Host: ord.databases.api.rackspacecloud.com
X-Auth-Token: 87c6033c-9ff6-405f-943e-2deb73f278b7
Accept: application/json
Content-Type: application/json
Response#
Example List replicas for source instance: JSON response
The following example shows the List replicas for source instance response:
HTTP/1.1 200 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 718
Date: Thu, 13 Feb 2014 21:47:15 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
{
"instances":[
{
"status":"ACTIVE",
"name":"replica1",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"rel":"bookmark"
}
],
"ip":[
"10.0.0.3"
],
"id":"1b1fc872-00bb-4fc7-894f-b02e83609ae6",
"volume":{
"size":1
},
"flavor":{
"id":"9",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel":"bookmark"
}
]
},
"datastore":{
"version":"5.6",
"type":"mysql"
},
"replica_of":{
"id":"df9e5206-cc95-4131-9ea4-f928c99f1aec",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"bookmark"
}
]
}
},
{
"status":"ACTIVE",
"name":"replica2",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/3ac8641f-293d-4533-ab7a-9be25070b98f",
"rel":"bookmark"
}
],
"ip":[
"10.0.0.4"
],
"id":"3ac8641f-293d-4533-ab7a-9be25070b98f",
"volume":{
"size":1
},
"flavor":{
"id":"9",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/9",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/flavors/9",
"rel":"bookmark"
}
]
},
"datastore":{
"version":"5.6",
"type":"mysql"
},
"replica_of":{
"id":"df9e5206-cc95-4131-9ea4-f928c99f1aec",
"links":[
{
"href":"https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"self"
},
{
"href":"https://ord.databases.api.rackspacecloud.com/instances/df9e5206-cc95-4131-9ea4-f928c99f1aec",
"rel":"bookmark"
}
]
}
}
]
}
Convert replication setup to HA#
POST /{version}/{accountId}/instances/{instanceId}/action
Converts the replication setup to HA. The specified instance_Id can be the source or replica ID.
This operation converts the replication setup to HA.
The following table lists the required and optional attributes for Convert replication setup to HA:
Name |
Description |
Required |
---|---|---|
name |
Specifies the name of the HA instance. The length should be limited to 255 characters and any characters are permitted. |
Yes |
networks |
Comma-separated list of networks to be associated with the HA group. For example: {“networks”:[“public”,“servicenet”]} Notes:
|
No |
acls |
Comma separated list of IP based ACLs in the CIDR format. This is required to allow the HA group access to the specified IP. By default, the HA group access is blocked. For eg: “acls”: [{“address”: “10.0.0.0/0”}, {“address”: “1.2.3.4/5”}]. Additionally, if it is not specified while creating the HA group, it can be added later. Refer to Add ACLs to an HA instance for details. |
No |
Note
By default the replication setup is asynchronous. But for an HA setup, the replication setup is changed to semi-synchronous.
While the source/replicas are being prepared for HA conversion, the instances switch to a
CONVERT_TO_HA
state.If a source/replica has automated backups enabled, the schedule will be converted to an HA group automated backup schedule with the source id set to the HA id. The day, hour, and minute settings will be the same as the source or replica schedule.
Important: Once the HA instance is ACTIVE, to be able to switch to using the HA cluster, use the new hostname with the appropriate port type to connect to the source/replicas as specified in the HA Group details. This hostname will remain constant in case of a source failure and replica promotion. ACLs will also let you explicitly add an IP that would require access to this HA group. For more details for an HA group refer to High availability.
This table shows the possible response codes for this operation:
Response Code |
Name |
Description |
---|---|---|
202 |
Success |
Request succeeded. |
400 |
Bad Request |
The request is missing one or more elements, or the values of some elements are invalid. |
401 |
Unauthorized |
You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 |
Forbidden |
You are denied access to the requested resource. |
404 |
Not Found |
The requested item was not found. |
405 |
badMethod |
The specified method is not allowed for the given resource. |
413 |
Over Limit |
The number of items returned is above the allowed limit. |
422 |
unprocessableEntity |
The item cannot be processed. |
500 |
instanceFault |
The instance has experienced a fault. |
501 |
notImplemented |
The server does not support the functionality required to fulfill the request. |
503 |
Service Unavailable |
The service is not available. |
Request#
This table shows the URI parameters for the request:
Name |
Type |
Description |
---|---|---|
{accountId} |
String |
The account ID of the owner of the specified instance. |
{instanceId} |
String |
The specified instance_Id, which can be the source or replica ID. |
Example Convert replication setup to HA: JSON request
The following example shows the Convert replication setup to HA request:
POST /v1.0/1234/instances/e0b922ad-a054-40b3-aa3e883201ba79fe/action HTTP/1.1
User-Agent: python-troveclient
Host: iad.databases.api.rackspacecloud.com
X-Auth-Token: e3b2c743aebf467fb6b91cbb644c036e
Accept: application/json
Content-Type: application/json
{
"convert_to_ha": {
"acls": [
{
"address": "10.0.0.0\/0"
}
],
"name": "ha-convert-1"
}
}
Response#
Example Convert replication setup to HA: JSON response
The following example shows the Convert replication setup to HA response:
HTTP/1.1 202 OK
Content-Type: application/json
Via: 1.1 Repose (Repose/2.6.7)
Content-Length: 697
Date: Thu, 13 Feb 2014 21:47:17 GMT
Server: Jetty(8.0.y.z-SNAPSHOT)
{
"ha_instance": {
"name": "ha-convert-1",
"replicas": [
{
"status": "ACTIVE",
"name": "replica-1",
"links": {},
"schedule": {
"enabled": false
},
"hostname": "d95798bb5c9581e8c5d432eecf16aa01e26dc26d.rackspaceclouddb.com",
"id": "f65bae37-f7ff-42e9-a8dd-0177eb127773",
"volume": {
"size": 1
},
"ha_id": "65640327-64dd-4fd0-80b3-1f64e66e0558",
"flavor": {
"id": "2",
"links": {}
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"replica_of": {
"id": "e0b922ad-a054-40b3-aa3e-883201ba79fe",
"links": [
{
"href": "https://iad.databases.api.rackspacecloud.com/v1.0/938359/instances/e0b922ad-a054-40b3-aa3e-883201ba79fe",
"rel": "self"
},
{
"href": "https://iad.databases.api.rackspacecloud.com/instances/e0b922ad-a054-40b3-aa3e-883201ba79fe",
"rel": "bookmark"
}
]
}
}
],
"tenant_id": "938359",
"replica_source": [
{
"status": "ACTIVE",
"name": "master-1",
"links": {},
"replicas": [
{
"id": "f65bae37-f7ff-42e9-a8dd-0177eb127773",
"links": [
{
"href": "https://iad.databases.api.rackspacecloud.com/v1.0/938359/instances/f65bae37-f7ff-42e9-a8dd-0177eb127773",
"rel": "self"
},
{
"href": "https://iad.databases.api.rackspacecloud.com/instances/f65bae37-f7ff-42e9-a8dd-0177eb127773",
"rel": "bookmark"
}
],
"name": "replica-1"
}
],
"hostname": "44e777cb84ecd231528e140c05b8bfb09b5e5c72.rackspaceclouddb.com",
"schedule": {
"enabled": false
},
"id": "e0b922ad-a054-40b3-aa3e-883201ba79fe",
"volume": {
"size": 1
},
"flavor": {
"id": "2",
"links": {}
},
"datastore": {
"version": "5.6",
"type": "mysql"
},
"ha_id": "65640327-64dd-4fd0-80b3-1f64e66e0558"
}
],
"networks": [],
"state": "BUILD",
"acls": [
{
"address": "10.0.0.0/0"
}
],
"datastore": {
"version": "5.6",
"type": "mysql"
},
"id": "65640327-64dd-4fd0-80b3-1f64e66e0558"
}
}
For convenience, notice in the response example above that resources contain
links to themselves. This allows a client to easily obtain resource URIs rather
than to construct them. There are two kinds of link relations associated with
resources. A self
link contains a versioned link to the resource. These
links should be used in cases where the link will be followed immediately. A
bookmark
link provides a permanent link to a resource that is appropriate
for long term storage.