Jump to: navigation, search

Trove-Replication-And-Clustering-API-Single-Alt

Revision as of 22:23, 7 March 2014 by Amcrn (talk | contribs) (Created page with "== MySQL Master/Slave == <br> ==== Create Master ==== <br> Request: <pre> POST /instances { "instance": { "availability_zone": "us-west-1", "name": "product-a",...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MySQL Master/Slave


Create Master


Request:

POST /instances
{
  "instance": {
    "availability_zone": "us-west-1",
    "name": "product-a",
    "datastore": {
      "type": "mysql",
      "version": "mysql-5.5"
    },
    "configuration": {
      "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6"
    }
    "flavorRef": "7",
    "volume": {
      "size": 1
    }
  }
}

Response:

{
  "instance": {
    "status": "BUILD",
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    "name": "product-a",
    "configuration": {
      "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
      "name": "config-a",
      "links": [{...}]
    },
    ...
  }
}


Create Slave


Request:

POST /instances
{
  "instance": {
    "availability_zone": "us-west-2",
    "name": "product-b",
    "datastore": {
      "type": "mysql",
      "version": "mysql-5.5"
    },
    "topology": {
      "slave_of": [{"id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"}]
    },
    "configuration": {
      "id": fc318e00-3a6f-4f93-af99-146b44912188",
      "initial": {
        "read_only": true
      }
    }
    "flavorRef": "7",,
    "volume": {
      "size": 1
    }
  }
}

Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    "name": "product-b",
    "configuration": {
      "id": "fc318e00-3a6f-4f93-af99-146b44912188",
      "name": "config-b",
      "links": [{...}],
      "initial": {
        "read_only": true
      }
    },
    ...
  }
}


Show Instance


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998

Response:

{
  "instance": {
    "status": "ACTIVE",
    "updated": "2014-02-16T03:38:49"
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    "name": "product-a",
    "datastore": {
      "version": "mysql-5.5",
      "type": "mysql",
    },
    "flavor": {
      "id": "7",
      "links": [{...}]
    },
    "configuration": {
      "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
      "name": "config-a",
      "links": [{...}]
    }
  }
}


Request:

GET /instances/061aaf4c-3a57-411e-9df9-2d0f813db859

Response:

{
  "instance": {
    "status": "ACTIVE",
    "updated": "2014-02-16T03:38:49"
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    "name": "product-b",
    "datastore": {
      "version": "mysql-5.5",
      "type": "mysql",
    },
    "flavor": {
      "id": "7",
      "links": [{...}]
    },
    "configuration": {
      "id": "fc318e00-3a6f-4f93-af99-146b44912188",
      "name": "config-a",
      "links": [{...}],
      "initial": {
        "read_only": true
      }
    }
  }
}


Show Topology


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology

Response:

{
  "topology": {
    "members": [
      {
        "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "name": "product-a",
        "configuration": {
          "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6"
        }
      },
      {
        "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
        "name": "product-b",
        "slave_of": [{"id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"}]
        "configuration": {
          "id": "fc318e00-3a6f-4f93-af99-146b44912188",
          "initial": {
            "read_only": true
          }
        }
      }
    ]
  }
}


Remove Replication (aka "Promote" to Standalone)


Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "promote": {
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859"
  }
}

Response:

TBD


MongoDB


Create Replica-Set


Request:

POST /instances
{
  "instance": {
    "name": "product-a",
    ...
    "datastore": {
      "type": "mongodb",
      "version": "mongodb-2.0.4"
    },
    "topology": {
      "type": "member",
      "join": false
    },
    "configuration": {
      "initial": {
        "replSet": "products"
      }
    }
    ...
  }
}

Response:

{
  "instance": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    ...
  }
}


Add Member to Replica-Set


Request:

POST /instances
{
  "instance": {
    "name": "product-b",
    ...
    "topology": {
      "type": "member",
      "join": true
    },
    "configuration": {
      "initial": {
        "replSet": "products"
      }
    }
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    ...
  }
}


Add Another Member to Replica-Set


Request:

POST /instances
{
  "instance": {
    "name": "product-c",
    ...
    "topology": {
      "type": "member",
      "join": true
    },
    "configuration": {
      "initial": {
        "replSet": "products"
      }
    }
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
    ...
  }
}


Show Instance


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998

Response:

{
  "instance": {
    ...
    "topology": {
      "type": "member"
    },
    "configuration": {
      "initial": {
        "replSet": "products"
      }
    }
    ...
  }
}


