WO2014135011A1 - 数据库系统以及数据同步方法 - Google Patents

数据库系统以及数据同步方法 Download PDF

Info

Publication number
WO2014135011A1
WO2014135011A1 PCT/CN2014/072347 CN2014072347W WO2014135011A1 WO 2014135011 A1 WO2014135011 A1 WO 2014135011A1 CN 2014072347 W CN2014072347 W CN 2014072347W WO 2014135011 A1 WO2014135011 A1 WO 2014135011A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
data
memory
memory database
synchronization
Prior art date
Application number
PCT/CN2014/072347
Other languages
English (en)
French (fr)
Inventor
王松松
姚莉
严俊
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014135011A1 publication Critical patent/WO2014135011A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Definitions

  • the present invention relates to the field of memory data storage technologies, and in particular, to a database system and a data synchronization method.
  • a conventional database system is a relational database.
  • the purpose of developing such a database is to process permanent and stable data.
  • the relational database emphasizes the integrity and consistency of the maintenance data, but it is difficult to take into account the timing constraints of the data and its processing, and cannot meet the needs of real-time application of industrial production management, because real-time transactions require the system to predict the running time of the transaction more accurately.
  • the actual average execution time of the transaction differs greatly from the estimated worst case execution time due to disk access, internal and external data transfer, buffer management, queue wait, and lock delay.
  • the present invention provides a database system and a data synchronization method based on the database system, so as to at least solve the problem that after the above-mentioned in-memory database is down, the application switches back to the traditional relational database, resulting in a decrease in data access capability.
  • a database system comprising: a relational database; one or more primary in-memory databases, connected to a relational database, and a first-level in-memory database and a relational database The data is synchronously distributed and updated; one or more secondary in-memory databases are connected to the primary in-memory database, and the secondary in-memory database is a backup database of the primary in-memory database.
  • a relational database comprising: a relational database; one or more primary in-memory databases, connected to a relational database, and a first-level in-memory database and a relational database The data is synchronously distributed and updated; one or more secondary in-memory databases are connected to the primary in-memory database, and the secondary in-memory database is a backup database of the primary in-memory database.
  • there are multiple primary memory databases and each primary memory database stores data that the relational database distributes to the primary memory database according to a predetermined policy.
  • the secondary memory database is a plurality of, the secondary memory database and the first-level memory data inventory are in a one-to-one correspondence, and the data held in each secondary memory database is a full backup of the corresponding primary memory database. data.
  • a data synchronization method including: synchronizing data in a relational database to a plurality of primary in-memory databases according to a predetermined distribution policy; and data in each primary in-memory database Back up to its corresponding secondary in-memory database, and maintain data consistency between the primary in-memory database and the corresponding secondary in-memory database through real-time synchronization.
  • the method further includes: creating a primary synchronization registry in the relational database, and new in the primary synchronization registry Increase the following synchronization information records: User name, table name, data distribution policy, and destination memory database information to which the table belongs.
  • the data in the relational database is synchronized to the plurality of primary in-memory databases according to a predetermined distribution policy, including: when there is a data change operation in the relational database, the synchronization process in the relational database is monitored and detected in real time.
  • the data change operation synchronizes the data change operation to the corresponding first-level in-memory database according to the data distribution policy registered in the first-level synchronization registry, and generates a redo log redolog on the first-level in-memory database.
  • the method before backing up the data in each level 1 in-memory database to the corresponding secondary in-memory database, the method further includes: creating a secondary synchronization registry on the primary in-memory database, and new in the secondary synchronization registry Increase the following synchronization information record: User name, table name, and destination memory database information to which the table belongs.
  • the data consistency between the primary memory database and the corresponding secondary memory database is maintained by real-time synchronization, including: a synchronization process of the primary memory database detects and parses the redo log redolog in real time, and recomposes
  • the database operation statement sends the database operation statement to the corresponding secondary in-memory database according to the synchronization information record in the secondary synchronization registry, and updates the related data of the corresponding secondary in-memory database according to the database operation statement to maintain the first-level memory.
  • Data consistency between the database and the corresponding secondary in-memory database is a full backup of the data in its corresponding primary in-memory database.
  • the method further includes: when the primary in-memory database fails, switching to the corresponding secondary in-memory database.
  • the data in the primary memory database is backed up to the secondary memory database, so that when the primary memory database is down, the secondary memory database can be switched to continue to provide the memory level.
  • the high-speed data access of the database solves the problem that when the memory database is down, the application needs to switch back to the traditional relational database, resulting in a decline in data access capability, thereby achieving the effect of improving the data access efficiency of the system.
  • FIG. 1 is a schematic diagram of a database system structure according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a data synchronization method according to an embodiment of the present invention
  • FIG. 3 is a synchronization process between database systems according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a data synchronization process according to an embodiment of the present invention.
  • FIG. 1 is a schematic structural diagram of a database system according to an embodiment of the present invention. As shown in FIG.
  • the database system includes a relational database 100, three primary memory databases (201, 202, 203) and three secondary memory databases (301, 302, 303).
  • the three first-level in-memory databases (201, 202, 203) are connected to the relational database 100, and the three first-level in-memory databases (201, 202, 203) and the relational database 100 perform data synchronization through one level. Distribution and update.
  • the three secondary in-memory databases (301, 302, 303) are respectively connected to the corresponding primary in-memory database (201, 202, 203), and the secondary in-memory database is a backup database of the primary in-memory database.
  • the traditional relational database 100 can synchronously synchronize data to a primary in-memory database (201, 202, 203) according to a certain distribution strategy by first-level synchronization, so that the service can be accessed from the in-memory database (201).
  • Reading data in 202, 203) improves the performance of data access.
  • the first-level in-memory database (201, 202, 203) then backs up the data in full to the corresponding secondary in-memory database (301, 302, 303) through the second-level synchronization, and keeps the data synchronized in real time, thus, in the first-level in-memory database (201, 202, 203)
  • an unexpected downtime is not available, it can immediately switch to the corresponding secondary memory database (301, 302, 303), which has no effect on the current service usage.
  • . 2 is a flow chart of a data synchronization method in accordance with an embodiment of the present invention. As shown in FIG.
  • the data synchronization method includes the following steps: Step S202: Synchronize data in the relational database to a plurality of primary in-memory databases according to a predetermined distribution policy; Step S204, in each primary in-memory database The data is backed up to its corresponding secondary in-memory database, and the data consistency between the primary in-memory database and the corresponding secondary in-memory database is maintained through real-time synchronization.
  • Step S202 Synchronize data in the relational database to a plurality of primary in-memory databases according to a predetermined distribution policy
  • Step S204 in each primary in-memory database The data is backed up to its corresponding secondary in-memory database, and the data consistency between the primary in-memory database and the corresponding secondary in-memory database is maintained through real-time synchronization.
  • Step S202 Synchronize data in the relational database to a plurality of primary in-memory databases according to a predetermined distribution policy
  • the method further includes: creating a first-level synchronization registry in the relational database, and adding the following synchronization information record in the primary synchronization registry: a user name, a table name, a data distribution policy, a destination to which the table belongs In-memory database information.
  • Step S202 includes: when there is a data change operation in the relational database, the synchronization process in the relational database monitors and detects the data change operation in real time, and synchronizes the data change operation according to the data distribution policy registered in the primary synchronization registry.
  • step S204 further comprising: creating a secondary synchronization registry on the primary in-memory database, and in the second-level synchronization
  • step S204 includes: The synchronization process of the first-level in-memory database detects and parses the redo log redolog in real time, and reconstitutes the database.
  • the operation statement is sent according to the synchronization information record in the secondary synchronization registry to the corresponding secondary in-memory database, and the related data of the corresponding secondary in-memory database is updated according to the database operation statement to maintain the primary in-memory database.
  • the data of each secondary in-memory database is a full backup of the data in the corresponding primary in-memory database.
  • FIG. 3 is a schematic diagram of a data synchronization process in accordance with an embodiment of the present invention. As shown in FIG.
  • Step S402 A database synchronization module is deployed in a relational database.
  • Step S404 establishing a table for synchronizing data from the traditional relational database on the primary in-memory database, and establishing a table identical to the primary in-memory database on the secondary in-memory database.
  • Step S406 in the traditional relational database, create a first-level synchronization registry, and add a synchronization information record in the primary synchronization registry: the user name, the table name, and the data distribution policy to which the table belongs (first-level synchronization, two Level synchronization, etc.), destination memory database information.
  • Step S408 when there is a data change operation in the traditional relational database, the synchronization module process monitors and detects the corresponding data change in real time, and synchronizes the corresponding data change operation to the first-level in-memory database according to the data distribution policy registered in the registry. In, update the corresponding data in the related table.
  • the data in the traditional relational database can be synchronized to a plurality of in-memory databases according to a certain distribution policy.
  • Step S410 creating a secondary synchronization registry on the primary memory database, and adding a synchronization information record in the secondary synchronization registry: a user name, a table name, and a destination memory database information to which the table belongs.
  • Step S412 the user performs data change operation on the traditional relational database, and generates a corresponding redolog when the first level synchronizes to the first-level in-memory database (a mechanism established by the database to ensure that the submitted data is not lost) The generated file);
  • Step S414 the secondary synchronization process is deployed on the level memory database, and the redolog on the primary memory database is monitored and parsed in real time, and the corresponding data change operation is reorganized into a normal database operation statement, according to the steps
  • the information of the secondary in-memory database configured in S410 is sent to the secondary in-memory database and executed, so that the data in the secondary in-memory database is consistent with the data in the primary in-memory database.
  • the data in the primary in-memory database can be synchronized to the secondary in-memory database in real time, and the data in the secondary in-memory database is completely consistent with the primary in-memory database.
  • a data synchronization software is also provided for performing the technical solutions described in the above embodiments.
  • a storage medium is also provided, the software being stored, including but not limited to an optical disk, a floppy disk, a hard disk, a rewritable memory, and the like.
  • the present invention achieves the following technical effects: distributing data in a traditional relational database to a plurality of first-level in-memory databases, and simultaneously backing up data of the first-level in-memory database to the secondary memory at the same time
  • the primary memory database fails, it can switch to the secondary memory database in real time. Since the secondary memory database is a full backup of the primary memory database, the data is completely consistent, and both are in-memory databases, so For applications, features, performance, and data will not be affected. After the primary memory database fails, all accesses are switched back to the primary memory database.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Abstract

