Trove系列(五)—Trove的數據存儲管理程序類型和版本管理功能介紹

功能描述數據存儲管理程序(Datastore)類型管理容許Trove的用戶從操做者列出的名單中選擇數據庫存儲管理程序和版本。操做者將能夠控制數據庫存儲管理程序的類型,添加一個新的版本並去活一個老版本。爲了實現這個功能,用戶能夠指定數據庫存儲管理程序類型和可選擇的版本。數據庫存儲管理程序類型是一種數據庫引擎的家族,諸如:mysql, mongodb, cassandra 等。
數據庫存儲管理程序版本定義了引擎的版本以及爲了實現這個引擎所包含的系統包。每種datastore類型具備幾個引擎的版本,每種類型有一個缺省的版本。 版本具備激活或者未激活狀態。 用戶能夠用激活的版本建立數據庫實例。未激活的版本對用戶不可見,用戶不能夠用未激活的版本建立數據庫實例。 可是未激活的版本能夠被已經運行的實例使用。
對每種datastore類型而言,操做者能夠指定運行實例的操做系統鏡像。對每種類型的每一個版本而言,操做者能夠指定不一樣的鏡像。這樣咱們能夠靈活的選擇鏡像,數據庫類型和版本。
每一個版本應該指定系統包的列表。 這些系統包提供了指定數據庫的指定版本的在指定鏡像上的安裝。
這裏有可能只指定一個包。可是大多數狀況下須要指定多個具備確切版本的包。 對於mysql 來講,你能夠指定server, client, shared 和 shared-compat 包。這種狀況只在你有不僅一個可用版本的狀況下才影響。 例如: 若是你僅僅指定 "mysql-server-5.5" 包,可是你又有mariadb 和 percona 可用, 你能夠將 mysql-server-5.5, mariadb-shared-5.5, percona-client-55 安裝上去。
管理的資源至此,Trove又出現了兩種新的資源:datastore_type 和 datastore_version。datastore_type容許操做者定義新的datastore 類型,datastore_type 包含如下數據:id – 一個系統定義UUID值,該值在第一次建立時賦予datastore type.name - datastore type 的名字engine – 提供操做的管理者級別的名字image_id – 鏡像的UUID,該鏡像將用於實例的部署default_version – 若是用戶不指定版本,將使用缺省版本User can see only id and name of datastore type.用戶將只能看到id 和 datastore type 的名字 datastore_version資源容許操做者定義指定數據庫類型的版本。 包含如下數據。 id -一個系統定義UUID值,該值在第一次建立時賦予datastore type.版本name - datastore type版本 的名字datastore_type – 該版本從屬的datastore 類型image_id -鏡像的UUID,該鏡像將用於實例的部署packages – 用空格隔開的系統鏡像列表,該系統鏡像提供了這個版本的datastoreactive - bool (1|0) – 表示這個版本是否被激活User can see only id and name, also user can see and use only active versions用戶將只能看到id 和 datastore type 的名字,並且用戶只可以看到和使用激活的版本。 爲了實現這個功能,操做者應在數據庫中定義datastore 類型 和 可用的版本。 trove-manage 將有如下命令:
 update_datastore_type name engine image_id 用指定的名字更新datastore type ,若是指定的名字不存在,則將新建立,本命令返回UUID 或者 datastore type 的新建或者更新的名字。 update_datastore_version datastore_type name image_id packages active 用指定的名字更新版本, 若是指定的名字不存在,則將新建立,本命令返回UUID 或者 datastore type 版本的新建或者更新的名字。
API規範用戶能夠列出數據存儲管理程序的類型和可用的版本 Datastore types list (New call)請求消息結構tGET /{tenant_id}/datastores應答消息結構{    "id": "73144fc8-f2c5-4490-a2d7-76604c4528dd",    "links": [...    ],    "name": "MongoDB"}{    "id": "e60153d4-8ac4-414a-ad58-fe2e0035704a",    "links": [...    ],    "name": "Mysql"} Show datastore type (New call)請求消息結構tGET /{tenant_id}/datastores/e60153d4-8ac4-414a-ad58-fe2e0035704a應答消息結構{    "id": "e60153d4-8ac4-414a-ad58-fe2e0035704a",    "links": [...    ],    "name": "Mysql"} Datastore type versions list (New call)請求消息結構tGET /{tenant_id}/datastores/e60153d4-8ac4-414a-ad58-fe2e0035704a/versions應答消息結構{    "id": "7d109ae8-d38f-41c8-86e4-a8e613f81be5",    "links": [...    ],    "name": "ubuntu percona-5.5.33"}{    "id": "8ae342fb-19ac-4882-8978-fe1afb38c7c7",    "links": [...    ],    "name": "fedora oracle-5.1.71"}{    "id": "94ed1f9f-6c1a-4d6e-87e9-04ecff37b64b",    "links": [...    ],    "name": "ubuntu maria-10.0.4"} Show version (New call)請求消息結構GET /{tenant_id}/datastores/versions/7d109ae8-d38f-41c8-86e4-a8e613f81be5應答消息結構{    "id": "7d109ae8-d38f-41c8-86e4-a8e613f81be5",    "links": [...    ],    "name": "ubuntu percona-5.5.33"} Create instance with specified datastore type and version (Existing call)請求消息結構POST /instances{"instance" : {      "flavorRef" : "2",      "name" : "as",      "datastore": {          "type" : "e60153d4-8ac4-414a-ad58-fe2e0035704a",          "version" : "94ed1f9f-6c1a-4d6e-87e9-04ecff37b64b"      },      "volume" : { "size" : "1" }    }}應答消息結構{    "created": "2013-10-09T10:56:56",    "flavor": {        "id": "2",        "links": [...        ]    },    "id": "86bb7492-d797-4562-b864-851c8fad7216",    "links": [...    ],    "name": "as",    "datastore": {        "type": "Mysql",        "version": "ubuntu maria-10.0.4"    },    "status": "BUILD",    "updated": "2013-10-09T10:56:56",    "volume": {        "size": 1    }} List instances (Existing call)請求消息結構tGET /instances應答消息結構{    "flavor": {        "id": "2",        "links": [...        ]    },    "id": "b1f0dff8-6303-4711-9d23-e899abc5d24d",    "links": [...    ],    "name": "as_2",    "datastore": {        "type": "Mysql"    },    "status": "ACTIVE",    "volume": {        "size": 1    }}{    "flavor": {        "id": "2",        "links": [...        ]    },    "id": "be1f10ae-afa9-4f75-808d-f7782784f363",    "links": [...    ],    "name": "as_2",    "datastore": {        "type": "Mysql"    },    "status": "ACTIVE",    "volume": {        "size": 1    }} l  Get instance (Existing call)
請求消息結構tGET /instances/be1f10ae-afa9-4f75-808d-f7782784f363應答消息結構{    "created": "2013-10-08T09:05:45",    "flavor": {        "id": "2",        "links": [...        ]    },    "id": "be1f10ae-afa9-4f75-808d-f7782784f363",    "links": [...    ],    "name": "as_2",    "datastore": {        "type": "Mysql",        "version": "ubuntu maria-10.0.4"    },    "status": "ACTIVE",    "updated": "2013-10-08T09:05:52",    "volume": {        "size": 1    }}mysql

相關文章
相關標籤/搜索