Trove/Replication-And-Clustering-With-Nodes
Contents
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:
POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/node/ff9d680c-fde3-49c6-a84e-76173b6df39d/action { "promote": {} }
Notes:
- Note that 'promote' was used here vs. "remove/decomm" because the action is akin to promoting a mysql/redis slave instance (see https://wiki.apache.org/cassandra/Operations#Removing_nodes_entirely)
Scale Up Nodes
Request:
POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/action { "resize_cluster": { "num_nodes": 6 } }
Response:
HTTP 202 (Empty Body)