本发明提供了一种数据库系统以及数据同步方法,该数据同步方法包括:将关系型数据库中的数据按预定的分发策略同步到多个一级内存数据库中;将每个一级内存数据库中的数据备份到与其对应的二级内存数据库中,并通过实时同步保持一级内存数据库与对应二级内存数据库之间的数据一致性。通过本发明,采用将一级内存数据库中的数据备份到二级内存数据库中,这样的话,在一级内存数据库宕机时,可以切换到二级内存数据库上,从而解决了当内存数据库宕机以后,应用需切换回传统的关系型数据库,导致数据访问能力会下降的问题,进而达到了提高系统的数据访问效率的效果。

Description

数据库系统以及 ,同步方法
技术领域 本发明涉及内存数据存储技术领域, 具体而言, 涉及一种数据库系统以及数据同 步方法。 背景技术 传统的数据库系统是关系型数据库, 开发这种数据库的目的, 是处理永久、 稳定 的数据。 关系数据库强调维护数据的完整性、 一致性, 但很难顾及有关数据及其处理 的定时限制, 不能满足工业生产管理实时应用的需要, 因为实时事务要求系统能较准 确地预报事务的运行时间。 对磁盘数据库而言, 由于磁盘存取、 内外存的数据传递、 缓冲区管理、 排队等待 及锁的延迟等使得事务实际平均执行时间与估算的最坏情况执行时间相差很大, 如果 将整个数据库或其主要的 "工作"部分放入内存, 使每个事务在执行过程中没有 I/O, 则为系统较准确估算和安排事务的运行时间, 使之具有较好的动态可预报性提供了有 力的支持, 同时也为实现事务的定时限制打下了基础。 这就是内存数据库出现的主要 原因。 内存数据库所处理的数据通常是 "短暂" 的, 即有一定的有效时间, 过时则有新 的数据产生, 而当前的决策推导变成无效。 所以, 实际应用中采用内存数据库来处理 实时性强的业务逻辑处理数据。 而传统数据库旨在处理永久、 稳定的数据, 其性能目 标是高的系统吞吐量和低的代价, 处理数据的实时性就要考虑的相对少一些。 实际应 用中利用传统数据库这一特性存放相对实时性要求不高的数据。 在实际应用中这两种数据库常常结合使用,而不是以内存数据库替代传统数据库, 当内存数据库发生故障不提供服务时, 应用会切换回传统的关系型数据库, 其访问效 率较之内存数据库会有明显的下降, 并且内存数据库的恢复, 由于需要同步全量数据, 会有一定时间的消耗, 因此对现网的服务会有比较明显的影响。 针对相关技术中当内存数据库宕机以后, 应用切换回传统的关系型数据库, 导致 数据访问能力会下降的问题, 目前尚未提出有效的解决方案。 发明内容 本发明提供了一种数据库系统以及基于该数据库系统的数据同步方法, 以至少解 决上述内存数据库宕机以后, 应用切换回传统的关系型数据库, 导致数据访问能力会 下降的问题。 根据本发明的一个方面, 提供了一种数据库系统, 该数据库系统包括: 一个关系 型数据库; 一个或多个一级内存数据库, 与关系型数据库相连, 一级内存数据库与关 系型数据库之间通过数据同步进行数据的分发和更新; 一个或多个二级内存数据库, 与一级内存数据库相连, 二级内存数据库为一级内存数据库的备份数据库。 优选地, 一级内存数据库为多个, 每个一级内存数据库中保存有关系型数据库按 预定策略分发至该一级内存数据库的数据。 优选地, 二级内存数据库为多个, 二级内存数据库与一级内存数据库存在一一对 应的关系, 并且每个二级内存数据库中所保存的数据为与其对应的一级内存数据库的 全量备份数据。 根据本发明的另一方面, 提供了一种数据同步方法, 包括: 将关系型数据库中的 数据按预定的分发策略同步到多个一级内存数据库中; 将每个一级内存数据库中的数 据备份到与其对应的二级内存数据库中, 并通过实时同步保持一级内存数据库与对应 二级内存数据库之间的数据一致性。 优选地, 将关系型数据库中的数据按预定的分发策略同步到多个一级内存数据库 中之前, 还包括: 在关系型数据库中创建一级同步注册表, 并在一级同步注册表中新 增以下同步信息记录: 表所属的用户名、 表名、 数据分发策略、 目的内存数据库信息。 优选地, 将关系型数据库中的数据按预定的分发策略同步到多个一级内存数据库 中, 包括: 当关系型数据库中有数据变更操作时, 关系型数据库中的同步进程实时监 控并检测到数据变更操作, 按照一级同步注册表中登记的数据分发策略将数据变更操 作同步到对应的一级内存数据库中, 并在该一级内存数据库上生成重做日志 redolog。 优选地, 将每个一级内存数据库中的数据备份到与其对应的二级内存数据库中之 前, 还包括: 在一级内存数据库上创建二级同步注册表, 并在二级同步注册表中新增 以下同步信息记录: 表所属的用户名、 表名、 目的内存数据库信息。 优选地, 通过实时同步保持一级内存数据库与对应二级内存数据库之间的数据一 致性, 包括: 一级内存数据库的同步进程实时检测并解析重做日志 redolog, 并重组成 数据库操作语句; 根据二级同步注册表中的同步信息记录将数据库操作语句发送至对 应的二级内存数据库, 并根据数据库操作语句对对应二级内存数据库的相关数据进行 更新, 以保持一级内存数据库与对应二级内存数据库之间的数据一致性。 优选地, 每个二级内存数据库的数据为其对应的一级内存数据库中的数据的全量 备份。 优选地, 通过实时同步保持一级内存数据库与对应二级内存数据库之间的数据一 致性之后, 还包括: 当一级内存数据库出现故障时, 切换至对应的二级内存数据库。 通过本发明的上述实施例, 采用将一级内存数据库中的数据备份到二级内存数据 库中, 这样的话, 在一级内存数据库宕机时, 可以切换到二级内存数据库上, 继续提 供内存级数据库的高速数据访问, 从而解决了当内存数据库宕机以后, 应用需切换回 传统的关系型数据库, 导致数据访问能力会下降的的问题, 进而达到了提高系统的数 据访问效率的效果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的数据库系统结构示意图; 图 2是根据本发明实施例的数据同步方法流程图; 图 3是根据本发明实施例的数据库系统之间的同步过程示意图; 以及 图 4是根据本发明实施例的数据同步流程示意图。 具体实肺式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 为了便于理解, 在本发明的实施例中, 传统的关系型数据库到内存数据库的数据 同步称之为一级同步, 内存数据库再次到内存数据库的数据同步称之为二级同步。 图 1是根据本发明实施例的数据库系统结构示意图。 如图 1所示, 该数据库系统 包括一个关系型数据库 100, 三个一级内存数据库 (201、 202、 203 )和三个二级内存 数据库 (301、 302、 303 )。 其中, 三个一级内存数据库(201、 202、 203 ) 与关系型数据库 100相连, 该三个 一级内存数据库(201、 202、 203 )与关系型数据库 100之间通过一级同步进行数据的 分发和更新。 三个二级内存数据库(301、 302、 303 )分别与对应的一级内存数据库相 连 (201、 202、 203 ), 二级内存数据库为一级内存数据库的备份数据库。 在本实施例中, 通过增加二级内存数据库作为一级内存数据库的备份数据库, 这 样的话, 在一级内存数据库宕机时, 可以切换到二级内存数据库上, 继续提供内存级 数据库的高速数据访问, 从而解决了当内存数据库宕机以后, 应用需切换回传统的关 系型数据库, 导致数据访问能力会下降的的问题, 进而达到了提高系统的数据访问效 率的效果。 在上述的数据库系统中, 传统关系型数据库 100可通过一级同步将数据按照一定 的分发策略分散同步到一级内存数据库 (201、 202、 203 ) 中, 这样的话, 业务可从内 存数据库(201、 202、 203 ) 中进行数据的读取, 提高了数据访问的性能。 一级内存数 据库(201、 202、 203 )再通过二级同步将数据全量备份到对应的二级内存数据库(301、 302、 303 ) 中, 并实时保持数据的同步, 这样, 在一级内存数据库 (201、 202、 203 ) 出现意外宕机不能使用时, 能够立即切换到对应的二级内存数据库(301、 302、 303 ), 对当前的业务使用不产生任何的影响。 一级同步和二级同步的结合, 既提高了数据读 取的速度,又保证了在一级内存库以外宕掉时, 能够及时的切换到二级内存数据库上, 数据的访问不受任何影响。 图 2是根据本发明实施例的数据同步方法流程图。 如图 2所示, 该数据同步方法 包括以下步骤: 步骤 S202,将关系型数据库中的数据按预定的分发策略同步到多个一级内存数据 库中; 步骤 S204 , 将每个一级内存数据库中的数据备份到与其对应的二级内存数据库 中, 并通过实时同步保持一级内存数据库与对应二级内存数据库之间的数据一致性。 在本实施例中, 通过将一级内存数据库中的数据备份到二级内存数据库中, 这样 的话, 在一级内存数据库宕机时, 可以切换到二级内存数据库上, 继续提供内存级数 据库的高速数据访问, 从而解决了当内存数据库宕机以后, 应用需切换回传统的关系 型数据库, 导致数据访问能力会下降的的问题, 进而达到了提高系统的数据访问效率 的效果。 其中, 在步骤 S202之前还包括: 在关系型数据库中创建一级同步注册表, 并在一 级同步注册表中新增以下同步信息记录: 表所属的用户名、 表名、 数据分发策略、 目 的内存数据库信息。 其中, 步骤 S202包括: 当关系型数据库中有数据变更操作时, 关系型数据库中的 同步进程实时监控并检测到数据变更操作, 按照一级同步注册表中登记的数据分发策 略将数据变更操作同步到对应的一级内存数据库中, 并在该一级内存数据库上生成重 做曰志 redologo 其中, 在步骤 S204之前还包括: 在一级内存数据库上创建二级同步注册表, 并在 二级同步注册表中新增以下同步信息记录: 表所属的用户名、 表名、 目的内存数据库 γ=自 其中, 步骤 S204 包括: 一级内存数据库的同步进程实时检测并解析重做日志 redolog, 并重组成数据库操作语句; 根据二级同步注册表中的同步信息记录将数据库 操作语句发送至对应的二级内存数据库, 并根据数据库操作语句对对应二级内存数据 库的相关数据进行更新, 以保持一级内存数据库与对应二级内存数据库之间的数据一 致性。 其中, 每个二级内存数据库的数据为其对应的一级内存数据库中的数据的全量备 份。 其中,在步骤 S204之后还包括:通过实时同步保持一级内存数据库与对应二级内 存数据库之间的数据一致性之后, 还包括: 当一级内存数据库出现故障时, 切换至对 应的二级内存数据库。 在上述实施例中, 在传统关系型数据库的数据分发到多个一级内存数据库上的同 时, 将一级内存数据库的数据完全同步一份到二级内存数据库中, 这样保证了一级、 二级内存数据库中数据的一致性。 当一级内存数据库意外宕掉时, 可以实时的切换到 二级内存数据库上, 保证了数据的完整性以及数据访问的速度。 图 3是根据本发明实施例的数据同步过程示意图。 如图 3所示, 当传统关系型数 据库 100上发生数据变更时, 关系型数据库 100会通过一级同步将该变更实时同步到 一级内存数据库 200, 并在该一级内存数据库 200上生成重做日志 redolog; 二级同步 进程实时去检测并解析该重做日志 redolog, 同时重组成正常的数据库操作语句对二级 内存数据库 300的相关数据进行更新,保证一级内存数据库 200与二级内存数据库 300 中数据的一致性。 图 4是根据本发明实施例的数据同步流程示意图。 如图 4所示, 本实施例的数据 同步流程包括如下步骤: 步骤 S402, 在关系型数据库部署数据库同步模块。 步骤 S404, 在一级内存数据库上建立需要从传统关系型数据库中同步数据的表, 在二级内存数据库上建立与一级内存数据库相同的表。 步骤 S406, 在传统的关系型数据库中, 创建一级同步注册表, 并在一级同步注册 表中新增同步信息记录: 表所属的用户名、 表名、 数据分发策略 (一级同步, 二级同 步等)、 目的内存数据库信息。 步骤 S408, 当传统关系型数据库中有数据变更操作, 同步模块进程会实时监控并 检测到相应的数据变更, 按照注册表中登记的数据分发策略, 将相应的数据变更操作 同步到一级内存数据库中, 更新相关表中对应的数据。 通过上述步骤 S402至 S408可以将传统关系型数据库中的数据按照一定的分发策 略同步到多个内存数据库中。 步骤 S410, 在一级内存数据库上创建二级同步注册表, 并在二级同步注册表中新 增同步信息记录: 表所属的用户名、 表名、 目的内存数据库信息。 由于二级同步是全 量同步, 这里需要填上相应一级内存数据库中所有的表名, 即全量同步。 步骤 S412, 用户在传统关系型数据库上进行数据变更的操作, 在一级同步到一级 内存数据库上时, 生成相应的 redolog (数据库为确保已经提交的数据不会丢失而建立 的一种机制所产生的文件); 步骤 S414, —级内存数据库上部署了二级同步进程, 实时的监控并解析一级内存 数据库上的 redolog, 将相应的数据变更操作重组为正常的数据库操作语句, 根据步骤 步骤 S410中配置的二级内存数据库的信息,将相关数据库操作语句发送到二级内存数 据库上并执行, 使二级内存数据库中的数据保持与一级内存数据库中的数据一致。 通过上述步骤 S410至 S414, 可以将一级内存数据库中的数据实时的同步到二级 内存数据库中, 保证二级内存数据库中的数据与一级内存数据库中完全一致。 在另外一个实施例中, 还提供了一种数据同步软件, 该软件用于执行上述实施例 中描述的技术方案。 在另外一个实施例中, 还提供了一种存储介质, 该存储介质中存储有上述软件, 该存储介质包括但不限于光盘、 软盘、 硬盘、 可擦写存储器等。 从以上的描述中, 可以看出, 本发明实现了如下技术效果: 将传统关系型数据库中的数据分发到多个一级内存数据库, 并同时将一级内存数 据库的数据全量备份到二级内存数据库中, 在一级内存数据库发生故障时, 能够实时 的切换到二级内存数据库, 由于二级内存数据库是一级内存数据库的全量备份, 数据 是完全一致的, 而且都是内存数据库, 所以对于应用来说, 功能、 性能和数据将不受 任何影响。 在一级内存数据库故障恢复后, 所有的访问将切换回一级内存数据库。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。

