• Relational Database Service

  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API Calling
  5. Examples
  6. Creating Primary/Standby DB Instances (v1)

Creating Primary/Standby DB Instances (v1)

Flow Chart

The process of creating primary/standby DB instances is the same as that of creating a single DB instance. For details, see Creating a Single DB Instance (v1).

API Calling

  1. Call List Datastore Version. For details, see 1 in section API Calling.
  2. Obtain the region. For details, see 2 in section API Calling.
  3. Call List Flavor. For details, see 3 in section API Calling.
  4. Run the following command to create primary/standby DB instances.

    Define replicationMode as $replicationMode.

    curl -X POST $SERVER_URL/v1/{project_id}/instances -H "Content-Type: application/json" "X-Auth-Token: $X-Subject-Token" "X-Language: en-us" -d '{"instance": {"name": "tenant-instance-123","datastore": {"type": "MySQL","version": "$version"},"flavorRef": " $flavorId","volume": {"type": "COMMON","size": 100},"region": " $region","availabilityZone": " $availabilityZone","vpc": "$vpc ","nics": {"subnetId": "$subnetid "},"securityGroup": {"id": "bb62ffb9-a37a-4821-92b9-f9e0712e389f"},"backupStrategy": {"startTime": "01:00:00","keepDay": 3} ,"dbRtPd": "Test@123" ,"ha": {"enable": true,"replicationMode": "$replicationMode" } }}'

    Example response:

        "instance": {
            "id": "b0468a4a-5790-4a4f-8442-9030e52369e6",
            "status": "BUILD",
            "name": "tenant-instance-123",
            "created": "",
            "hostname": "",
            "type": "master",
            "region": "eu-de",
            "updated": "",
            "availabilityZone": "eu-de-01",
            "vpc": "f7513b5d-5c48-4332-8f47-a3c29c2613e7",
            "nics": {
                "subnetId": "4a7d3555-6410-4338-8859-2be61d51662a"
            "securityGroup": {
                "id": "bb62ffb9-a37a-4821-92b9-f9e0712e389f"
            "flavor": {
                "id": "bf07a6d4-844a-4023-a776-fc5c5fb71fb4"
            "volume": {
                "type": "ULTRAHIGH",
                "size": 100
            "extendparam": {
                "jobs": [
                        "id": "8a3eb75e5577819f0155778220600001"
                        "id": "ae3081675564ddf5357564f64a560025"
            "backupStrategy": {
                "startTime": "01:00:00",
                "keepDays": 3
            "slaveId": "9405d8b8-a87d-4531-bd3a-e504c8434281",
            "ha": {
                "replicationMode": "async"

    In the DB instance information list returned during the primary/standby DB instance creation, if the primary DB instance status is FAILED, the ID of the standby DB instance is used to call Show Database Instance Details and Delete Database Instance.