Jump to: navigation, search

Difference between revisions of "Trove-Replication-And-Clustering-API"

Line 124: Line 124:
 
                     "size": 20
 
                     "size": 20
 
                 },
 
                 },
                "attributes": {
 
                    "cluster": {
 
                        "id": "https://service/v1.0/1234/clusters/a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 
                        "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 
                        "role": "master"
 
                    }
 
                }
 
 
             },
 
             },
 
             {
 
             {
Line 162: Line 155:
 
                     "size": 20
 
                     "size": 20
 
                 },
 
                 },
                "attributes": {
 
                    "cluster": {
 
                        "id": "https://service/v1.0/1234/clusters/a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 
                        "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 
                        "role": "slave",
 
                        "master": "https://service/v1.0/1234/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb"
 
                    }
 
                }
 
 
             },
 
             },
 
             {
 
             {
Line 201: Line 186:
 
                     "size": 20
 
                     "size": 20
 
                 },
 
                 },
                "attributes": {
 
                    "cluster": {
 
                        "id": "https://service/v1.0/1234/clusters/a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 
                        "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 
                        "role": "slave",
 
                        "master": "https://service/v1.0/1234/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb"
 
                    }
 
                }
 
 
             },
 
             },
 
         ]
 
         ]
Line 331: Line 308:
 
                 "size": 20
 
                 "size": 20
 
             },
 
             },
            "attributes": {
 
                "cluster": {
 
                    "id": "https://service/v1.0/1234/clusters/a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 
                    "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 
                    "role": "master",
 
                    "master": "https://service/v1.0/1234/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb"
 
                }
 
            }
 
 
         }
 
         }
 
     }
 
     }
Line 344: Line 313:
 
</pre>
 
</pre>
  
 +
== Restart a cluster (All nodes): ==
 +
===== PUT /clusters/{cluster_id}/restart =====
 +
<pre>
 +
{
 +
    "cluster": {
 +
        "clusterConfig": {
 +
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 +
        },
 +
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 +
    }
 +
}
 +
</pre>
 +
 +
== Restart an instance of a cluster: ==
 +
===== PUT /clusters/{cluster_id}/nodes/{node_id}/restart =====
 +
<pre>
 +
{
 +
    "cluster": {
 +
        "clusterConfig": {
 +
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 +
        },
 +
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 +
    },
 +
    "node": {
 +
        "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
 +
    }
 +
}
 +
</pre>
 +
 +
== Resize an instance of a cluster: ==
 +
===== PUT /clusters/{cluster_id}/nodes/{node_id}/resize =====
 +
<pre>
 +
{
 +
    "cluster": {
 +
        "clusterConfig": {
 +
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
 +
        },
 +
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
 +
    },
 +
    "node": {
 +
        "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
 +
        "flavor": {
 +
            "id": "2",
 +
            "links": [
 +
                {
 +
                    "href": "https://service/v1.0/1234/flavors/2",
 +
                    "rel": "self"
 +
                },
 +
                {
 +
                    "href": "https://service/flavors/2",
 +
                    "rel": "bookmark"
 +
                }
 +
            ],
 +
        },
 +
        "volume": {
 +
            "size": 40
 +
        },
 +
    }
 +
}
 +
</pre>
  
 
= COMMENTS =
 
= COMMENTS =
 
I think imsplitbit is the bee's knees.
 
I think imsplitbit is the bee's knees.

Revision as of 16:05, 9 July 2013

List cluster types:

Returned json:

GET /clustertypes
{
    "clusterTypes": [
        {
            "id": "7782954c-ebec-42f0-894b-d3601016a91e",
            "links": [
                {
                    "href": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
                    "rel": "self"
                },
                {
                    "href": "https://service/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
                    "rel": "self"
                }
            ],
            "name": "Master/Slave Replication",
            "type": "master-slave"
        }
    ]
}

Create Replication Set: (No previous db instance, fresh)

This will create 1 master with 2 replicas.

POST /clusters
{
    "cluster": {
        "nodes": 3,
        "flavorRef": "https://service/v1.0/1234/flavors/1", 
        "name": "replication_set_1", 
        "volume": {
            "size": 2
        },
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e"
        }
    }
 }

Create Replication Set: (Previous db instance)

Create a replication set with primaryNode as the model for instance flavor and volume size and it will server as the "Master" node if the cluster type is master/slave or equivalent

POST /clusters

Optional attributes: flavorRef

{
    "cluster": {
        "nodes": 3,
        "name": "replication_set_1",
        "flavorRef": "https://service/v1.0/1234/flavors/1",
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
            "primaryNode": "https://service/v1.0/1234/instances/d3ca44b6-1ba2-4862-b16d-1b2cd115944d"
        },
    }
}

List cluster or replication sets:

GET /clusters

Returned JSON object

{
    "clusters": [
        {
            "clusterConfig": {
                "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
            },
            "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
            "nodes": [
                {"id": "https://service/v1.0/1234/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb"},
                {"id": "https://service/v1.0/1234/instances/7a369ce2-0cfb-4bcd-b342-370a4ae55c09"},
                {"id": "https://service/v1.0/1234/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080"}
            ]
        }
    ]
}

List cluster or replication set details:

