WO2012159575A1 - 一种双活系统间动态数据同步的方法 - Google Patents
一种双活系统间动态数据同步的方法 Download PDFInfo
- Publication number
- WO2012159575A1 WO2012159575A1 PCT/CN2012/076005 CN2012076005W WO2012159575A1 WO 2012159575 A1 WO2012159575 A1 WO 2012159575A1 CN 2012076005 W CN2012076005 W CN 2012076005W WO 2012159575 A1 WO2012159575 A1 WO 2012159575A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- synchronization
- primary
- standby
- request
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/275—Synchronous replication
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Definitions
- the present invention relates generally to data disaster recovery, and more particularly to dynamic data synchronization between active and standby systems. Background technique
- Data disaster recovery is a data disaster backup. It refers to the process of copying a whole system or part of data collection from the application host's hard disk or array to other storage media to prevent data loss caused by operational errors or system failures.
- the purpose of implementing disaster backup is to ensure that data security and critical services of critical information systems can be continuously serviced, improve the ability to withstand disasters, and reduce the damage caused by disasters.
- a disaster backup system is an integral part of the entire information system, not a separate system that is outside the production system.
- Data disaster recovery services originated in the 1970s and have become one of the fastest growing industries in the information industry in developed countries. In industries with high levels of informationization, such as government, finance, telecommunications, transportation, energy, public services, and large manufacturing/retail industries, disaster recovery applications are extremely widespread.
- the banking industry is one of the most widely used industries for information technology. With the rapid development of bank information construction, most of the bank information systems adopt a large centralized mode of centralized data storage and centralized processing. This centralized mode has many advantages while bringing great benefits.
- One aspect is multi-point.
- the diversified risk pooling has become a concentrated risk in the data center. Once a technical failure (such as hardware failure, human error, and virus damage) occurs at the center, the consequences will be catastrophic. Therefore, the high reliability of data storage, the prevention of disasters, and the rapid recovery of disasters, have become an extremely important part of the bank's information security work.
- the backup system can quickly take over the work of the primary system, keeping the entire working environment normal.
- the primary system and the backup system may be two systems that function the same under normal conditions and operate independently of each other, It is called the active/standby dual-active system.
- the active/standby dual-active system operations such as dynamic data and configuration data are usually involved.
- Data synchronization between active and standby systems that are active at the same time.
- the backup system can completely replace the main system in time to improve the reliability of the system.
- the primary system or the backup system itself often obtains source data update information from each unit in the system by polling, for example, by polling to check whether the time corresponding to each unit data occurs. Variety.
- the disadvantage of this approach is that the update always has hysteresis, especially in the case of a large amount of dynamic data, polling will take more time and affect the operation of the corresponding unit.
- the present invention provides a method for implementing dynamic data synchronization in a primary-active dual-active system, the primary-active dual-active system including a primary system and a backup system, and the primary system and the standby system.
- the system can be the source and destination of each other.
- the method includes the following steps: the source end packs data to be synchronized and corresponding information into an isochronous data packet according to a local data synchronization request; the source end transmits the synchronous data packet to a location according to a predetermined communication manner.
- the data synchronization request includes a POS terminal check-in request and a POS terminal batch settlement request.
- the information includes a data type of the data to be synchronized and an operation type corresponding to the data type.
- the method further comprises determining the data type based on the data synchronization request.
- the destination end performs an update operation on the data to be synchronized according to the data type and operation type obtained by unpacking.
- the updating operation includes both an operation of updating the data to be synchronized to a database of the destination, and an operation of updating the data to be synchronized to the shared memory.
- the information includes timestamp information that is locally updated by the data to be synchronized.
- the destination end compares the update time of the local current data with the timestamp obtained by unpacking before performing the data update, and only updates the data to be synchronized than the local current data. The destination end performs the data update operation.
- the predetermined communication mode may be a message queue mode; if the primary device and the backup device are in a different location, The predetermined communication method may be a network communication method. In the case of synchronizing packets, the isochronous packets are re-batched according to the trigger condition.
- the invention provides a dynamic data synchronization method in an active/standby dual active system, which is different from the method of obtaining source data update information by polling a database file, but adopts a triggered data synchronization mechanism, that is, active or standby.
- the system initiates the synchronization process based on an operation request from its access node that causes a data change, thereby greatly improving the real-time performance of the synchronization.
- the present invention also greatly reduces the amount of data that needs to be transmitted by transmitting operation type information, thereby improving synchronization efficiency.
- the method provided by the present invention has less impact on both the primary system and the backup system, and can improve the flexibility of data transmission.
- Figure 1 is a schematic illustration of a first embodiment of a method in accordance with the present invention
- Figure 2 is a schematic illustration of a second embodiment of the method in accordance with the present invention.
- FIG. 3 is a schematic diagram of a primary and secondary active-active system to which the present invention is applied. detailed description
- the terms “primary system” and “standby system” are used herein, but it should be understood that the method provided by the present invention is applicable to the dynamics between any two systems having the features described herein. data synchronization.
- the method provided by the present invention will be described hereinafter in the context of banking system applications, but it should be understood that the method can be applied to any situation where an active/standby dual active system is required to disaster data.
- Figure 1 is a schematic illustration of a first embodiment of a method in accordance with the present invention.
- the primary system is the source and the standby system is the destination is shown.
- the method of the present invention is applicable to the case where the primary system and the backup system are mutually backed up. Therefore, in practice, the standby system may perform the operation of the source end, and the primary system performs the operation of the destination end, or both sides. Each operates as both a source and a destination.
- the primary and backup systems may be a bank's POS center system, and the system is connected to a plurality of POS terminals for accepting, processing, or forwarding transaction request information of the POS terminal, and sending back transaction result information to the POS terminal.
- Multiple POS terminals can be connected to the primary POS center and the standby POS center at the same time. The services of some of the POS terminals are handled by the primary POS center, and the services of the remaining POS terminals are processed by the standby POS center. These POS terminals can be considered. It is the node that accesses the primary or backup system. There is a constant need for data synchronization between the primary and backup POS centers so that in the event of a system failure, the services of the POS terminal it is responsible for can be taken over by another system.
- each synchronization process is performed by one system
- the data synchronization request within is initiated.
- the data synchronization request is an operation request from an access node of the primary system or the backup system to cause a data change.
- the POS center system each time a POS terminal needs to conduct a transaction, it will send a check-in request to the POS center.
- the POS sign-in is online, and the POS terminal will send the terminal number, merchant number, and operator code to the POS center.
- the POS center After verifying the validity of the merchant and the terminal, the POS center will generate the terminal work key, extract the transaction batch number,
- the POS center's transaction date and time will be passed down to the POS terminal.
- the check-in transaction has the following three functions: a) The terminal is synchronized with the batch number of the POS center host. b) The terminal obtains a new terminal work key from the POS center host. c) The terminal obtains the date and time of the host from the POS center host. Obviously, in this information interaction process, new data is generated. Therefore, the POS center system will treat the check-in request as a data synchronization request to initiate the corresponding synchronization process.
- the primary system will first determine the data type of the data to be synchronized based on the data synchronization request it receives after synchronizing the data to the backup system.
- the correspondence between data synchronization requests and data types can be predetermined based on the business functions of the primary and secondary systems. Taking the above POS sign-in request as an example, the data type corresponding to the request may be "terminal work key". Additionally, in this embodiment, an operation type corresponding to the data type may also be predetermined, which operation type may be used to indicate how the backup system processes the received data.
- synchronization between active and standby systems involves only updating data from one system's database to another, resulting in sometimes excessive data on the communication link, resulting in reduced transmission reliability.
- the primary system In the case of adding an operation type, the primary system will no longer need to pass all the difference data to the standby system. Conversely, it can transmit only a part of the data and the operation corresponding to the part of the data, and the standby data makes the same change of the data of the destination end as a whole by performing corresponding operations on the part of the data.
- the primary system can determine the data type as the "terminal work key” and determine the operation type as "check-in information synchronization update".
- the POS terminal will also send a batch settlement request to the POS center system.
- the end The terminal will send the total debit amount of the batch transaction, the total number of debits, the total amount of the goods, and the total number of goods to the POS center.
- the batch settlement is completed, that is, after the reconciliation is completed or the batch is delivered, the transaction record is cleared, and the batch number is incremented by 1, forming a new batch number.
- it will generate multiple update operations on the primary system.
- the primary system may first determine the data type as "batch settlement information", and then define update operations related to the batch settlement processing according to specific conditions. .
- the primary system can define the type of operation as "batch settlement information synchronization update" similarly to the case of the aforementioned check-in request.
- the primary system After determining the required data and corresponding information, the primary system packages the content together into an isochronous packet, the format of which may depend on the manner of communication between the primary system and the alternate system.
- the primary system can add timestamp information that is locally updated to the synchronization data packet in the synchronization data packet.
- the completed data packet will be transmitted to the backup system in accordance with the predetermined communication method. For example, when the active and standby systems are two POS center systems that are backed up in each other in a computer room, a message queue communication mechanism can be used between them. When the primary and backup systems are two systems in different locations, network communication can be used. It should be understood that communication methods that are common in the prior art can be used between active and standby active systems.
- the backup system After receiving the above synchronous data packet, the backup system will first perform the unpacking operation accordingly, thereby obtaining information such as time stamp, data type, operation type and the like. In the case of using a timestamp, the backup system compares the update time of the local current data with the timestamp obtained by unpacking, and only if the data to be synchronized is updated than the local current data, The data update operation is performed.
- This method can avoid the problem of inconsistent data update results caused by inconsistent data transmission order and arrival order caused by communication transmission. For example, at the primary system, a key may be generated twice due to an POS terminal response error, and the subsequent valid key update may arrive at the backup system first, and the previous invalid key is updated.
- the backup system can determine the update operation that does not need to be arrived after the timestamp based on the timestamp, thereby ensuring that the current data block is always up to date.
- the backup system then performs its local data update operations by data type and operation type information.
- the data type is "terminal work key” and the operation type
- the standby system will store the new terminal work key data to the corresponding location in its database.
- the terminal work key is generally only stored in the database, so in the above case only the data needs to be updated to the database.
- an organization reset key transaction there is also a synchronous update to the organization key, and such an organization key is typically stored both in the database and in the shared memory. Therefore, for the organization key synchronization, after receiving the data synchronization request on the standby system, both the database and the shared memory are updated.
- the standby system updates several tables in the database that involve “batch number”. This is different from the above-mentioned terminal work key update. Generally, the former only needs to update one key table in the standby system.
- the standby system processes the "check-in information synchronization update”
- the backup system also performs the corresponding "batch settlement information synchronization update” operation, that is, in the batch settlement information table.
- the newly added terminal constructs a batch settlement information structure.
- the active or standby system triggers the synchronization process according to the operation request of the access node that causes the data to change, so that the data can be synchronized in a timely manner, thereby improving the reliability of the disaster recovery.
- the transfer operation type information reduces the load on the communication link between the primary and backup systems, and the time stamp mechanism avoids the writing of "dirty data". It can be seen that the method provided by the present invention makes the dynamic data synchronization process of the online system less affected by the active and standby systems, thereby greatly promoting dynamic bidirectional data synchronization between the active and standby active-active systems.
- FIG. 2 is a schematic diagram of a second embodiment of a method in accordance with the present invention, which is applicable to a failback scenario after a communication interruption occurs between the primary and secondary systems or one of the failures is restored.
- the operation flow of the active system as the source end and the standby system as the destination end is shown in the figure, but in practice, the source side operation may be performed by the standby system, and the target system performs the destination end. Operation, or both sides operate as both source and destination.
- the primary system since the primary system cannot communicate with the backup system in real time, it does not initiate separate data synchronization in response to the operation request of the access node, but is synchronized.
- the trigger condition for waiting for communication recovery initiates batch synchronization, that is, multiple synchronization data packets are transmitted together to the standby.
- batch synchronization that is, multiple synchronization data packets are transmitted together to the standby.
- information such as data type, operation type, and timestamp is still stored, and the entire operation process is substantially the same as the example shown in FIG.
- the packets that need to be transmitted can be determined according to the specified time range. Due to this bulk transfer mechanism, the method according to the invention has a good real-time performance on the one hand and an ideal communication interruption between systems on the other hand.
- FIG. 3 is a schematic diagram of a primary and secondary active-active system to which the present invention is applied.
- System A and System B are backups of each other and process the service requests independently at runtime.
- the two systems have an internal disaster recovery synchronization module locally.
- the receiving module 1 corresponds to the update of the local primary data source by the system
- the receiving module 2 corresponds to the update of the local standby data source by the system.
- System A updates the backup data source and sends the update information to the remote system B through the communication gateway a.
- system B receives the data synchronization request, it updates the new data information to its primary data source and standby data source at receiving module 1 and receiving module 2, respectively.
- the method provided by the present invention can be applied to the update of the internal data source of System A or System B and the update between System A and System B.
- the technical solution for dynamic data synchronization between systems described herein can be implemented as software, firmware, hardware, or any combination thereof.
- it can be in hardware logic (such as integrated circuit chips, programmable gate arrays, application specific integrated circuits, etc.), computer readable media (such as hard drives, floppy disks, magnetic tapes, CD-ROMs, optical disks, etc.) or volatile and Code or logic implemented in a non-volatile storage device (such as EEPROM, ROM, PROM, RAM, DRAM, SRAM, etc.). Code in a computer readable medium can be accessed and executed by a processor.
- hardware logic such as integrated circuit chips, programmable gate arrays, application specific integrated circuits, etc.
- computer readable media such as hard drives, floppy disks, magnetic tapes, CD-ROMs, optical disks, etc.
- volatile and Code or logic implemented in a non-volatile storage device such as EEPROM, ROM, PROM, RAM, DRAM, SRAM, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Hardware Redundancy (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明提供了一种用于在主备双活系统中实现动态数据同步的方法。所述主备双活系统包括主用系统和备用系统,并且所述主用系统和备用系统可以互为源端和目的端。所述方法包括以下步骤:所述源端根据本地的数据同步请求将需同步的数据以及相应的信息打包为同步数据包;所述源端根据预定的通信方式将所述同步数据包传送到所述目的端;以及所述目的端对所收到的同步数据包进行解包,并且根据所述信息进行数据更新操作,其中所述本地的数据同步请求是来自所述主用系统或备用系统的接入节点的、引起数据变化的操作请求。该方法在进行数据同步时,对主用、备用系统的影响较小,适用于主备双活系统中的动态数据同步应用的场景。
Description
一种双活系统间动态数据同步的方法 技术领域
本发明一般地涉及数据灾备, 并且更具体地涉及双活的主用与备 用系统之间的动态数据同步。 背景技术
数据灾备全称为数据灾难备份, 是指为防止出现操作失误或系统 故障导致数据丟失, 而将全系统或部分数据集合, 从应用主机的硬盘 或阵列复制到其他存储介质的过程。 实施灾难备份的目的是确保重要 信息系统的数据安全和关键业务可以持续服务, 提高抵御灾难的能 力, 减少灾难造成的损失。 灾难备份系统是整个信息系统的有机组成 部分, 而不是游离于生产系统之外的一个独立系统。 数据灾备服务起 源于二十世纪七十年代, 目前在发达国家已成为信息工业中增长最快 的行业之一。 在政府、 金融、 电信、 交通、 能源、 公共服务业及大型 制造 /零售业等信息化依存程度高的行业, 灾备应用极其广泛。
银行业是应用信息科技最广泛的行业之一。 随着银行信息化建设 的快速发展, 银行信息系统大多采用了数据集中存放、 集中处理的大 集中模式, 这种集中模式在带来巨大好处的同时也存在着许多风险, 其中一个方面就是多点的分散风险汇集成了数据中心一点的集中风 险, 一旦中心端出现技术故障 (例如硬件故障、人为操作失误和病毒侵 袭所造成的破坏), 其后果将是灾难性的。 因此, 数据的高可靠存储, 灾难发生的预防, 充分考虑灾难发生后果的快速恢复手段, 成为银行 信息安全工作中极为重要的一环。
一般而言, 为进行数据灾备, 会对处于核心地位的系统采用 1 + 1 备份或 N+1备份。 一旦主用系统发生故障时,备用系统能很快地接管 主用系统的工作, 使整个工作环境保持正常。 其中, 主用系统和备用 系统可以是在正常情况下功能相同并且相互独立操作的两个系统, 也
被称为主备双活系统。 在这样的主备双活系统中, 通常将涉及较多的 动态数据以及配置数据等操作, 要使主用与备用系统之间的切换不影 响整个工作环境的正常运行, 其中一个关键的问题就是同时处于活动 状态的主用与备用系统之间的数据同步。 当主用系统出现问题无法胜 任工作时, 备用系统能够及时完全代替主用系统进行工作, 以提高系 统的可靠性。
在目前的灾备系统结构中, 主用系统或备用系统本身常常通过轮 询的方式从系统中的各单元获取源数据更新的信息, 例如通过轮询来 检查与各单元数据对应的时间是否发生变化。 这种方式的缺点在于, 更新始终有滞后性, 特别是在有大量动态数据的情况下, 轮询将花费 更多的时间并且会影响相应单元的操作。
因此, 对用于在主备双活系统之间执行双向数据同步的改进方法 有 4艮大的需求。 发明内容
本发明的目标是提供促进主备双活系统之间的动态双向数据同 步的方法, 该方法使得联机系统动态数据同步进程对主用、 备用系统 的影响最小。
为了实现上述目标, 本发明提供了一种用于在主备双活系统中实 现动态数据同步的方法, 所述主备双活系统包括主用系统和备用系 统, 并且所述主用系统和备用系统可以互为源端和目的端。 所述方法 包括以下步骤: 所述源端根据本地的数据同步请求将需同步的数据以 及相应的信息打包为同步数据包; 所述源端根据预定的通信方式将所 述同步数据包传送到所述目的端; 以及所述目的端对所收到的同步数 据包进行解包, 并且根据所述信息进行数据更新操作, 其中所述本地 的数据同步请求是来自所述主用系统或备用系统的接入节点的、 引起 数据变化的操作请求。 在一些实施例中, 所述数据同步请求包括 POS 终端签到请求以及 POS终端批结算请求。
优选地, 所述信息包括所述需同步的数据的数据类型和与所述数 据类型对应的操作类型。 在一些实施例中, 所述方法还包括根据所述 数据同步请求确定所述数据类型。 在一些实施例中, 所述目的端根据 通过解包得到的数据类型和操作类型对所述需同步的数据进行更新 操作。 在一些实施例中, 所述更新操作既包括将所述需同步的数据更 新至所述目的端的数据库的操作, 也包括将所述需同步的数据更新至 共享内存的操作。
优选地, 所述信息包括所述需同步的数据在本地更新的时间戳信 息。 在一些实施例中, 所述目的端在进行数据更新之前, 将本地当前 数据的更新时间与通过解包得到的时间戳进行比较, 并且只有在所述 需同步的数据比所述本地当前数据更新时, 所述目的端才执行所述数 据更新操作。
在一些实施例中, 如果所述主用设备和所述备用设备都在本地, 则所述预定的通信方式可以为消息队列方式; 如果所述主用设备和所 述备用设备在异地, 则所述预定的通信方式可以为网络通信方式。 同步数据包的情况下根据触发条件重新批量传送所述同步数据包。
本发明提供了一种主备双活系统中的动态数据同步方法, 其不同 于通过轮询数据库文件来获取源数据更新信息的方式, 而是采用了触 发式数据同步机制, 即主用或备用系统根据来自其接入节点的、 引起 数据变化的操作请求来启动同步进程, 由此可以大大提高同步的实时 性。 进一步地, 本发明还通过传送操作类型信息而大大降低了需要传 输的数据量, 从而提高了同步效率。 本发明所提供的方法对主用系统 和备用系统两者的影响都较小, 并且可以提高数据传输的灵活性。
下面将结合具体的实施例来描述本发明的方法。 附图说明
本发明的前述和其他目标、 特征和优点根据下面对本发明的实施
例的更具体的说明将是显而易见的, 这些实施例在附图中被示意。 图 1是根据本发明的方法的第一实施例的示意图;
图 2是根据本发明的方法的第二实施例的示意图;
图 3是本发明所适用的一种主备双活系统的示意图。 具体实施方式
以下结合附图和具体实施方式进一步详细说明本发明。 需要说明 的是, 附图中的各结构只是示意性说明, 用以使本领域普通技术人员 最佳地理解本发明的原理, 其不一定按比例绘制。
为了便于理解,在本文中使用了术语 "主用系统"和 "备用系统", 但应理解的是本发明所提供的方法可适用于任意两个具有本发明所 描述特征的系统之间的动态数据同步。 另外, 在下文中将以银行系统 应用为背景描述本发明所提供的方法, 但应理解的是所述方法可应用 于任何需要主备双活系统来对数据进行灾备的情形。
图 1是根据本发明的方法的第一实施例的示意图。 在该图中仅示 出了以主用系统为源端, 备用系统为目的端的操作流程。 但应理解的 是, 本发明的方法适用于主用系统和备用系统互为备份的情况, 因此 在实践中也可能由备用系统执行源端的操作, 而由主用系统执行目的 端的操作, 或者双方各自同时作为源端和目的端来操作。 举例来说, 所述主用和备用系统可以是银行的 POS中心系统,该系统与多个 POS 终端相连, 用于接受、 处理或转发 POS 终端的交易请求信息, 并向 POS终端回送交易结果信息。 多个 POS终端可以同时与主用 POS中 心和备用 POS中心相连, 而其中一部分 POS终端的业务由主用 POS 中心处理,其余的 POS终端的业务则由备用 POS中心处理,这些 POS 终端可以被认为是接入主用或备用系统的节点。在主用和备用 POS中 心之间需要不断地进行数据同步, 使得在其中一个系统出现故障时, 其所负责的 POS终端的业务可以由另一系统接手。
如图 1所示, 在正常操作的情况下, 每次同步过程是由一方系统
内的数据同步请求启动的。 根据本发明所提供的方法, 所述数据同步 请求是来自所述主用系统或备用系统的接入节点的、 引起数据变化的 操作请求。 以 POS中心系统为例, 每次 POS终端需要进行交易时, 其将向 POS 中心发送签到请求。 POS签到采用联机方式, 其中 POS 终端将向 POS中心上送终端号、 商户号、操作员代码。 POS中心在验 证商户和终端的有效性之后,将产生终端工作密钥、提取交易批次号、
POS中心的交易日期和时间,将这些数据下传到 POS终端。签到交易 有以下三个作用: a) 终端与 POS中心主机的批次号同步。 b) 终端从 POS中心主机获取新的终端工作密钥。 c) 终端从 POS中心主机获取 主机的日期和时间。 显而易见, 在这种信息交互过程中, 有新的数据 产生。 因此, POS中心系统将把签到请求看作是数据同步请求来启动 相应的同步处理。
在图 1所示的实施例中, 主用系统在开始向备用系统同步数据之 后将首先根据其收到的数据同步请求确定所需同步的数据的数据类 型。 在实践中, 数据同步请求与数据类型之间的对应关系可以根据主 备系统的业务功能被预先确定。 以上述 POS签到请求为例, 与该请求 对应的数据类型可以是 "终端工作密钥"。 另外, 在该实施例中, 还 可以预先确定与所述数据类型相对应的操作类型, 该操作类型可以被 用于指示备用系统如何处理所收到的数据。 常规地, 主备系统之间的 同步仅涉及将数据从一个系统的数据库更新到另一系统的数据库, 从 而导致在通信链路上有时存在过量数据, 使得传输可靠性下降。 在加 入操作类型的情况下, 主用系统将不再需要把所有区别数据都传给备 用系统。 相反地, 它可以仅传送一部分数据和与这部分数据对应的操 作, 而备用数据通过对这部分数据进行相应操作而使得目的端的数据 整体上发生与源端相同的变化。
举例来说, 对于签到请求, 主用系统可以将数据类型确定为 "终 端工作密钥", 并且将操作类型确定为 "签到信息同步更新"。 另外, POS终端也会向 POS 中心系统发送批结算请求。 POS批结算时, 终
端将当批次交易的借记总金额、 借记总笔数、 货记总金额、 货记总笔 数上送 POS中心。 批结算完成, 即对账平或批上送全部完成后, 清空 交易记录, 批次号加 1 , 形成新的批次号。 对于批结算处理, 其本身 会在主用系统上产生多种更新操作, 主用系统可以首先将数据类型确 定为 "批结算信息", 再根据具体情况定义与该次批结算处理有关的 更新操作。 主用系统可以与前述签到请求的情况相似地将操作类型定 义为 "批结算信息同步更新"。
在确定所需要的数据及相应信息之后, 主用系统将这些内容一起 打包成同步数据包, 该同步数据包的格式可以取决于主用系统与备用 系统之间所采用的通信方式。 优选地, 主用系统可以在同步数据包中 加入所需同步的数据在本地更新的时间戳信息。 制作完成的数据包将 按照预定的通信方式被传送到备用系统。 举例来说, 当主备系统为一 个机房中互为备份的两个 POS中心系统时,它们之间可以采用消息队 列通信机制。 当主备系统为处于异地的两个系统时, 则可以采用网络 通信。 应理解的是, 现有技术中常见的通信方式都可以被在主备双活 系统之间。
备用系统在收到上述同步数据包之后将首先相应地进行解包操 作, 由此获得时间戳、 数据类型、 操作类型等信息。 在使用时间戳的 情况下, 备用系统会将本地当前数据的更新时间与通过解包得到的时 间戳进行比较, 并且只有在所述需同步的数据比所述本地当前数据更 新的情况下, 其才执行数据更新操作。 这种方式可以避免因通讯传输 可能引起的数据发送次序与到达次序不一致而造成的数据更新结果 不一致的问题。 例如, 在主用系统处可能由于 POS终端应答出错而两 次产生密钥, 涉及在后的有效密钥更新可能首先到达备用系统, 而在 前的无效密钥更新后到达。 备用系统可以根据时间戳来判断不需要执 行后到达的这个更新操作, 由此确保当前数据块始终处于最新状态。
随后, 备用系统将按照数据类型和操作类型信息执行在其本地的 数据更新操作。 例如, 在数据类型为 "终端工作密钥" 并且操作类型
为 "签到信息同步更新" 的情况下, 备用系统将把新的终端工作密钥 数据存储到其数据库中相应的位置。 在实际应用中, 所述终端工作密 钥一般仅被存储在数据库中, 因此在上述情况下仅需将数据更新到数 据库。 对于例如机构重置密钥交易, 还存在对机构密钥的同步更新, 而这样的机构密钥通常既存储在数据库中也存储在共享内存中。 因 此, 对于机构密钥同步, 备用系统上收到数据同步请求后, 要同时更 新数据库和共享内存。 在数据类型为 "批结算信息" 并且操作类型为 "批结算信息同步更新" 的情况下, 备用系统会对其数据库中多个涉 及 "批次号" 的表进行更新。 这与上述终端工作密钥更新有所不同, 一般情况下前者在备用系统只需要更新一个密钥表。 另外, 备用系统 在处理 "签到信息同步更新" 时, 若该签到的终端为新增终端, 则备 用系统也会同时进行相应的 "批结算信息同步更新" 操作, 即在批结 算信息表中为该新增终端构造批结算信息结构。
在上述实施例中, 主用或备用系统根据其接入节点的引起数据变 化的操作请求触发同步进程, 使得数据可以更及时地被同步, 从而提 高灾备的可靠性。 传送操作类型信息使主备系统间通信链路的负荷得 以降低, 而时间戳机制又避免了 "脏数据" 的写入。 由此可见, 本发 明所提供的方法使得联机系统动态数据同步进程对主用、 备用系统的 影响变小, 从而大大促进了主备双活系统之间的动态双向数据同步。
图 2是根据本发明的方法的第二实施例的示意图, 该实施例适用 于主备系统之间发生通信中断或者其中一方故障恢复后的回切场景。 与图 1相似, 在该图中示出了以主用系统为源端, 备用系统为目的端 的操作流程, 但在实践中也可能由备用系统执行源端的操作, 而由主 用系统执行目的端的操作, 或者双方各自同时作为源端和目的端来操 作。 与第一实施例不同的是, 在该实施例中, 由于主用系统不能实时 地与备用系统通信, 其并不是响应于接入节点的操作请求马上发起单 独的数据同步, 而是在得到同步数据包之后对其进行存储, 等待通信 恢复的触发条件发起批量同步, 即将多个同步数据包一起传送给备用
系统。 在同步数据包中, 仍然存有数据类型、 操作类型以及时间戳等 信息, 整个操作过程大体上与图 1所示的例子相同。 在进行批量追补 同步时, 可以根据指定的时间范围来确定需要传送的数据包。 由于这 种批量传送机制, 使得根据本发明的方法一方面具有很好的实时性, 另一方面也能理想地应对系统间的通信中断。
图 3是本发明所适用的一种主备双活系统的示意图。 在图 3所示 的场景中, 系统 A和系统 B互为备份, 并且在运行时分别独立处理业 务请求。 同时, 这两个系统分别在本地有一个内部灾备同步模块。 接 收模块 1对应系统对本地主数据源的更新, 接收模块 2对应系统对本 地备数据源的更新。 系统 A在对备数据源进行更新的同时, 还将更新 信息通过通讯网关 a发送至异地系统 B中。系统 B收到数据同步请求 时, 在接收模块 1、 接收模块 2处将新数据信息分别更新至其主数据 源和备数据源中。在系统 A或系统 B对其内部的备数据源进行更新以 及系统 A与系统 B之间的更新均可以采用本发明所提供的方法。
本文所描述的系统间动态数据同步的技术方案可以被实现为软 件、 固件、 硬件或其任何组合。 例如, 其可以是在硬件逻辑 (诸如集成 电路芯片、 可编程门阵列、 专用集成电路等)、 计算机可读介质 (诸如 硬盘驱动器、 软盘、 磁带、 CD-ROM、 光盘等)或者易失性和非易失性 存储设备 (诸如 EEPROM、 ROM, PROM, RAM, DRAM, SRAM等) 中实现的代码或逻辑。 计算机可读介质中的代码可以由处理器访问和 执行。 此外, 本文所描述的方法的步骤可以按顺序执行或者其中某些 步骤可以并行地被执行, 所述方法可以由单个处理器完成或者由分布 式处理系统来完成。 而非对其进行限制。 尽管参照上述具体实施方式对本发明进行了详细 的说明, 本领域的普通技术人员应当理解, 依然可以对本发明的具体 实施方式进行修改或对部分技术特征进行等同替换而不脱离本发明 的实质, 其均涵盖在本发明请求保护的范围中。
Claims
1. 一种用于在主备双活系统中实现动态数据同步的方法,所述主 备双活系统包括主用系统和备用系统, 并且所述主用系统和备用系统 可以互为源端和目的端, 其特征在于, 所述方法包括以下步骤:
所述源端根据本地的数据同步请求将需同步的数据以及相应的 信息打包为同步数据包;
所述源端根据预定的通信方式将所述同步数据包传送到所述目 的端; 以及
所述目的端对所收到的同步数据包进行解包, 并且根据所述信息 进行数据更新操作, 其中
所述本地的数据同步请求是来自所述主用系统或备用系统的接 入节点的、 引起数据变化的操作请求。
2. 如权利要求 1所述的方法, 其特征在于, 其中所述信息包括所 述需同步的数据的数据类型和与所述数据类型对应的操作类型。
3. 如权利要求 2所述的方法, 其特征在于, 所述方法还包括根据 所述数据同步请求确定所述数据类型。
4. 如权利要求 2所述的方法, 其特征在于, 其中所述目的端根据 通过解包得到的数据类型和操作类型对所述需同步的数据进行所述 数据更新操作。
5. 如权利要求 4所述的方法, 其特征在于, 其中所述更新操作既 包括将所述需同步的数据更新至所述目的端的数据库的操作, 也包括 将所述需同步的数据更新至共享内存的操作。
6. 如权利要求 1所述的方法, 其特征在于, 其中所述信息包括所 述需同步的数据在本地更新的时间戳信息。
7. 如权利要求 6所述的方法, 其特征在于, 其中所述目的端在进 行数据更新之前, 将本地当前数据的更新时间与通过解包得到的时间 戳进行比较, 并且其中
只有在所述需同步的数据比所述本地当前数据更新时, 所述目的 端才执行更新操作。
8. 如权利要求 1所述的方法, 其特征在于, 其中如果所述主用设 备和所述备用设备都在本地, 则所述预定的通信方式为消息队列方 式; 如果所述主用设备和所述备用设备在异地, 则所述预定的通信方 式为网络通信方式。
9. 如权利要求 1所述的方法, 其特征在于, 其中所述数据同步请 求包括 POS终端签到请求以及 POS终端批结算请求。
10. 如权利要求 1-9 中任意一项所述的方法, 其特征在于, 所述 况下根据触发条件重新批量传送所述同步数据包。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110135782.6 | 2011-05-24 | ||
| CN201110135782.6A CN102801543B (zh) | 2011-05-24 | 2011-05-24 | 一种双活系统间动态数据同步的方法 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2012159575A1 true WO2012159575A1 (zh) | 2012-11-29 |
Family
ID=47200517
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2012/076005 Ceased WO2012159575A1 (zh) | 2011-05-24 | 2012-05-24 | 一种双活系统间动态数据同步的方法 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN102801543B (zh) |
| WO (1) | WO2012159575A1 (zh) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108958756A (zh) * | 2017-05-22 | 2018-12-07 | 大唐移动通信设备有限公司 | 一种软件升级方法及系统 |
| CN115328955A (zh) * | 2022-08-11 | 2022-11-11 | 中国银行股份有限公司 | 一种业务数据处理方法和装置 |
| CN116506056A (zh) * | 2023-04-25 | 2023-07-28 | 深蓝汽车科技有限公司 | 一种域控制器内的配置信息同步的方法、系统、介质及车辆 |
Families Citing this family (16)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104572351B (zh) * | 2014-12-23 | 2017-11-14 | 中国工商银行股份有限公司 | 基于主机系统的数据恢复系统及方法 |
| CN104580734A (zh) * | 2015-01-20 | 2015-04-29 | 宇龙计算机通信科技(深圳)有限公司 | 多系统设备的数据同步方法、数据同步系统和终端 |
| CN105988894A (zh) * | 2015-02-10 | 2016-10-05 | 北京中科同向信息技术有限公司 | 一种双活模式的容灾技术 |
| CN105338093A (zh) * | 2015-11-16 | 2016-02-17 | 中国建设银行股份有限公司 | 一种数据同步方法和系统 |
| CN107231400B (zh) * | 2016-03-25 | 2020-07-03 | 阿里巴巴集团控股有限公司 | 一种数据的同步方法和装置 |
| CN106254094B (zh) * | 2016-07-19 | 2019-08-13 | 中国银联股份有限公司 | 一种数据同步方法及系统 |
| CN107957910A (zh) * | 2016-10-18 | 2018-04-24 | 北京京东尚科信息技术有限公司 | 消息处理方法以及消息处理装置 |
| CN107102343A (zh) * | 2017-04-06 | 2017-08-29 | 千寻位置网络有限公司 | 基于双活数据中心的差分服务系统及实现方法 |
| CN108809681A (zh) * | 2017-05-04 | 2018-11-13 | 华为技术有限公司 | 一种核查数据一致性的方法、设备和系统 |
| CN107944300A (zh) * | 2017-11-01 | 2018-04-20 | 深信服科技股份有限公司 | 一种数据写入方法及装置、验证方法及装置 |
| CN107844566B (zh) * | 2017-11-02 | 2020-05-05 | 杭州时趣信息技术有限公司 | 一种dump控制方法及其系统 |
| CN108573042B (zh) * | 2018-04-10 | 2022-06-10 | 平安科技(深圳)有限公司 | 报表同步方法、电子设备及计算机可读存储介质 |
| CN108647117A (zh) * | 2018-04-26 | 2018-10-12 | 郑州云海信息技术有限公司 | 一种数据备份的方法、主系统、设备及计算机可读存储介质 |
| CN113051342B (zh) * | 2019-12-28 | 2023-06-20 | 浙江宇视科技有限公司 | 一种轻量化双机切换的方法及系统 |
| CN113190536B (zh) * | 2021-03-02 | 2023-01-17 | 上海英方软件股份有限公司 | 一种对双活数据库管理复制系统的快速修复方法及装置 |
| CN117527532A (zh) * | 2022-07-29 | 2024-02-06 | 华为技术有限公司 | 数据处理方法、通信系统和相关设备 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1437348A (zh) * | 2002-02-04 | 2003-08-20 | 深圳市中兴通讯股份有限公司 | 通信系统中主备板数据实时同步的方法 |
| US20050262170A1 (en) * | 2004-05-19 | 2005-11-24 | Oracle International Corporation | Real-time apply mechanism in standby database environments |
| CN101145955A (zh) * | 2007-06-12 | 2008-03-19 | 中兴通讯股份有限公司 | 网管软件热备份的方法、网管及网管系统 |
| CN101426026A (zh) * | 2008-09-17 | 2009-05-06 | 北京六维世纪网络技术有限公司 | 一种多服务器间数据同步的方法及系统 |
-
2011
- 2011-05-24 CN CN201110135782.6A patent/CN102801543B/zh active Active
-
2012
- 2012-05-24 WO PCT/CN2012/076005 patent/WO2012159575A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1437348A (zh) * | 2002-02-04 | 2003-08-20 | 深圳市中兴通讯股份有限公司 | 通信系统中主备板数据实时同步的方法 |
| US20050262170A1 (en) * | 2004-05-19 | 2005-11-24 | Oracle International Corporation | Real-time apply mechanism in standby database environments |
| CN101145955A (zh) * | 2007-06-12 | 2008-03-19 | 中兴通讯股份有限公司 | 网管软件热备份的方法、网管及网管系统 |
| CN101426026A (zh) * | 2008-09-17 | 2009-05-06 | 北京六维世纪网络技术有限公司 | 一种多服务器间数据同步的方法及系统 |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108958756A (zh) * | 2017-05-22 | 2018-12-07 | 大唐移动通信设备有限公司 | 一种软件升级方法及系统 |
| CN115328955A (zh) * | 2022-08-11 | 2022-11-11 | 中国银行股份有限公司 | 一种业务数据处理方法和装置 |
| CN116506056A (zh) * | 2023-04-25 | 2023-07-28 | 深蓝汽车科技有限公司 | 一种域控制器内的配置信息同步的方法、系统、介质及车辆 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102801543B (zh) | 2015-12-16 |
| CN102801543A (zh) | 2012-11-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2012159575A1 (zh) | 一种双活系统间动态数据同步的方法 | |
| EP1771789B1 (en) | Method of improving replica server performance and a replica server system | |
| US11665124B2 (en) | Interface, method and computer program product for controlling the transfer of electronic messages | |
| EP3435604B1 (en) | Service processing method, device, and system | |
| US11086902B2 (en) | Method and system for implementing a redo repeater | |
| US10997568B2 (en) | System, method and computer program product for receiving electronic messages | |
| US9741037B2 (en) | System server for receiving transaction requests | |
| AU2020202512A1 (en) | An interface, system, method and computer program product for controlling the transfer of electronic messages | |
| US11080690B2 (en) | Device, system, method and computer program product for processing electronic transaction requests | |
| US20050193037A1 (en) | Peer-to-peer replication member initialization and deactivation | |
| CN114153569B (zh) | 一种跨系统分布式事务处理方法及系统 | |
| JP4461147B2 (ja) | リモートデータミラーリングを用いたクラスタデータベース | |
| CN106446300A (zh) | 一种基于共享存储池的事务处理方法及系统 | |
| WO2021052237A1 (zh) | 事务处理方法、装置、设备、存储介质、数据库 | |
| CN106815094A (zh) | 一种用于实现主备同步模式下事务提交的方法与设备 | |
| KR20160004721A (ko) | 데이터 손실 없는 데이터베이스 리두 로그 이중화 방법 및 그를 위한 시스템 | |
| JP2002202906A (ja) | データベース二重化システムおよび方法 | |
| US20130282667A1 (en) | Method and system for implementing a conditional redo repeater | |
| TWI735518B (zh) | 資料庫的服務提供方法和系統 | |
| CN101686118A (zh) | 一种交换业务系统及其工作方法 | |
| WO2013163319A2 (en) | Method and system for implementing a redo repeater | |
| JP2008243150A (ja) | レプリケーションシステムおよびデータ同期確認方法 | |
| Malayanur | Fannie Mae & Data Guard 10g Release 2 |
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: 12789554 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC OF 080414 |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 12789554 Country of ref document: EP Kind code of ref document: A1 |