Trove/Clusters-MongoDB
Summary
- Will remain on /v1.0 of the API (aka will not introduce /v2.0, meaning everything remains backwards compatible)
- Will introduce /clusters resource
- Previously, an "instance" was defined as a standalone (unclustered) instance of a datastore. Now, an "instance" is either a standalone instance, or an instance that belongs to a cluster. By inference, a cluster is a collection of instances.
- All MongoDB clusters will be sharded clusters, with shards being three member replica-sets. Upon cluster creation, a single shard is assumed; once the initial cluster is provisioned, additional shards can be added on-demand.
- Each sharded cluster will have at least one query router (mongos), and at least one mongo config server (mongod --configsvr).
- Query routers and config servers will not be represented as instances in the API. See more information under the Query Routers and Config Servers section.
Operations
Create Cluster
Request:
POST /v1.0/<tenant_id>/clusters { "cluster": { "name": "products", "datastore": { "type": "mongodb", "version": "2.6" }, "instances": [ { "flavorRef": "7", "volume": { "size": 100 } }, { "flavorRef": "7", "volume": { "size": 100 } }, { "flavorRef": "7", "volume": { "size": 100 } } ] } }
Response:
{ "cluster": { "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": "mongodb", "version": "2.6" }, "instances": [ { "id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } }, { "id": "965ef811-7c1d-47fc-89f2-a89dfdd23ef2", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } }, { "id": "3642f41c-e8ad-4164-a089-3891bf7f2d2b", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } } ] } }
Notes:
- Creates a sharded cluster, with a single shard (3 member replica-set), each replica-set member with the same flavor (memory + vcpu) and volume-size.
- Also creates mongos query routers and config-servers (see Query Servers and Config Servers for more information)
- The replica-set name (replSet) will be automatically generated; it will be the cluster name with a "rs-<num>" suffix.
- In this example, the first replica-set name will be "product-rs1", the next "product-rs2", etc.
- The name of each instance will be automatically generated; it will be the <cluster_name>-rs<rs_num>-<instance_num>
- In this example, the instance names will be "product-rs1-1", "product-rs1-2", and "product-rs1-3".
- In the first iteration, flavor and volume-size must be identical for all instances in a replica-set.
- In the first iteration, the number of instances in a replica-set must be 3.
Show Cluster
Request:
GET /v1.0/<tenant_id>/clusters/dfbbd9ca-b5e1-4028-adb7-f78643e17998
Response:
{ "cluster": { "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": "mongodb", "version": "2.6" }, "ip": ["10.0.0.1"], "instances": [ { "id": "416b0b16-ba55-4302-bbd3-ff566032e1c1", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } }, { "id": "965ef811-7c1d-47fc-89f2-a89dfdd23ef2", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } }, { "id": "3642f41c-e8ad-4164-a089-3891bf7f2d2b", "shard_id": "5415b62f-f301-4e84-ba90-8ab0734d15a7", "flavor": { "id": "7", "links": [{...}] }, "volume": { "size": 100 } } ] } }
Notes:
- The ip/hostname returned is the list of mongos query routers. See Query Routers and Config-Servers for more information.