背景


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