Show Topology


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology

Response:

{
  "topology": {
    "members": [
      {
        "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "name": "product-a",
        ...
        "type": "member",
        "configuration": {
          "initial": {
            "replSet": "products"
          }
        }
      },
      {
        "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
        "name": "product-b",
        ...
        "type": "member",
        "configuration": {
          "initial": {
            "replSet": "products"
          }
        }
      },
      {
        "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
        "name": "product-c",
        ...
        "type": "member",
        "configuration": {
          "initial": {
            "replSet": "products"
          }
        }
      }
    ]
  }
}


Add Arbiter


Request:

POST /instances
{
  "instance": {
    "name": "product-arbiter",
    ...
    "topology": {
      "type": "arbiter",
      "join": true
    },
    "configuration": {
      "initial": {
        "replSet": "products",
      }
    }
    ...
  }
}

Response:

{
  "instance": {
    "status": "BUILD",
    "id": "a1b62aaa-7863-4384-8250-59024141c1f8",
    ...
  }
}


Add a Delayed Member


Request:

POST /instances
{
  "instance": {
    "name": "product-delayed",
    ...
    "topology": {
      "type": "member",
      "priority": 0,
      "hidden": true,
      "join": true  
    },
    "configuration": {
      "initial": {
        "replSet": "products",
        "slaveDelay": 3600
      }
    }
  }
}

Response:

{
  "instance": {
    "status": "BUILD",
    "id": "7d8eb019-931b-4b2a-88d2-4c9f0ca1b29e",
    ...
  }
}


Modifying a Replica-Set


POST /instances/:id/topology/action

Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "mongodb": {
    "update_members": {
      "members": [
        {
          "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
          "priority": 2
        },
        {
          "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
          "priority": 1
        },
        {
          "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
          "priority": 0.5
        }
      ]
    }
  }
}


Remove a Member


Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "remove_member": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
  }
}


MongoDB TokuMX

  • TokuMUX will require a new datastore-version and *possibly* a new manager class (same reasoning as why Tungsten/Galera will have their own datastore-version for MySQL)

Cassandra


Create Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-a",
    ...
    "datastore": {
      "type": "cassandra",
      "version": "cassandra-2.0.5"
    },
    "topology": {
      "is_seed": true,
      "join": false
    },
    "configuration": {
      "initial": {
        "cluster_name": "products",
        "num_tokens": 256,
        "endpoint_snitch": "RackInferringSnitch"
      }
    }
    ...
  }
}

Response:

{
  "instance": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    ...
  }
}


Add Node to Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-b",
    ...
    "topology": {
      "is_seed": false,
      "join": true
    },
    "configuration": {
      "initial": {
        "cluster_name": "products",
        "num_tokens": 256,
        "auto_bootstrap": false
      }
    }
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    ...
  }
}


Add Another Node to Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-c",
    ...
    "topology": {
      "is_seed": false,
      "join": true
    },
    "configuration": {
      "initial": {
        "cluster_name": "products",
        "num_tokens": 256,
        "auto_bootstrap": false
      }
    }
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
    ...
  }
}


Show Instance


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998

Response:

{
  "instance": {
    ...

    "topology": {
      "is_seed": true
    },
    "configuration": {
      "initial": {
        "cluster_name": "products",
        "num_tokens": 256,
        "auto_bootstrap": false
      }
    }
    ...
  }
}


Show Topology


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology

Response:

{
  "topology": {
    "members": [
      {
        "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "name": "product-a",
        ...
        "topology": {
          "is_seed": true
        },
        "configuration": {
          "initial": {
            "cluster_name": "products",
            "num_tokens": 256,
            "auto_bootstrap": false
          }
        }
      },
      {
        "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
        "name": "product-b",
        ...
        "topology": {
          "is_seed": false
        },
        "configuration": {
          "initial": {
            "cluster_name": "products",
            "num_tokens": 256,
            "auto_bootstrap": false
          }
        }
      },
      {
        "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
        "name": "product-c",
        ...
        "topology": {
          "is_seed": false
        },
        "configuration": {
          "initial": {
            "cluster_name": "products",
            "num_tokens": 256,
            "auto_bootstrap": false
          }
        }
      }
    ]
  }
}


Modifying a Cluster


Example: Drain (http://www.datastax.com/documentation/cassandra/2.0/cassandra/tools/toolsDrain.html)

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "drain_node": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
  }
}