Claims

权 利 要 求 书 一种数据库系统, 包括:
一个关系型数据库;
一个或多个一级内存数据库, 与所述关系型数据库相连, 所述一级内存数 据库与所述关系型数据库之间通过数据同步进行数据的分发和更新;
一个或多个二级内存数据库, 与所述一级内存数据库相连, 所述二级内存 数据库为所述一级内存数据库的备份数据库。 根据权利要求 1所述的数据库系统, 其中, 所述一级内存数据库为多个, 每个 一级内存数据库中保存有所述关系型数据库按预定策略分发至该一级内存数据 库的数据。 根据权利要求 2所述的数据库系统, 其中, 所述二级内存数据库为多个, 二级 内存数据库与一级内存数据库存在一一对应的关系, 并且每个二级内存数据库 中所保存的数据为与其对应的一级内存数据库的全量备份数据。 一种数据库系统的数据同步方法, 包括:
将关系型数据库中的数据按预定的分发策略同步到多个一级内存数据库 中;
将每个所述一级内存数据库中的数据备份到与其对应的二级内存数据库 中, 并通过实时同步保持所述一级内存数据库与对应所述二级内存数据库之间 的数据一致性。 根据权利要求 4所述的数据同步方法, 其中, 将所述关系型数据库中的数据按 预定的分发策略同步到多个所述一级内存数据库中之前, 还包括:
在所述关系型数据库中创建一级同步注册表, 并在所述一级同步注册表中 新增以下同步信息记录: 表所属的用户名、 表名、 数据分发策略、 目的内存数 据库信息。 根据权利要求 5所述的数据同步方法, 其中, 将所述关系型数据库中的数据按 预定的分发策略同步到多个所述一级内存数据库中, 包括: 当所述关系型数据库中有数据变更操作时, 所述关系型数据库中的同步进 程实时监控并检测到所述数据变更操作, 按照所述一级同步注册表中登记的数 据分发策略将所述数据变更操作同步到对应的一级内存数据库中, 并在该一级 内存数据库上生成重做日志 redolog。 根据权利要求 6所述的数据同步方法, 其中, 将每个所述一级内存数据库中的 数据备份到与其对应的所述二级内存数据库中之前, 还包括:
在所述一级内存数据库上创建二级同步注册表, 并在所述二级同步注册表 中新增以下同步信息记录: 表所属的用户名、 表名、 目的内存数据库信息。 根据权利要求 7所述的数据同步方法, 其中, 通过实时同步保持所述一级内存 数据库与对应所述二级内存数据库之间的数据一致性, 包括:
所述一级内存数据库的同步进程实时检测并解析所述重做日志 redolog,并 重组成数据库操作语句;
根据所述二级同步注册表中的同步信息记录将所述数据库操作语句发送至 对应的二级内存数据库, 并根据所述数据库操作语句对所述对应二级内存数据 库的相关数据进行更新, 以保持所述一级内存数据库与对应所述二级内存数据 库之间的数据一致性。 根据权利要求 4至 8任一项所述的数据同步方法, 其中, 每个二级内存数据库 的数据为其对应的一级内存数据库中的数据的全量备份。 根据权利要求 9所述的数据同步方法, 其中, 通过实时同步保持所述一级内存 数据库与对应所述二级内存数据库之间的数据一致性之后, 还包括:
当所述一级内存数据库出现故障时, 切换至对应的所述二级内存数据库。
PCT/CN2014/072347 2013-08-29 2014-02-21 数据库系统以及数据同步方法 WO2014135011A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310386194.9 2013-08-29
CN201310386194.9A CN104424275A (zh) 2013-08-29 2013-08-29 数据库系统以及数据同步方法

