Difference between revisions of "Trove/Replication-And-Clustering-With-Nodes-2"
< Trove
(Created page with "== Summary == <br> ==== Summary of New Fields for Instance-Create ==== * TBF <br> <br> ==== Summary of New Fields for Instance-Show ==== * TBF <br> ==== Summary of Route Chan...") |
|||
Line 117: | Line 117: | ||
<br> | <br> | ||
Notes: | Notes: | ||
+ | * For Phase One: | ||
+ | ** cluster.allocations{} will not be supported. | ||
+ | ** cluster.nodes[].region will not be returned. | ||
+ | * For Phase Two: | ||
+ | ** if cluster.allocations{} is not provided, the current region is assumed. | ||
+ | ** cluster.nodesp[.region will always be returned. | ||
* 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. | * 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. | ||
− | |||
− | |||
<br> | <br> | ||
Line 158: | Line 162: | ||
<br> | <br> | ||
Notes: | Notes: | ||
− | * | + | * In Phase One: |
+ | ** cluster.nodes[].region will not be returned. | ||
* Change: instance.volume.used, instance.ip[], and instance.hostname will never be returned | * 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.ip[] can remain if it only returns the seed ips. | ||
Line 207: | Line 212: | ||
{ | { | ||
+ | # phase one | ||
"resize_cluster": { | "resize_cluster": { | ||
"size": 6 | "size": 6 | ||
+ | } | ||
+ | |||
+ | # phase two | ||
+ | "resize_cluster": { | ||
+ | "size": 6, | ||
+ | "allocations": [ | ||
+ | {"region": "phx", "size": 2}, | ||
+ | {"region": "slc", "size": 2}, | ||
+ | {"region": "lvs", "size": 2} | ||
+ | ] | ||
} | } | ||
} | } | ||
Line 217: | Line 233: | ||
HTTP 202 (Empty Body) | HTTP 202 (Empty Body) | ||
</pre> | </pre> | ||
+ | <br> | ||
+ | Notes: | ||
+ | * For Phase One: | ||
+ | ** resize_cluster.size will be the only supported field (resize_cluster.allocations will not be) | ||
+ | * For Phase Two: | ||
+ | ** if resize_cluster.allocations[] is not provided, the region of every node must match, otherwise the request is failed. | ||
<br> | <br> | ||
==== All Other Operations ==== | ==== All Other Operations ==== | ||
Line 222: | Line 244: | ||
Notes: | Notes: | ||
* As mentioned in the Summary, other operations like: removing a node, replacing a running node, replacing a dead node, repairing a node, etc. are not supported in the first iteration. | * As mentioned in the Summary, other operations like: removing a node, replacing a running node, replacing a dead node, repairing a node, etc. are not supported in the first iteration. | ||
+ | <br> | ||
+ | == Example: MySQL == | ||
+ | <br> | ||
+ | ==== Create Master ==== | ||
+ | <br> | ||
+ | Request: | ||
+ | |||
+ | <pre> | ||
+ | POST /instances | ||
+ | { | ||
+ | "instance": { | ||
+ | "name": "products", | ||
+ | "datastore": { | ||
+ | "type": "mysql", | ||
+ | "version": "5.5" | ||
+ | }, | ||
+ | "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6", | ||
+ | "flavorRef": "7", | ||
+ | "volume": { | ||
+ | "size": 1 | ||
+ | }, | ||
+ | "cluster": { | ||
+ | "size": 1, | ||
+ | "allocations": [ | ||
+ | {"region": "phx", "size": 1}, | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | Response: | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "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": "mysql", | ||
+ | "version": "5.5" | ||
+ | }, | ||
+ | "cluster": { | ||
+ | "size": 1, | ||
+ | "nodes": [ | ||
+ | {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | ==== Add Slave ==== | ||
+ | <br> | ||
+ | Request: | ||
+ | |||
+ | <pre> | ||
+ | POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/416b0b16-ba55-4302-bbd3-ff566032e1c1/action | ||
+ | |||
+ | { | ||
+ | "resize_slaves": { | ||
+ | "size": 2, | ||
+ | "allocations": [ | ||
+ | {"region": "phx", "size": 1}, | ||
+ | {"region": "slc", "size": 1} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | Response: | ||
+ | |||
+ | <pre> | ||
+ | HTTP 202 (Empty Body) | ||
+ | </pre> | ||
+ | <br> | ||
+ | Notes: | ||
+ | * For Phase One: | ||
+ | ** resize_cluster.allocations[].region would not be supported. | ||
+ | <br> | ||
+ | ==== Show Cluster ==== | ||
+ | <br> | ||
+ | Request: | ||
+ | |||
+ | <pre> | ||
+ | GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998 | ||
+ | </pre> | ||
+ | |||
+ | Response: | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "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": "mysql", | ||
+ | "version": "5.5" | ||
+ | }, | ||
+ | "cluster": { | ||
+ | "size": 3, | ||
+ | "nodes": [ | ||
+ | {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"}, | ||
+ | {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", "region": "slc", "type": "slave"} | ||
+ | {"id": "c592183d-0aec-42f1-8a3b-199e6817c372", "region": "phx", "type": "slave"} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | ==== Show Master ==== | ||
+ | <br> | ||
+ | Request: | ||
+ | |||
+ | <pre> | ||
+ | GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/416b0b16-ba55-4302-bbd3-ff566032e1c1 | ||
+ | </pre> | ||
+ | |||
+ | Response: | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "instance": { | ||
+ | "status": "ACTIVE", | ||
+ | "id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", | ||
+ | "name": "products-1", | ||
+ | "created": "2014-04-25T20:19:23", | ||
+ | "updated": "2014-04-25T20:19:23", | ||
+ | "links": [{...}], | ||
+ | "datastore": { | ||
+ | "type": "mysql", | ||
+ | "version": "5.5" | ||
+ | }, | ||
+ | "configuration": { | ||
+ | "id": "fc318e00-3a6f-4f93-af99-146b44912188", | ||
+ | "links": [{...}], | ||
+ | }, | ||
+ | "flavor": { | ||
+ | "id": "7", | ||
+ | "links": [{...}], | ||
+ | }, | ||
+ | "volume": { | ||
+ | "size": 1 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | ==== Show Slave ==== | ||
+ | <br> | ||
+ | Request: | ||
+ | |||
+ | <pre> | ||
+ | GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/7f52e4f9-3fa6-4238-ac08-1ce15197329a | ||
+ | </pre> | ||
+ | |||
+ | Response: | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "instance": { | ||
+ | "status": "ACTIVE", | ||
+ | "id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", | ||
+ | "name": "products-2", | ||
+ | "created": "2014-04-25T20:19:23", | ||
+ | "updated": "2014-04-25T20:19:23", | ||
+ | "links": [{...}], | ||
+ | "datastore": { | ||
+ | "type": "mysql", | ||
+ | "version": "5.5" | ||
+ | }, | ||
+ | "configuration": { | ||
+ | "id": "fc318e00-3a6f-4f93-af99-146b44912188", | ||
+ | "links": [{...}], | ||
+ | }, | ||
+ | "flavor": { | ||
+ | "id": "7", | ||
+ | "links": [{...}], | ||
+ | }, | ||
+ | "volume": { | ||
+ | "size": 1 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
<br> | <br> |
Revision as of 21:43, 1 May 2014
Summary
Summary of New Fields for Instance-Create
- TBF
Summary of New Fields for Instance-Show
- TBF
Summary of Route Changes
New Route:
GET /instances/<id>/node/<node-id>
{ "node": { "status": "<status>", "id": "<node-id>", "name": "<name>", "created": "<timestamp>", "updated": "<timestamp>", "links": [{...}], "ip": ["<ip>"], //or hostname, depending on conf "configuration": "<configuration-id>", "flavorRef": "<flavor-id>", "volume": { "size": <size>, "used": <used> } } }
New Route:
POST /instances/<id>/node/<node-id>/action
{ "<action>": { <action-specific fields> } }
Summary
- TBF
Features for First Iteration
Notes:
- TBF
Example: Cassandra
To illustrate the approach, Cassandra is used in the examples below. The eccentricities of each Datastore will be explained in their own sections.
Create Instance
Request:
POST /instances { "instance": { "name": "products", "datastore": { "type": "cassandra", "version": "2.0.6" }, "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6", "flavorRef": "7", "volume": { "size": 1 }, "cluster": { "size": 3, "allocations": [ {"region": "phx", "size": 1}, {"region": "slc", "size": 1}, {"region": "lvs", "size": 1} ] } } }
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.6" }, "cluster": { "size": 3, "nodes": [ {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"}, {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", "region": "slc"}, {"id": "ff9d680c-fde3-49c6-a84e-76173b6df39d", "region": "lvs"} ] } } }
Notes:
- For Phase One:
- cluster.allocations{} will not be supported.
- cluster.nodes[].region will not be returned.
- For Phase Two:
- if cluster.allocations{} is not provided, the current region is assumed.
- cluster.nodesp[.region will always be returned.
- 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.6" }, "cluster": { "size": 3, "nodes": [ {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"}, {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", "region": "slc"}, {"id": "ff9d680c-fde3-49c6-a84e-76173b6df39d", "region": "lvs"} ] } } }
Notes:
- In Phase One:
- cluster.nodes[].region will not be returned.
- 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.
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"], "configuration": { "id": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6", "links": [{...}], }, "flavor": { "id": "7", "links": [{...}], }, "volume": { "size": 2, "used": 0.17 } } }
Resize Cluster
Request:
POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/action { # phase one "resize_cluster": { "size": 6 } # phase two "resize_cluster": { "size": 6, "allocations": [ {"region": "phx", "size": 2}, {"region": "slc", "size": 2}, {"region": "lvs", "size": 2} ] } }
Response:
HTTP 202 (Empty Body)
Notes:
- For Phase One:
- resize_cluster.size will be the only supported field (resize_cluster.allocations will not be)
- For Phase Two:
- if resize_cluster.allocations[] is not provided, the region of every node must match, otherwise the request is failed.
All Other Operations
Notes:
- As mentioned in the Summary, other operations like: removing a node, replacing a running node, replacing a dead node, repairing a node, etc. are not supported in the first iteration.
Example: MySQL
Create Master
Request:
POST /instances { "instance": { "name": "products", "datastore": { "type": "mysql", "version": "5.5" }, "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6", "flavorRef": "7", "volume": { "size": 1 }, "cluster": { "size": 1, "allocations": [ {"region": "phx", "size": 1}, ] } } }
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": "mysql", "version": "5.5" }, "cluster": { "size": 1, "nodes": [ {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"} ] } } }
Add Slave
Request:
POST /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/416b0b16-ba55-4302-bbd3-ff566032e1c1/action { "resize_slaves": { "size": 2, "allocations": [ {"region": "phx", "size": 1}, {"region": "slc", "size": 1} ] } }
Response:
HTTP 202 (Empty Body)
Notes:
- For Phase One:
- resize_cluster.allocations[].region would not be supported.
Show Cluster
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": "mysql", "version": "5.5" }, "cluster": { "size": 3, "nodes": [ {"id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "region": "phx"}, {"id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", "region": "slc", "type": "slave"} {"id": "c592183d-0aec-42f1-8a3b-199e6817c372", "region": "phx", "type": "slave"} ] } } }
Show Master
Request:
GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/416b0b16-ba55-4302-bbd3-ff566032e1c1
Response:
{ "instance": { "status": "ACTIVE", "id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "name": "products-1", "created": "2014-04-25T20:19:23", "updated": "2014-04-25T20:19:23", "links": [{...}], "datastore": { "type": "mysql", "version": "5.5" }, "configuration": { "id": "fc318e00-3a6f-4f93-af99-146b44912188", "links": [{...}], }, "flavor": { "id": "7", "links": [{...}], }, "volume": { "size": 1 } } }
Show Slave
Request:
GET /instances/dfbbd9ca-b5e1-4028-adb7-f78643e17998/nodes/7f52e4f9-3fa6-4238-ac08-1ce15197329a
Response:
{ "instance": { "status": "ACTIVE", "id": "7f52e4f9-3fa6-4238-ac08-1ce15197329a", "name": "products-2", "created": "2014-04-25T20:19:23", "updated": "2014-04-25T20:19:23", "links": [{...}], "datastore": { "type": "mysql", "version": "5.5" }, "configuration": { "id": "fc318e00-3a6f-4f93-af99-146b44912188", "links": [{...}], }, "flavor": { "id": "7", "links": [{...}], }, "volume": { "size": 1 } } }