Remove a Member


Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "remove_node": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
  }
}


Couchbase


Create Cluster


Create Initial Cluster

Request:

POST /instances
{
  "instance": {
    "name": "product-a",
    ...
    "datastore": {
      "type": "couchbase",
      "version": "couchbase-2.2"
    },
    "topology": {
      "cluster_name": "products",
      "join": false
    },
    ...
  }
}

Response:

{
  "instance": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    ...
  }
}


Add Node to Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-b",
    ...
    "topology": {
      "cluster_name": "products",
      "join": true
    },
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    ...
  }
}


Add Another Node to Cluster


Request/Response omitted due to a lack of any special considerations required

Show Instance


Request/Response omitted due to a lack of any special considerations required

Show Topology


Request/Response omitted due to a lack of any special considerations required

Modifying a Cluster


POST /instances/:id/topology/action

Example: Create Bucket

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "create_bucket": {
    "bucket": "test_bucket",
    "bucket_type": "couchbase",
    "bucket_port": 11222,
    "bucket_ramsize": 200,
    "bucket_replica": 1
  }
}


Remove a Member


POST /instances/:id/topology/action

Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "rebalance": {
    "server_remove": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
  }
}


Redis


Create Master


Request:

POST /instances
{
  "instance": {
    "name": "product-a",
    ...
    "datastore": {
      "type": "redis",
      "version": "redis-2.8.6"
    },
    ...
  }
}

Response:

{
  "instance": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    ...
  }
}


Add Slave


Request:

POST /instances
{
  "instance": {
    "name": "product-b",
    ...
    "datastore": {
      "type": "redis",
      "version": "redis-2.8.6"
    },
    "topology": {
      "slave_of": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
    },
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    ...
  }
}


Show Instance


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998

Response:

{
  "instance": {
    ...
  }
}


Show Topology


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology

Response:

{
  "topology": {
    "members": [
      {
        "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "name": "product-a",
        ...
      },
      {
        "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
        "name": "product-b",
        ...
        "slave_of": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
      }
    ]
  }
}


Promote/Disconnect Slave


POST /instances/:id/topology/action

Request:

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology/action

{
  "slaveof_no_one": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
  }
}


Redis Cluster


Create Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-a",
    ...
    "datastore": {
      "type": "redis",
      "version": "redis-3.0.0-beta1"
    },
    "topology": {
      "cluster_name": "products",
      "join": false
    },
    "configuration": {
      "initial": {
        "cluster_timeout": 5000,
      }
    }
    ...
  }
}

Response:

{
  "instance": {
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    ...
  }
}


Add Another Master to Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-b",
    ...
    "datastore": {
      "type": "redis",
      "version": "redis-3.0.0-beta1"
    },
    "topology": {
      "cluster_name": "products",
      "join": true
    },
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
    ...
  }
}


Add Slave to Cluster


Request:

POST /instances
{
  "instance": {
    "name": "product-c",
    ...
    "datastore": {
      "type": "redis",
      "version": "redis-3.0.0-beta1"
    },
    "topology": {
      "cluster_name": "products",
      "slave_of": "dfbbd9ca-b5e1-4028-adb7-f78643e17998"
    },
    ...
  }
}


Response:

{
  "instance": {
    "status": "BUILD",
    "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
    ...
  }
}


Show Instance


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998

Response:

{
  "instance": {
    ...
    "topology": {
      "cluster_name": "products"
    },
    "configuration": {
      "initial": {
        "cluster_timeout": 5000
      }
    }
    ...
  }
}


Show Topology


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/topology

Response:

{
  "topology": {
    "members": [
      {
        "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "name": "product-a",
        ...
        "cluster_name": "products",
        "configuration": {
          "cluster_timeout": 5000
        }
      },
      {
        "id": "061aaf4c-3a57-411e-9df9-2d0f813db859",
        "name": "product-b",
        ...
        "cluster_name": "products",
        "configuration": {
          "initial": {
            "cluster_timeout": 5000
          }
        }
      },
      {
        "id": "3a72ee87-cf3e-40f1-a1e1-fe8c7263a782",
        "name": "product-c",
        ...
        "cluster_name": "products", 
        "slave_of": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
        "configuration": {
          "initial": {
            "cluster_timeout": 5000
          }
        }
      }
    ]
  }
}


Promote/Disconnect Slave


Work in Progress