Publications (1)

Publication Number Publication Date
WO2014135011A1 true WO2014135011A1 (zh) 2014-09-12

Family

ID=51490622

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/072347 WO2014135011A1 (zh) 2013-08-29 2014-02-21 数据库系统以及数据同步方法

Country Status (2)

Country Link
CN (1) CN104424275A (zh)
WO (1) WO2014135011A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046100A (zh) * 2019-11-25 2020-04-21 武汉达梦数据库有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN116205397A (zh) * 2023-02-10 2023-06-02 广州市中大信息技术有限公司 一种基于大数据的数字化企业管理系统及方法

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866556B (zh) * 2015-05-15 2019-07-23 北京奇虎科技有限公司 数据库的故障处理方法、装置和数据库系统
CN106934044B (zh) * 2017-03-16 2020-02-14 北京深思数盾科技股份有限公司 一种数据处理方法及装置
CN108614892A (zh) * 2018-05-09 2018-10-02 浪潮软件集团有限公司 一种基于redolog的Oracle数据实时同步方法
CN109733444B (zh) * 2018-09-19 2020-05-19 比亚迪股份有限公司 数据库系统和列车监控管理设备
CN112000646B (zh) * 2020-08-25 2022-08-02 北京浪潮数据技术有限公司 一种数据库初始化方法、装置及电子设备和存储介质
CN115981879B (zh) * 2023-03-16 2023-05-23 北京全路通信信号研究设计院集团有限公司 一种冗余结构的数据同步方法、装置、设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172051A1 (en) * 2007-12-31 2009-07-02 Bill Huffman Online incremental database dump
CN102033930A (zh) * 2010-12-17 2011-04-27 北京世纪互联工程技术服务有限公司 分布式内存数据库系统
CN102937955A (zh) * 2011-11-29 2013-02-20 Ut斯达康通讯有限公司 一种基于MySQL双存储引擎的内存数据库实现方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101034364A (zh) * 2007-04-02 2007-09-12 华为技术有限公司 一种实现内存数据备份的方法、装置和系统
US20130097632A1 (en) * 2009-05-27 2013-04-18 Ajay Shah Synchronization to broadcast media
CN101887388B (zh) * 2010-06-18 2014-03-12 中兴通讯股份有限公司 基于内存数据库的数据备份系统和方法
US8332433B2 (en) * 2010-10-18 2012-12-11 Verisign, Inc. Database synchronization and validation
CN102508881B (zh) * 2011-10-18 2014-07-02 国网电力科学研究院 一种电力信息系统内存数据库的多节点集群系统
CN102737127B (zh) * 2012-06-20 2015-04-08 厦门大学 一种海量数据存储方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172051A1 (en) * 2007-12-31 2009-07-02 Bill Huffman Online incremental database dump
CN102033930A (zh) * 2010-12-17 2011-04-27 北京世纪互联工程技术服务有限公司 分布式内存数据库系统
CN102937955A (zh) * 2011-11-29 2013-02-20 Ut斯达康通讯有限公司 一种基于MySQL双存储引擎的内存数据库实现方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046100A (zh) * 2019-11-25 2020-04-21 武汉达梦数据库有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN111046100B (zh) * 2019-11-25 2024-03-08 武汉达梦数据库股份有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN116205397A (zh) * 2023-02-10 2023-06-02 广州市中大信息技术有限公司 一种基于大数据的数字化企业管理系统及方法
CN116205397B (zh) * 2023-02-10 2023-10-20 广州市中大信息技术有限公司 一种基于大数据的数字化企业管理系统及方法

