节点文献
Cassandra数据库迁移工具设计与实现
The Design and Implementation of Cassandra Migration Tool
【作者】 吴冲;
【导师】 董守玲; Guillaume Raschia;
【作者基本信息】 华南理工大学 , 计算机技术(专业学位), 2015, 硕士
【摘要】 当今社会,大多数应用程序都是需要管理大量数据的企业应用程序。从事这类项目的开发团队常常将数据库视为与应用程序完全脱离的单独实体。造成这种现象的原因是组织结构经常将数据库团队从应用程序开发团队分离出来。这种分离导致了一定的问题:需要手工变更数据库,不能与团队的其他成员分享数据库变更,不同的人可能使用不一致的方法变更数据库或数据,数据库版本之间变更的手工管理方法效率低下,使开发人员无法与数据变更保持同步。而且,还可能使应用程序的用户遇到与数据不一致和数据损坏等问题。鉴于手工迁移数据库的问题,企业更倾向于使用自动化迁移工具来完成数据库的迁移,但是目前存在的绝大多数此类工具都是面向于传统的关系型数据库,对于新型的Nosql,如我们公司所使用的Cassandra,并没有太多的选择。本文介绍一款用于Cassandra的自动化数据库迁移工具的设计。该工具的目标是对指定的目录下的CQL脚本和JAVA脚本进行分析,检测哪些脚本已执行或未执行,然后生成一个执行任务列表。根据该执行列表上的任务执行脚本,在执行过程中记录执行日志,便于开发者后来进行调试,并将执行过程中的状态记录在数据库的一张名为VersionTable表中。该工具采用Java语言编写,使用Maven作为项目管理工具来完成自动化部署工作。通过Maven的本地化配置,企业现有的平台能够很好的使用该工具。经过测试,在使用该数据库迁移工具后,企业的开发人员能够清楚数据库的状态,知道哪些脚本已经执行,并可根据执行日志来修正脚本中的语法错误,大大提高了生产效率。
【Abstract】 Nowadays,most applications need to manage a lot of enterprise data.Development teams engaged in such projects often treated database and application as the separate entities.The reason for this phenomenon is that the organization separates the database team from the application development teams.This separation leads to some problems: manual changes to the database,the database can not be shared with other members of the team change,alter database using inconsistent methods or data,use inefficient manual methods to manage database versions.These practices are inefficient,so that developers can not be changed to keep pace with the data.Moreover,it results in the data inconsistencies and data corruption.In view of the problem manually migrate databases,enterprise development prefer to use the automated migration tool to complete the migration of the database,such as Flyway.However,most of these existing tools are oriented to traditional relational databases,it can be a good support for SQL scripts.But for the new Nosql,such as Cassandra that our used,we have no much choice.This paper presents the design of a Cassandra automated database migration tool.Cassandra uses CQL language to define and write the data model and supports JAVA client.The goal of the tool is to detect and analysis CQL scripts and JAVA scripts under the indicated directory,decide which script has been executed or not executed,and then generate a list of tasks to perform.Then according to the task list,it executes scripts one by one,records the execution log to facilitate developers to debug later,and keep track of the status of the process in a database table called VersionTable.The tool uses the Java language and use Maven as a project management tool to automate deployment.By Maven configuration in local,the existing platform takes advantage of this tool well.After testing,it reached the goal: the developers understand well the state of the database,know what the script has been executed with the use of the database migration tool.They correct grammatical errors according to the script execution log.This greatly improves production efficiency.
- 【网络出版投稿人】 华南理工大学 【网络出版年期】2017年 06期
- 【分类号】TP311.13
- 【下载频次】65