背景
Trove是Openstack官方的database-as-a-service項目,最初大家都以Amazon的RDS與之比較,現在開來,小看了Trove的野心,trove的代碼中已經開始支援很多NoSQL資料庫的管理。不再多說,這裡先從API和功能上來認識trove。
API中涉及的資源和操作
resource | operation |
db_instance | list all database instances |
create a new database instance | |
get information about a specific database instance | |
delete a specific database instance | |
db_instance_action | restart a specific database instance |
resize a specific database instance | |
resize the volume of a specific databse instance | |
database | create a new database on an instance |
list database on a instance | |
delete a databse on an instance | |
user | create a new user |
list users | |
change users' password | |
get details for user | |
list users' database | |
add database privileges to user | |
remove database privileges for user | |
enable root user | |
get the status of root user | |
delete user | |
flavor | list all flavors |
get aspecific flavor | |
security_group | list all security groups |
get details for a specific security group | |
create a new rule for a security group | |
delete a specific security group rule | |
backup | list all backups |
get details for a pecific backup | |
create a backup for an instance | |
restore a backup to instance | |
delete a backup | |
datastore | list all datastores |
get detailfs for a specific datastore | |
datastore_version | list all versions for a datastore |
get details for a datastore version | |
configuration | get a list of defined configuration groups for the tenant |
get the specified configuration group | |
get a list of instances that are associated with the configuration | |
create a new configuration group | |
update configuration items | |
replace all configuration items | |
delete a configuration group | |
configuration_parameter | get a list of configration parameters |
get the details of a configuration paramter | |
db_instance_log(規劃中) | get a list of all available database logging files for all datastore version |
get a list of all available database logging files per givern datastore version | |
create and save database logging file entry |
API解讀
1.這裡的datastore和datastore_version是指存儲資料的資料庫管理程式和它的版本。例如trove現在支援的資料庫管理程式有MySQL、cassandra、mongodb,datastore就是指的是這些。而datastore_version是指這些資料庫管理程式的版本,例如5.1,還是5.5之類的。這裡可以看到對于datastore和datastore_version,隻有查詢操作,這也是很正常的,對于DBaaS的服務來說,也隻能支援指定的若幹資料庫類型。這兩個resource用來在create db instance的時候供使用者選擇。
2.flavor是從nova中擷取的預先設定好的幾種虛拟機規格,隻提供查詢操作,供使用者選擇。
3.configuration是指資料庫程式配置檔案中一堆的配置項,這些配置項由key-value的形式組成;
而configuration_parameter是對配置項key的詳細資訊的記錄,它包括配置參數的預設值、是否應該配置、是否可以動态生效以及資料類型是什麼。
4.從API我們可以看到security group的操作中沒有建立操作,這是因為資料庫安全組的目前的設計原則決定的。trove對于security group的目前的設計是:每個資料庫執行個體對應一個安全組,使用者不能直接操作安全組,隻能添加或删除安全組的規則。未來這個設計可能改變,同時會在加入預設的安全規則集。
5.資料庫日志檔案可以被儲存并上傳到swift上。
總結
從Trove的REST API來看,基本上與Amazon的RDS提供的基本功能類似,帶有鮮明的關系資料庫管理的特征。
疑問
這套API用來管理專門用來處理大資料的NoSQL資料庫到底是怎樣的?由于database是在instance之下管理的資源,那麼建立一個跑在單個虛拟機執行個體上的Cassandra資料庫,有什麼用呢?
參考資料
http://docs.hpcloud.com/api/v13/dbaas/#ds_resource-jumplink-span
https://github.com/openstack/database-api/blob/master/openstack-database-api/src/markdown/database-api-v1.md
https://wiki.openstack.org/wiki/Trove/Configurations
https://wiki.openstack.org/wiki/Trove/trove-security-groups
https://wiki.openstack.org/wiki/Trove/trove-versions-types
https://wiki.openstack.org/wiki/Trove/DBInstanceLogOperation