Also Published As

Publication number Publication date
CN104424275A (zh) 2015-03-18

Similar Documents

Publication Publication Date Title
WO2014135011A1 (zh) 数据库系统以及数据同步方法
CN102955845B (zh) 数据访问方法、装置与分布式数据库系统
EP3039844B1 (en) System and method for supporting partition level journaling for synchronizing data in a distributed data grid
WO2010148822A1 (zh) 基于多副本协同的写操作方法、系统及节点
US20130218840A1 (en) System and method for building a point-in-time snapshot of an eventually-consistent data store
EP2954424B1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN103150347A (zh) 基于文件热度的动态副本管理方法
CN103581332B (zh) HDFS架构及HDFS架构中NameNode节点的压力分解方法
WO2015192661A1 (zh) 一种分布式存储系统中的数据同步方法、装置及系统
US20120278344A1 (en) Proximity grids for an in-memory data grid
CN102098342A (zh) 一种基于事务级的数据同步方法、装置及系统
WO2010148988A1 (zh) 接管故障元数据服务器的方法、装置及系统
EP4213038A1 (en) Data processing method and apparatus based on distributed storage, device, and medium
EP3080697A1 (en) System and method for supporting persistence partition recovery in a distributed data grid
US20120278429A1 (en) Cluster system, synchronization controlling method, server, and synchronization controlling program
CN102710763A (zh) 一种分布式缓存池化、分片及故障转移的方法及系统
WO2017092384A1 (zh) 一种集群数据库分布式存储的方法和装置
CN105069152A (zh) 数据处理方法及装置
WO2014177085A1 (zh) 分布式多副本数据存储方法及装置
CN103365740B (zh) 一种数据冷备方法及装置
CN103428288A (zh) 基于分区状态表和协调节点的副本同步方法
US11023324B2 (en) Harmonization of failure domains in a distributed system
CN104991739A (zh) 元数据服务器失效接替中精确一次执行语义的方法及系统
CN105302817A (zh) 分布式文件系统管理方法和装置
CN103117883A (zh) 一种分组设备运行状态同步方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14759703

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14759703

Country of ref document: EP

Kind code of ref document: A1