Jump to: navigation, search

Trove/Replication-And-Clustering-With-Nodes

< Trove
Revision as of 22:03, 25 April 2014 by Amcrn (talk | contribs) (updated remove node notes and changed to DELETE)

Cassandra


Create Instance


Request:

POST /instances
{
  "instance": {
    "name": "products",
    "datastore": {
      "type": "cassandra",
      "version": "2.0.5"
    },
    "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
    "flavorRef": "7",
    "volume": {
      "size": 1
    },
    "cluster": {
      "num_nodes": 3
    }
  }
}

Response:

{
  "instance": {
    "status": "BUILD",
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    "name": "products",
    "created": "2014-04-25T20:19:23",
    "updated": "2014-04-25T20:19:23",
    "links": [{...}],
    "datastore": {
      "type": "cassandra",
      "version": "2.0.5"
    },
    "configuration": {
      "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
      "links": [{...}],
    },
    "flavor": {
      "id": "7",
      "links": [{...}],
    },
    "volume": {
      "size": 1
    },
    "cluster": {
      "num_nodes": 3,
      "nodes": [
        {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1"},
        {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a"},
        {"id": "ff9d680c-fde3-49c6-a84e-76173b6df39d"}
      ]
    }
  }
}


Notes:

  • The instance.name now acts as the "cluster name", and in the case of Cassandra, the actual cluster_name.
  • cluster.num_nodes indicates how many nodes should be in the initial cluster (required)
  • The cluster.nodes[].id are generated uuids
  • Cassandra-specific fields that are required to construct the initial cluster (num_tokens, endpoint_snitch, seed ip-list, etc.) are to be determined/calculated based on configuration file values and common-sense.


Show Instance


Request:

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

Response:

{
  "instance": {
    "status": "ACTIVE",
    "id": "dfbbd9ca-b5e1-4028-adb7-f78643e17998",
    "name": "products",
    "created": "2014-04-25T20:19:23",
    "updated": "2014-04-25T20:19:23",
    "links": [{...}],
    "datastore": {
      "type": "cassandra",
      "version": "2.0.5"
    },
    "configuration": {
      "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
      "links": [{...}],
    },
    "flavor": {
      "id": "7",
      "links": [{...}],
    },
    "volume": {
      "size": 1
    },
    "cluster": {
      "num_nodes": 3,
      "nodes": [
        {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1"},
        {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a"},
        {"id": "ff9d680c-fde3-49c6-a84e-76173b6df39d"}
      ]
    }
  }
}


Notes:

  • Change: instance.volume.used, instance.ip[], and instance.hostname will never be returned
    • It's possible that instance.ip[] can remain if it only returns the seed ips.
    • It's possible that instance.hostname can remain if it's converted to an array and only contains the seed hostnames.
  • Change: the semantic meaning of instance.status, and the possible states, will change


Show Node


Request:

GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/node/416b0b16-ba55-4302-bbd3-ff566032e1c1

Response:

{
  "node": {
    "status": "ACTIVE",
    "id": "416b0b16-ba55-4302-bbd3-ff566032e1c1",
    "name": "products-1",
    "created": "2014-04-25T20:19:23",
    "updated": "2014-04-25T20:19:23",
    "links": [{...}],
    "ip": ["10.0.0.1"],
    "volume": {
      "size": 2,
      "used": 0.17
    }
  }
}


Notes:

  • node.name is the instance.name with "-<num>" as a suffix (counter for the cluster, starting at 1)
  • the node.status will likely mirror the state values and transitions seen in instance.status prior to the clustering implementation.


Modify Node


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

POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/node/416b0b16-ba55-4302-bbd3-ff566032e1c1/action
{
  "drain": {}
}


Remove Node


Request:

DELETE /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/node/ff9d680c-fde3-49c6-a84e-76173b6df39d


Notes:


Scale Up Nodes


Request:

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

{
  "resize_cluster": {
    "num_nodes": 6
  }
}


Response:

HTTP 202 (Empty Body)