GET /clusters/{cluster_id}
{
    "cluster": {
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "nodes": [
            {
                "flavor": {
                    "id": "1",
                    "links": [
                        {
                            "href": "https://service/v1.0/1234/flavors/1",
                            "rel": "self"
                        },
                        {
                            "href": "https://service/flavors/1",
                            "rel": "bookmark"
                        }
                    ]
                },
                "id": "fbd14327-230c-495e-b6d9-cb593ccd4cbb",
                "links": [
                    {
                        "href": "https://service/v1.0/1234/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb",
                        "rel": "self"
                    },
                    {
                        "href": "https://service/instances/fbd14327-230c-495e-b6d9-cb593ccd4cbb",
                        "rel": "bookmark"
                    }
                ],
                "name": "master_instance",
                "status": "ACTIVE",
                "volume": {
                    "size": 20
                },
            },
            {
                "flavor": {
                    "id": "1",
                    "links": [
                        {
                            "href": "https://service/v1.0/1234/flavors/1",
                            "rel": "self"
                        },
                        {
                            "href": "https://service/flavors/1",
                            "rel": "bookmark"
                        }
                    ]
                },
                "id": "7a369ce2-0cfb-4bcd-b342-370a4ae55c09",
                "links": [
                    {
                        "href": "https://service/v1.0/1234/instances/7a369ce2-0cfb-4bcd-b342-370a4ae55c09",
                        "rel": "self"
                    },
                    {
                        "href": "https://service/instances/7a369ce2-0cfb-4bcd-b342-370a4ae55c09",
                        "rel": "bookmark"
                    }
                ],
                "name": "master_instance",
                "status": "ACTIVE",
                "volume": {
                    "size": 20
                },
            },
            {
                "flavor": {
                    "id": "1",
                    "links": [
                        {
                            "href": "https://service/v1.0/1234/flavors/1",
                            "rel": "self"
                        },
                        {
                            "href": "https://service/flavors/1",
                            "rel": "bookmark"
                        }
                    ]
                },
                "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
                "links": [
                    {
                        "href": "https://service/v1.0/1234/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
                        "rel": "self"
                    },
                    {
                        "href": "https://service/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
                        "rel": "bookmark"
                    }
                ],
                "name": "master_instance",
                "status": "ACTIVE",
                "volume": {
                    "size": 20
                },
            },
        ]
    }
}

Drop node from cluster:

List the nodes to delete, allow for more than one node to be specified.

DELETE /clusters/{cluster_id}/nodes
{
    "cluster": {
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "nodes": [
            /* The proposal here would be to allow multiple
            instances to be removed if the clusterType
            supports it. Think "I have a master and 2 slaves
            for christmas traffic but no longer need the
            slaves." */
            {"id": "https://service/v1.0/1234/instances/7a369ce2-0cfb-4bcd-b342-370a4ae55c09"},
            {"id": "https://service/v1.0/1234/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080"}
        ]
    }
}

Or, only one at a time? Or both?

{
    "cluster": {
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "node": {
            "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080"
        }
    }
}

Or just reduce the number of nodes and let the system decide? or just allow either "node" or "nodes" to give users more ways to control their cluster.

{
    "cluster": {
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "nodes": 2
    }
}

Add node to cluster/replication:

PUT /clusters/{cluster_id}/nodes

Add nodes by just increasing the node count?

{
    /* adding nodes to the cluster, it is assumed that
    you are bringing an uncreated instance into the
    the cluster of servers.  If nodes are of different
    sizes then default to the size of the master/primary node */
    "cluster": {
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "nodes": 5,
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        }

    }
}
{
    /* Add nodes to the cluster by giving specs on
    the node to add */
    "cluster": {
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "node": {
            "flavorRef": "https://service/v1.0/1234/flavors/1",
            "volume": {
                "size": 40
            }
        }
    }
}

Promote a slave node to master:

PUT /clusters/{cluster_id}
{
    "cluster": {
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
        "node": {
            "flavor": {
                "id": "1",
                "links": [
                    {
                        "href": "https://service/v1.0/1234/flavors/1",
                        "rel": "self"
                    },
                    {
                        "href": "https://service/flavors/1",
                        "rel": "bookmark"
                    }
                ]
            },
            "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
            "links": [
                {
                    "href": "https://service/v1.0/1234/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
                    "rel": "self"
                },
                {
                    "href": "https://service/instances/f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
                    "rel": "bookmark"
                }
            ],
            "name": "master_instance",
            "status": "ACTIVE",
            "volume": {
                "size": 20
            },
        }
    }
}

Restart a cluster (All nodes):

PUT /clusters/{cluster_id}/restart
{
    "cluster": {
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
    }
}

Restart an instance of a cluster:

PUT /clusters/{cluster_id}/nodes/{node_id}/restart
{
    "cluster": {
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
    },
    "node": {
        "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
    }
}

Resize an instance of a cluster:

PUT /clusters/{cluster_id}/nodes/{node_id}/resize
{
    "cluster": {
        "clusterConfig": {
            "type": "https://service/v1.0/1234/clustertypes/7782954c-ebec-42f0-894b-d3601016a91e",
        },
        "id": "a66cab3a-041b-4c17-82e7-7ca5333a18f3",
    },
    "node": {
        "id": "f7e68ccf-2da6-4bb8-a75b-afe0dd3a0080",
        "flavor": {
            "id": "2",
            "links": [
                {
                    "href": "https://service/v1.0/1234/flavors/2",
                    "rel": "self"
                },
                {
                    "href": "https://service/flavors/2",
                    "rel": "bookmark"
                }
            ],
        },
        "volume": {
            "size": 40
        },
    }
}

COMMENTS

I think imsplitbit is the bee's knees.