WO2014101510A1 - 数据同步处理方法及系统 - Google Patents
数据同步处理方法及系统 Download PDFInfo
- Publication number
- WO2014101510A1 WO2014101510A1 PCT/CN2013/084463 CN2013084463W WO2014101510A1 WO 2014101510 A1 WO2014101510 A1 WO 2014101510A1 CN 2013084463 W CN2013084463 W CN 2013084463W WO 2014101510 A1 WO2014101510 A1 WO 2014101510A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- server
- data block
- data
- flag
- writable
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/119—Details of migration of file systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/128—Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
-
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
Definitions
- the present invention relates to the field of data synchronization technologies; and in particular, to a data synchronization processing method and system.
- Weibo is a typical UGC (User Generated Content) service, and the generation of data is closely related to the behavior of users.
- UGC User Generated Content
- redo running water is a common data recovery method for background services.
- the service records the flow of the writing action locally or remotely, and can replay the writing action in the flowing water when the machine fails. , to recover the data.
- the redo flow needs to be played back in the original write sequence number (Seq), in order to guarantee the order of the write action.
- Seq write sequence number
- the data snapshot (Snapshot) technology is generally used to export the snapshot of the memory data to the disk, and the serial number of the export time (Seq) is recorded; when the data is restored, the snapshot is loaded into the memory.
- Streaming can be continued from the sequence number of the snapshot point (Seq), saving time in redoing the redo.
- the embodiment of the invention provides a data synchronization processing method and system, which avoids the cumbersome redo flow operation in the traditional method. And greatly reduce the time that the external can not be written, thereby reducing the user's perception of the operation and maintenance operations such as data migration or machine failure.
- the technical solution is as follows:
- a data synchronization processing method includes:
- a data synchronization processing method includes:
- the snapshot of the data block is imported on the second server; and the data block of the second server is configured with a synchronization flag;
- a data identifier can be configured for the data block on the first server.
- a data synchronization processing system includes:
- a configuration module configured to configure a primary flag and a writable flag on the data block on the first server
- Importing a module configured to import a snapshot of the data block on the second server
- the configuration module is further configured to configure a data identifier for the data block on the second server;
- a synchronization component configured to synchronize write data of the data block on the first server to the second server; the configuration module is further configured to: when the data block is to be migrated from the first server Removing the writable flag of the data block on the first server;
- the configuration module is further configured to: after the second server and the data of the data block on the first server are completely identical, remove the main identifier of the data block on the first server and remove the first A peer identifier of the data block on the second server, and a master flag and a writable flag are configured for the data block on the second server.
- a data synchronization processing system includes:
- a configuration module configured to configure a synchronizable flag for the data block on the first server, and configured to configure a main flag and a writable flag for the data block on the second server;
- a synchronization component configured to: send the write data of the data block on the second server to the first server; the configuration module is further configured to: if the second server fails, remove the Determining a primary flag of the data block on the second server and removing a synchronizable flag of the data block on the first server, and configuring a primary flag and a writable flag on the data block on the first server;
- An importing module configured to import a snapshot of the data block on the second server after the fault recovery of the second server
- the configuration module is further configured to: after the fault recovery of the second server, configure a synchronizable flag on the data block on the second server;
- the synchronization component is further configured to synchronize the write data of the data block on the first server to the second server after the fault recovery of the second server;
- the configuration module is further configured to remove a writable flag of the data block on the first server when the second server is to restore the host status of the data block;
- the configuration module is further configured to: after the second server and the data of the data block on the first server are completely identical, remove the main identifier of the data block on the first server and remove the first a synchronizable flag of the data block on the second server, configuring a primary flag and a writable flag for the data block on the second server, and the number on the first server
- the block can be configured to synchronize the flags.
- the technical solution provided by the embodiment of the present invention has the beneficial effects of: using the peer component to have data on the host server marked with the primary flag in the process of performing data migration on the host server or recovering from the failure of the host server. Synchronize to the characteristics of the slave server marked with the synchronizable flag, and synchronize the data on the host server to the slave server, and use the main write point switching method in the data migration or failure recovery process of the host server. It can avoid the cumbersome redo flow operation in the traditional method, and greatly shorten the time that the data migration and failure recovery process can not be written externally, thereby reducing the user's perception of data migration and operation such as machine failure.
- FIG. 1 is a schematic diagram of a state change of a flag bit of a data block in a master-slave switching process according to an embodiment of the present invention
- FIG. 2 is a flowchart of a data synchronization processing method according to a first embodiment of the present invention
- FIG. 3 is a flowchart of a data synchronization processing method according to a second embodiment of the present invention.
- FIG. 4 is a schematic structural diagram of a data peer processing system according to a first embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of a data peer processing system according to a second embodiment of the present invention.
- Embodiments of the present invention provide a data synchronization processing method and system.
- the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
- the so-called master-slave switchover that is, in the server architecture equipped with the master server and the slave server (Slave), the configuration center degrades the host server (Master) with the main write point, and promotes the slave server (Slave).
- Master host server
- Slave slave server
- the original slave server is promoted to the master server, and the original host server is downgraded to the slave server.
- FIG. 1 is a schematic diagram showing a state change of a flag bit of a data block in a master-slave switching process according to an embodiment of the present invention.
- the data is configured in the serverl with a main flag (M), a writable flag (W) and a readable flag (R), and the server 2 has a synchronizable flag (S) and a 3 ⁇ 4 read flag (R) for the data.
- Serverl becomes the host of the data server i is the main write point of the data; server2 becomes the slave server of the data and can receive data from the host server for peering to establish a copy of the data on the slave server.
- the data on the slave server is basically the same as the data on the host server, except that the latest data just written on the host server is being synchronized or waiting for the peer to the slave server.
- the configuration center Before the master-slave switchover, the configuration center first disables the serverl write, that is, removes the writable flag (W) of the data on the serverl, and maintains the data of the main flag (M) on serverl and the peer-identified flag of the data on server2.
- the master-slave switchover operation can be performed.
- the main flag (M) of the data on serverl is removed from the configuration center and the data on server2 can be removed.
- Flag (S) configure the main flag (M) and writable flag (W) for the data on server2, and the data mapping on serverl can be the same as the flag (S).
- server2 is upgraded to the new host server of the data.
- serverl downgrades to the new slave server of the data, thus completing the master-slave switchover process.
- FIG. 2 is a flowchart of a data synchronization processing method according to a first embodiment of the present invention.
- the data synchronization processing method is applicable to migrating data from one host server to another.
- On the server. When a host server stores multiple data blocks such as A, B, and C and continuously receives external data writes, if one of the data blocks (such as A data block) has a large amount of external data written, it expands. Soon, you can move the A data block separately to another server, and configure the other server as the host server of the A data block, making the other server the primary write point of the A data block. In this way, the storage pressure of the original host server can be alleviated, and the remaining data blocks (B, C, etc.) with relatively small external data writes can still use the original host server as the primary write point.
- the data synchronization processing method includes:
- Step S101 providing a first server configured with a main flag and a writable flag for the data block;
- the first server pair data block is configured with a main flag (M) and a writable flag (W), so the first server becomes a host server of the data block, and can receive external data writing for the data block.
- the main flag (M) and the writable flag (W) may be configured by the configuration center for the data block on the first server; further, also! "The readable flag (R) is configured for the data block on the first server, so that the first server can also provide the read function of the data block at the same time.
- Step S102 Provide a second server, and import a snapshot of the data block on the second server; for example, import a snapshot of the data block from the cold standby center to the second server.
- Step S103 configuring a synchronization flag for the data block on the second server
- a new device is provided.
- a snapshot of the data block is imported on the second server.
- the data in the server is periodically snapshotted (for example, some time each morning), and the snapshot is stored in the cold standby center for future data recovery; when making a snapshot, it can be targeted Make a snapshot of the data on the host server, or take a snapshot of the data on the slave server.
- a complete write operation (Binlog) is also recorded on the host server for data peer recovery or recovery.
- the second server When it is required to migrate the A data block on the first server to the second server, firstly, the second server needs to be built as a slave server of the A data block, so that the first server and the first server The relationship between the second server and the slave is formed for the A data block to synchronize the data of the A data block to the second server by using the synchronization component. Therefore, the snapshot of the A data block at the most recent time (the same day or the previous day) may be obtained from the cold standby center, and the snapshot is imported on the second server, and then the data block on the second server is obtained.
- the configuration center can configure the second server with the same identifier (S); further, the pair is still
- the data block on the second server is configured with a readable flag (R), so that the second server can also provide a read function of the data block at the same time.
- Step S104 The write data of the data block on the first server is synchronized to the second server by the synchronization component.
- the synchronization component is a general-purpose data synchronization component for synchronizing the write data received by the host server to the corresponding synchronizable slave server.
- the synchronization component is implemented by reading the write operation recorded by the host server. Pushing to the slave server according to the serial number (Seq) required by the slave server, so as to achieve the same operation as the slave server in the write operation sequence of the host server, this implementation writes the data on the host server according to the serial number ( Seq) is sequentially pushed to the modules on the same slave server, collectively referred to as the synchronization component; the synchronization component has the synchronization of the data on the host server marked with the primary flag (M) to the slave marked with the synchronizable flag (S) a feature on the server, so after the first server and the second server form a master-slave relationship for the A data block, the A data block of the first server can be used by the synchronization component.
- Write data (write operation pipeline) sent to the second server to perform data A of
- Step S105 When the data block is to be migrated from the first server, the writable flag of the data block on the first server is removed;
- Step S106 Synchronizing the latest write data of the data block on the first server to the second service by the synchronization component On the server;
- the writable flag (W) of the A data block on the first server may be removed by the configuration center, so that the first server is prohibited from writing for the A data block.
- the data of the A data block on the second server and the A data block on the first server are The data has been substantially identical except that the latest data just written to the first server is being synchronized or waiting to be synchronized to the second server.
- a writable flag (W) of the data block for which the first server is forbidden for a short time (for example, a few seconds). Maintaining a main flag (M) of the A data block on the first server and a synchronizable flag (S) of the A data block on the second server during the forbidden writing, so that the first server and the second server The relationship between the master and the slave is still formed for the A data block.
- the data of the A data block on a server is completely consistent, and the second server and the data of the A data block on the first server reach the same synchronization point.
- Step S107 After the second server and the data of the data block on the first server are completely identical, removing the primary flag of the data block on the first server and removing the second server A peer flag of the data block, and a master flag and a writable flag are configured for the data block on the second server.
- the configuration center may be removed by the configuration center.
- the configuration center can configure the writable flag (W) for the A data block on the second server, and the external data write of the A data block is transferred to the second server ( Ie on the new host server).
- the method further includes: Step S108: Clean the data block on the first server to recover the data block The space occupied.
- the A data block After the A data block is moved out, the A data block needs to be cleaned from the first server, otherwise the A data block remains on the first server. After the A data block on the first server is cleaned, the space occupied by the A data block can be reclaimed, and the free space can be reserved for other data blocks (for example, B, C, etc.) on the first server. .
- FIG. 3 is a flowchart of a data peer processing method according to a second embodiment of the present invention.
- the data synchronization processing method is applicable to synchronous processing of data when a host server fails.
- Data synchronization Processing methods include:
- Step S201 providing a first server configured with a peer identifier for the data block
- the first server pair data block is configured with a synchronizable flag (S)
- the first server becomes a slave server of the data block.
- the data block on the first server may be configured by the configuration center to be a compliant flag (S); further, the readable flag (R) may be configured on the data block on the first server.
- the first server can also provide the read function of the data block at the same time.
- Step S202 providing a second server configured with a main flag and a writable flag for the data block;
- the second server pair data block is configured with a main flag (M) and a writable flag (W), so the second server becomes a host server of the data block, and can receive external data writing for the data block.
- a primary flag (M) and a writable flag (W) may be configured by the configuration center for the data block on the second server; further, the data block configuration on the second server may also be read.
- the flag (R) enables the second server to simultaneously provide the read function of the data block.
- Step S203 The write data of the data block on the second server is synchronized to the first server by the synchronization component.
- the synchronization component is a general-purpose data synchronization component for synchronizing the write data received by the host server to the corresponding comparable slave server.
- the implementation principle of the peer component is to read the record recorded by the host server.
- the operation pipeline is pushed to the slave server according to the serial number (Seq) required by the slave server, thereby achieving the purpose of synchronizing to the slave server in the order of the write operation of the host server, and this implementation writes the data of the host server according to the serial number.
- Step S204 If the second server fails, remove the main identifier of the data block on the second server and remove the same identifier of the data block on the first server, and
- the data block on a server configures a primary flag and a writable flag; when the second server fails to provide normal service due to a failure such as a crash or hardware damage, the data block may be removed from the second server by the configuration center a main flag ( ⁇ ) and a collapsible flag (S) for removing the data block on the first server, and a main flag ( ⁇ ) and a writable flag for the data block on the first server ( W), thereby directly promoting the first server to a new host server of the data block, and externally writing data for the data block from the second
- the server (the original host server) is transferred to the first server (i.e., the new host server), thereby switching the primary write point of the data block and restoring external data writes in the shortest time.
- Step S205 After the fault of the second server is restored, the snapshot of the data block is imported on the second server;
- a snapshot of the data block can be imported from the cold standby center onto the second server.
- Step S206 configuring a synchronizable flag on the data block on the second server
- the data in the server is periodically snapshotted (for example, some time each morning), and the snapshot is stored in the cold standby center for future data recovery; when making a snapshot, it can be targeted Make a snapshot of the data on the host server, or take a snapshot of the data on the slave server.
- a complete write operation (Binlog) is also recorded on the host server for data peer recovery or recovery.
- the snapshot of the data block at the most recent time may be obtained from the cold standby center, and the snapshot is imported on the second server, and then configured by the configuration center.
- S synchronizable flag
- the relationship, that is, the synchronization component sends the new write data of the data block after the snapshot point from the first server to the second server for incremental data peering, thereby greatly reducing the time taken for the peer data.
- Step S207 The write data of the data block on the first server is synchronized to the second server by the synchronization component.
- the first component can be used by the peer component.
- Writing data of the data block on the server (write operation pipeline) is sent to the second server for data peering, so that the data of the data block on the second server and the data block on the first server The data is kept in sync.
- Step S208 When the host status of the second server for the data block is to be restored, the writable flag of the data block on the first server is removed;
- Step S209 The latest write data of the data block on the first server is synchronized to the second server by the synchronization component.
- the second server After the second server resumes normal service, it is necessary to perform another master-slave switchover, and switch the main write point from the current first server to the original host, that is, the second server, to restore the host of the second server.
- Status because the second server that is originally the host generally has a performance advantage over the original server that is the slave, such as good network conditions and proximity to the access server.
- the number of the data blocks on the first server has been already in the above step S207 Synchronizing to the second server, the data of the data block on the second server is substantially consistent with the data of the data block on the first server, except that the latest data just written on the first server is ⁇ or waiting for a peer to go outside the second server.
- the configuration center may remove the writable flag (w) of the data block on the first server, and perform a short time (for example, a few seconds) on the first server. Forbidden to write, while maintaining the primary flag (M) of the data block on the first server and the comparable identifier (S) of the data block on the second server during the ban, the synchronization component will target the first server The latest write data of the data block is sent to the second server for synchronization, so that the data of the data block on the second server is synchronized to the data of the data block on the first server, and the second server and the first server are configured. The data on the data block reaches the same peer point.
- Step S210 After the second server and the data of the data block on the first server are completely identical, removing the main identifier of the data block on the first server and removing the second server A peer identifier of the data block, a master flag and a writable flag are configured for the data block on the second server, and a synchronizable flag is configured for the data block on the first server.
- the main flag (M) of the data block on the first server may be removed by the configuration center and the data block on the second server is removed.
- the same identifier (S), the main flag (M) and the writable flag (W) are configured for the data block on the second server, and the same flag (S) is configured for the data block on the first server.
- the second server becomes the host server of the data block, so that the first server becomes the slave server of the data block.
- the second server is restored to the original host identity, and the first server is restored to the original slave identity.
- the external data writing of the data block is re-transferred to the second server, and the entire data synchronization recovery process in which the second server fails is completed.
- the data synchronization processing method proposed in the foregoing embodiment may be applied to data peer processing in a case where the data on the host server is migrated or the host server is faulty and cannot be normally served.
- the new device by configuring the new device to synchronize the flag, the new device is built as a slave, and then the characteristics of the synchronization component are utilized, and the data of the host server is synchronized by the same component to the new device built as the slave, avoiding
- the cumbersome redo flow operation, and in the entire data migration process the host server only needs to be banned for a short time before the main write point switching of the data.
- FIG. 4 is a schematic structural diagram of a data peer processing system according to a first embodiment of the present invention, where the data processing system includes:
- a configuration module 303 configured to configure a primary flag and a writable flag for the data block on the first server 301; and an importing module 304, configured to import the snapshot of the data block on the second server 302;
- the configuration module 303 is further configured to configure the data block in the second server 302 with a synchronizable flag; the synchronization component 305 is configured to compare the write data of the data block on the first server 301 to the On the second server 302;
- the configuration module 303 is further configured to remove a writable flag of the data block on the first server 301 when the data block is to be migrated from the first server 301;
- the configuration module 303 is further configured to remove the data block on the first server 301 after the data of the data block on the second server 302 is completely synchronized with the data of the data block on the first server 301.
- the primary flag and the identifiable flag of the data block on the second server 302 are removed, and the primary flag and the writable flag are configured for the data block on the second server 302.
- the peer component 305 has the same characteristics as the data on the host server marked with the primary flag on the secondary server marked with the same identifier. '
- the data synchronization processing system in the first embodiment further includes a cleaning module 306, and after the configuration module 303 removes the main identifier of the data block on the first server 301, the cleaning module 306 clears the The data block on the first server 301 is used to recover the space occupied by the data block.
- FIG. 5 is a schematic structural diagram of a data synchronization processing system according to a second embodiment of the present invention, where the data synchronization processing system includes a first server 401;
- the configuration module 403 is configured to configure a data block on the first server 401 with a common identifier, and configured to configure a primary flag and a writable flag on the data block on the second server 402;
- the synchronization component 404 is configured to upload the write data of the data block on the second server 402 to the first server 401;
- the configuration module 403 is further configured to remove the main identifier of the data block on the second server 402 and remove the data block on the first server 401 if the second server 402 fails. a peer flag, and configuring a primary flag and a writable flag for the data block on the first server 401;
- the importing module 405 is configured to import the snapshot of the data block on the second server 402 after the fault recovery of the second server 402
- the configuration module 403 is further configured to: after the fault recovery of the second server 402, configure a synchronizable flag on the data block on the second server 402;
- the synchronization component 404 is further configured to synchronize the write data of the data block on the first server 401 to the second server 402 after the failure of the second server 402 is restored;
- the configuration module 403 is further configured to: when the host status of the second server 402 is restored for the data block, remove the writable flag of the data block on the first server 401;
- the configuration module 403 is further configured to remove the data block on the first server 401 after the data of the data block on the second server 402 is completely synchronized with the data of the data block on the first server 401.
- a master flag and a synchronizable flag of the data block on the second server 402 and a B main flag and a writable flag for the data block on the second server 402 and on the first server 401
- the data block configuration can be the same as the flag.
- the synchronization component 404 has the same characteristics as the data on the host server marked with the primary flag on the secondary server labeled with the same identifier.
- the storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), or a random access memory (RAM).
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Hardware Redundancy (AREA)
Abstract
一种数据同步处理方法,包括:提供对数据块配置有主标志和可写标志的第一服务器;提供第二服务器,并将该数据块的快照在所述第二服务器上导入;对所述第二服务器上的该数据块配置可同步标志;由同步组件将所述第一服务器上该数据块的写入数据同歩至所述第二服务器上;在要从所述第一服务器上迁出该数据块时,移除所述第一服务器上该数据块的可写标志;由同步组件将所述第一服务器上该数据块的最新写入数据同歩至所述第二服务器上;在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后,移除所述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同步标志,以及对所述第二服务器上的该数据块配置主标志和可写标志。
Description
数据同歩处理方法及系统
技术领域
本发明涉及数据同步技术领域; 特别涉及一种数据同步处理方法及系统。
背景技术
微博是一种典型的 UGC (User Generated Content, 用户原创内容) 业务, 数据的产生和 用户的行为有很密切的关系。 当底层存储服务器故障或因为运维不可写入时, 用户会有很高
说
的概率感知到后台系统的故障。
为了减少底层业务故障对用户的直观影响, 常见方法是采用一些柔性策略, 例如在故障 时只返回部分可用的数据, 或使用某些副本上的数据做读取。 在这种场景下, 往往受影响的 数据是不可写入的, 此时的用户写操作将全部失败。 为了降低机器故障等因素对用户产生的 影响, 需要一种快速的数据恢复和运维手段。 书
现有技术中, 重做流水 (redo ) 是一种后台服务常见的数据恢复方式, 业务通过先将写 动作的流水记录到本地或远程, 当机器故障时可以通过将流水中的写动作重放, 來恢复数据。
重做流水需要按原来的写入序号(Seq)顺序重放, 这是为了保证写动作的顺序性。 但从 Seq=0开始从头恢复, 一般需要消耗大量时间 (相当于将所有写动作从头写一遍)。 所以配合 流水重做, 一般还会配合数据快照 (Snapshot) 技术, 将内存数据的快照导出到磁盘, 并且 记录导出时刻的序号 (Seq); 当恢复数据前先将快照加载到内存, 此时重做流水就可以从快 照点的序号 (Seq) 继续执行, 从而节省从头重做流水 (redo) 的时间。
在传统方案中, 当主机故障或进行数据迁移时, 需要先取得当天或者前一天的数据快照, 然后获取主机上的流水文件(或获取远程流水)。 复制流水前还需要对主机禁写, 这样是保证 迁移过程中数据的一致性, 如果在旧的机器上进行了写入但未复制该流水到新的主机, 将导 致这一部分数据的丢失。 所以一般的, 在数据恢复过程时, 需要按照复制快照、 主机禁写、 复制流水、 恢复快照、 流水重做这样的歩骤进 fi1操作。
由于传统方案中需要进行繁琐的重做流水操作, 并且需要对主机进行较长时间的禁写操 作, 对外 (即, 对于用户) 不可写的时间较长, 用户对数据迁移或机器故障等运维操作的感 知程度较为明显。
发明内容
本发明实施例提供了一种数据同步处理方法及系统, 避免传统方法中繁琐的重做流水操
作, 并且很大程度缩短对外不可写的时间, 从而减少用户对数据迁移或机器故障等运维操作 的感知程度。 所述技术方案如下:
一种数据同步处理方法, 包括:
提供对数据块配置有主标志和可写标志的第一服务器; '
提供第二服务器, 并将该数据块的快照在所述第二服务器上导入;
对所述第二服务器上的该数据块配置可同步标志;
由同步组件将所述第一服务器上该数据块的写入数据同步至所述第二服务器上; 在要从所述第一服务器上迁出该数据块时,移除所述第一服务器上该数据块的可写标志; 由同歩组件将所述第一服务器上该数据块的最新写入数据同歩至所述第二服务器上; 在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后, 移除所述第一服务 器上该数据块的主标志和移除所述第二服务器上该数据块的可同步标志, 以及对所述第二服 务器上的该数据块配置主标志和可写标志。
一种数据同步处理方法, 包括:
提供对数据块配置有可同歩标志的第一服务器;
提供对该数据块配置有主标志和可写标志的第二服务器;
由同歩组件将所述第二服务器上该数据块的写入数据同歩至所述第一服务器上; 若所述第二服务器出现故障, 则移除所述第二服务器上该数据块的主标志和移除所述第 一服务器上该数据块的可同步标志, 以及对所述第一服务器上的该数据块配置主标志和可写 标志;
在所述第二服务器的故障恢复后, 将该数据块的快照在所述第二服务器上导入; 对所述第二服务器上的该数据块配置可同步标志;
由同步组件将所述第一服务器上该数据块的写入数据同步至所述第二服务器上; 在要恢复所述第二服务器针对该数据块的主机地位时, 移除所述第一服务器上该数据块 的可 标志;
由同步组件将所述第一服务器上该数据块的最新写入数据同步 所述第二服务器上; 在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后, 移除所述第一服务 器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标志, 对所述第二服务器 上的该数据块配置主标志和可写标志以及对所述第一服务器上的该数据块配置可同歩标志。
一种数据同步处理系统, 包括:
第一服务器;
第二服务器;
配置模块, 用于对所述第一服务器上的数据块配置主标志和可写标志;
导入模块, 用于将该数据块的快照在所述第二服务器上导入;
所述配置模块还用于对所述第二服务器上的该数据块配置可同歩标志;
同步组件, 用于将所述第一服务器上该数据块的写入数据同步至所述第二服务器上; 所述配置模块还用于在要从所述第一服务器上迁出该数据块时, 移除所述第一服务器上 该数据块的可写标志;
所述配置模块还用于在所述第二服务器与所述第一服务器上该数据块的数据完全同歩 后, 移除所述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标 志, 以及对所述第二服务器上的该数据块配置主标志和可写标志。
一种数据同步处理系统, 包括:
第一服务器;
第二服务器;
配置模块, 用于对第一服务器上的数据块配置可同步标志, 以及用于对第二服务器上的 该数据块配置主标志和可写标志;
同步组件, 用于将所述第二服务器上该数据块的写入数据同歩至所述第一服务器上; 所述配置模块还用于若所述第二服务器出现故障时, 则移除所述第二服务器上该数据块 的主标志和移除所述第一服务器上该数据块的可同步标志, 以及对所述第一服务器上的该数 据块配置主标志和可写标志;
导入模块, 用于在所述第二服务器的故障恢复后, 将该数据块的快照在所述第二服务器 上导入;
所述配置模块还用于在所述第二服务器的故障恢复后, 对所述第二服务器上的该数据块 配置可同步标志;
所述同步组件还用于在所述第二服务器的故障恢复后, 将所述第一服务器上该数据块的 写入数据同步至所述第二服务器上;
所述配置模块还用于在要恢复所述第二服务器针对该数据块的主机地位时, 移除所述第 一服务器上该数据块的可写标志;
所述配置模块还用于在所述第二服务器与所述第一服务器上该数据块的数据完全同歩 后, 移除所述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同步标 志, 对所述第二服务器上的该数据块配置主标志和可写标志以及对所述第一服务器上的该数
据块配置可同步标志。
本发明实施例提供的技术方案带来的有益效果是: 通过在主机服务器上进行数据迁移或 者主机服务器出现故障进行恢复的过程中, 利用同歩组件拥有将标有主标志的主机服务器上 的数据同步到标有可同步标志的从机服务器上的特性, 将主机服务器上的数据同歩至从机服 务器上, 并配合在主机服务器的数据迁移或故障恢复过程中采用主写点切换的方式, 可以避 免传统方法中繁琐的重做流水操作, 并且很大程度缩短数据迁移和故障恢复过程中对外不可 写的时间, 从而减少用户对数据迁移以及机器故障等运维操作的感知程度。
附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所需要使用的附 图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本领域 普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例提供的主从切换过程中数据块的标志位状态改变示意图;
图 2是本发明第一实施例提供的数据同步处理方法的流程图;
图 3是本发明第二实施例提供的数据同步处理方法的流程图;
图 4是本发明第一实施例提供的数据同歩处理系统的结构示意图;
图 5是本发明第二实施例提供的数据同歩处理系统的结构示意图。
具体实施方式
本发明实施例提供一种数据同步处理方法及系统。 为使本发明的目的、 技术方案和优点 更加清楚, 下面将结合附图对本发明实施方式作进一步地详细描述。
在描述本发明实施例提供的数据同步处理方法及系统之前, 先介绍本发明实施例提供的 主从切换的概念。所谓主从切换, 即在配备有主机服务器 (Master)与从机服务器 (Slave)的服 务器架构中,由配置中心将具有主写点的主机服务器 (Master)降级,并提升从机服务器 (Slave) 为 ¾写点的方法。 在进行主从切换之后, 原从机服务器被提升为主机服务器, 同时原主机服 务器被降级为从机服务器。
请参考图 1, 图 1是本发明实施例的主从切换过程中数据块的标志位状态改变的示意图。 初始时, serverl中对数据配置有主标志 (M)、 可写标志 (W)和可读标志(R), server2中对数 据配鬵有可同步标志(S)和 ¾Γ读标志(R), serverl成为数据的主机服务器 i为数据的主写点; server2 成为数据的从机服务器且可从主机服务器上接收数据进行同歩, 以在从机服务器上 建立数据副本。 两者经过数据同步之后, 从机服务器上的数据与主机服务器上的数据基本一 致, 除了主机服务器上刚写入的最新数据正在同步或者正在等待同歩至从机服务器上之外。
在进行主从切换之前, 首先由配置中心对 serverl禁写, 即移除 serverl上数据的可写 标志(W), 并保持 serverl上数据的主标志(M)和 server2上数据的可同歩标志(S), 使刚写入 主机服务器上的最新数据也可以在对主机服务器禁写期间同步至从机服务器上, 确保从机服 务器上的数据与主机服务器上的数据完全一致, 使从机服务器与主机服务器上的数据达到相 同的同步点。
在从机服务器与主机服务器上的数据达到相同的同步点后, 即可进行主从切换的操作, 由配置中心移除 serverl 上数据的主标志(M)和移除 server2 上数据的可同歩标志(S), 对 server2上的数据配置主标志(M)和可写标志(W) ,并对 serverl上的数据配覽可同歩标志(S), 此时 server2升级为数据的新主机服务器, serverl 降级为数据的新从机服务器, 从而完成 主从切换的过程。
请参考图 2, 图 2为本发明第一实施例提供的数据同步处理方法的流程图, 在本实施例 中, 该数据同步处理方法适用于将数据从一台主机服务器上迁移至另一台服务器上。 当某一 台主机服务器上存储有 A、 B、 C等多个数据块并持续接收外部数据写入时, 如果其中某个数 据块 (例如 A数据块) 的外部数据写入量特别多, 膨胀的很快, 就可以把 A数据块单独迁出 至另一台服务器上, 并将该另一台服务器配置为 A数据块的主机服务器, 使该另一台服务器 成为 A数据块的主写点, 这样就可以缓解原主机服务器的存储压力, 而外部数据写入量相对 较少的其余数据块(B、 C等数据块) 仍然可以使用原主机服务器作为主写点。 所述数据同步 处理方法包括:
步骤 S101 : 提供对数据块配置有主标志和可写标志的第一服务器;
所述第一服务器对数据块由于配置有主标志 (M)和可写标志 (W), 因此所述第一服务器成 为该数据块的主机服务器, 并可以接收外部针对该数据块的数据写入。 具体地, 可由配置中 心对所述第一服务器上的该数据块配置主标志 (M)和可写标志 (W) ; 进一步地, 还!"以对所述 第一服务器上的该数据块配置可读标志 (R),使所述第一服务器同时还可对外提供该数据块的 读取功能。
步骤 S102: 提供第二服务器, 并将该数据块的快照在所述第二服务器上导入; 例如, 可从冷备中心将该数据块的快照导入所述第二服务器上。
歩骤 S103: 对所述第二服务器上的该数据块配置可同步标志;
如果所述第一服务器上的某数据块 (例如 A数据块),由于膨胀很快, 需要将 A数据块从 所述第一服务器上迁移至另一台新的服务器上时, 则提供一台新设备作为第二服务器, 并将 该数据块的快照在所述第二服务器上导入。
一般地, 服务器中的数据会定期 (例如每天早上某个时间) 做一次快照 (Snapshot), 并 将该快照存储在冷备中心, 以备未来恢复数据时使用; 在做快照时, 既可以针对主机服务器 上的数据制作快照, 也可以针对从机服务器上的数据制作快照。 另外, 因为主机服务器是主 写点, 主机服务器上还会记录一份完整的写操作流水 (Binlog), 用于数据同歩或恢复。
当需要将所述第一服务器上的 A数据块迁移至所述第二服务器上时, 首先需要将所述第 二服务器搭建为 A数据块的从机服务器, 使所述第一服务器与所述第二服务器之间针对 A数 据块而言构成主机与从机的关系, 以利用同步组件将 A数据块的数据同歩至所述第二服务器 上。 因此, 可以先从冷备中心获取 A数据块于最近时间 (当天或者前一天) 的快照, 并将该 快照在所述第二服务器上导入, 之后再对所述第二服务器上的该数据块配置可同歩标志 (S), 使所述第二服务器成为 A数据块的从机服务器, 即可由同歩组件将 A数据块于快照点之后的 新写入数据从所述第一服务器发送至所述第二服务器上进行增量数据同歩, 避免从 Seq=0开 始数据的全量同步所需要消耗的大量时间, 从而大大减少整个数据迁移所花费的时间。
具体地, 对所述第二服务器上的该数据块配置可同步标志 (S)时, 可 ώ配置中心对所述第 二服务器配置可同歩标志 (S) ; 进一歩地, 还 ¾1以对所述第二服务器上的该数据块配置可读标 志 (R) , 使所述第二服务器同时还可对外提供该数据块的读取功能。
步骤 S104: 由同步组件将所述第一服务器上该数据块的写入数据同歩至所述第二服务器 上;
同步组件是一种通用的数据同步组件, 用于将主机服务器接收的写入数据同步到对应可 同步的从机服务器上, 该同步组件的实现原理是通过读取主机服务器记录的写操作流水, 按 照从机服务器所需要流水序号(Seq)推送到从机服务器上, 从而实现以主机服务器的写操作 顺序同歩到从机服务器的目的, 这种实现将主机服务器上的数据按照写入序号(Seq)顺序推 送到可同歩从机服务器上的模块, 统称为同步组件; 同步组件拥有将标有主标志 (M)的主机服 务器上的数据同步到标有可同步标志 (S)的从机服务器上的特性,因此在所述第一服务器与所 述第二服务器之间对 A数据块而言构成主机与从机的关系之后, 便可由同步组件将所述第一 服务器上 A数据块的写入数据 (写操作流水) 发送至所述第二服务器上进行 A数据块的数据 同歩, 使所述第二服务器上 A数据块的数据与所述第一服务器上 A数据块的数据维持同歩状 态。
步骤 S105: 在要从所述第一服务器上迁出该数据块时, 移除所述第一服务器上该数据块 的可写标志;
歩骤 S106: 由同步组件将所述第一服务器上该数据块的最新写入数据同歩至所述第二服
务器上;
在要从所述第一服务器迁出 A数据块时, 可由配置中心移除所述第一服务器上 A数据块 的可写标志 (W), 使所述第一服务器针对 A数据块成为禁止写入状态。 由于在上述歩骤 S104 中, 所述第二服务器与所述第一服务器进行 A数据块的数据同歩之后, 所述第二服务器上 A 数据块的数据与所述第一服务器上 A数据块的数据已基本一致, 除了刚写入所述第一服务器 上的最新数据正在同步或者正在等待同步至所述第二服务器上之外。 为了使所述第二服务器 上 A数据块的数据与所述第一服务器上 A数据块的数据完全同步即达到一个相同的同歩点, 此时可由配置中心移除所述第一服务器上 A数据块的可写标志 (W),对所述第一服务器进行短 暂时间(例如几秒钟)的禁写。在禁写期间保持所述第一服务器上 A数据块的主标志 (M)和所 述第二服务器上 A数据块的可同步标志 (S),使所述第一服务器与所述第二服务器之间对 A数 据块而言仍然构成主机与从机的关系。 由同步组件将所述第一服务器上对 A数据块刚写入的 最新数据推送至所述第二服务器上进行数据同步, 使所述第二服务器上 A数据块的数据同步 到与所述第一服务器上 A数据块的数据完全一致, 让所述第二服务器与所述第一服务器上 A 数据块的数据达到相同的同步点。
步骤 S107: 在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后, 移除所 述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标志, 以及对 所述第二服务器上的该数据块配置主标志和可写标志。
在对所述第一服务器的 A数据块禁写, 并等待所述第二服务器上 A数据块的数据与所述 第一服务器上 A数据块的数据完全同步后, 则可由配置中心移除所述第一服务器上 A数据块 的主标志 (M)和移除所述第二服务器上 A数据块的可同步标志 (S), 以及对所述第二服务器上 的 A数据块配置主标志 (M), 此时所述第二服务器被提升为 A数据块的新主机服务器。在确认 新主机服务器工作正常后, 即可由配置中心对所述第二服务器上的 A 数据块配置可写标志 (W) , A数据块的外部数据写入即被转移至所述第二服务器 (即新主机服务器) 上。
进一步地, 可选地, 在移除所述第一服务器上 A数据块的主标志 (M)之后, 还包括: 步骤 S108: 清理所述第一服务器上的该数据块以回收该数据块所占用的空间。
A数据块迁出之后, 需要将 A数据块从所述第一服务器上清理掉, 不然所述第一服务器 上还会有 A数据块的残留。 将所述第一服务器上的 A数据块清理后可回收 A数据块所占用的 空间, 腾出来的空间可以留给所述第一服务器上的其他数据块 (例如 B、 C等数据块) 使用。
请参考图 3, 图 3是本发明第二实施例提供的数据同歩处理方法的流程图, 在本实施例 中, 该数据同步处理方法适用于当主机服务器出现故障时对数据的同步处理, 所述数据同步
处理方法包括:
歩骤 S201 : 提供对数据块配置有可同歩标志的第一服务器;
所述第一服务器对数据块由于配置有可同步标志 (S) ,因此所述第一服务器成为该数据块 的从机服务器。 具体地, 可由配置中心对所述第一服务器上的该数据块配置可同歩标志 (S) ; 进一步地, 还^以对所述第一服务器上的该数据块配置可读标志 (R) , 使所述第一服务器同时 还可对外提供该数据块的读取功能。
歩骤 S202: 提供对该数据块配置有主标志和可写标志的第二服务器;
所述第二服务器对数据块由于配置有主标志 (M)和可写标志 (W) , 因此所述第二服务器成 为该数据块的主机服务器, 并可以接收外部针对该数据块的数据写入。 具体地, 可由配置中 心对所述第二服务器上的该数据块配置主标志 (M)和可写标志 (W); 进一歩地, 还可以对所述 第二服务器上的该数据块配置 读标志(R) ,使所述第二服务器同时还可对外提供该数据块的 读取功能。
步骤 S203: 由同步组件将所述第二服务器上该数据块的写入数据同歩至所述第一服务器 上;
同步组件是一种通用的数据同步组件, 用于将主机服务器接收的写入数据同歩到对应可 同歩的从机服务器上, 该同歩组件的实现原理是通过读取主机服务器记录的写操作流水, 按 照从机服务器所需要流水序号(Seq)推送到从机服务器上, 从而实现以主机服务器的写操作 顺序同步到从机服务器的目的, 这种实现将主机服务器的数据按照写入序号(Seq)顺序推送 到可同步从机服务器上的模块, 统称为同步组件; 由于同步组件拥有将标有主标志 (M)的主机 服务器上的数据同歩到标有可同步标志 (S)的从机服务器上的特性,因此在所述第二服务器与 所述第一服务器之间针对数据块构成主机与从机的关系之后, 便可由同歩组件将所述第二服 务器上数据块的写入数据 (写操作流水) 发送至所述第一服务器上进行数据同步, 使所述第 一服务器上数据块的数据与所述第二服务器上数据块的数据维持同歩状态。
步骤 S204: 若所述第二服务器出现故障, 则移除所述第二服务器上该数据块的主标志和 移除所述第一服务器上该数据块的可同歩标志, 以及对所述第一服务器上的该数据块配置主 标志和可写标志; 当所述第二服务器出现死机或硬件损坏等故障而无法提供正常服务时, 可由配置中心指 示移除所述第二服务器上该数据块的主标志 (Μ)和移除所述第一服务器上该数据块的可同歩 标志 (S) , 以及对所述第一服务器上的该数据块配置主标志 (Μ)和可写标志 (W), 从而直接将所 述第一服务器提升为该数据块的新主机服务器, 使外部针对该数据块的数据写入从所述第二
服务器 (原来的主机服务器) 转移至所述第一服务器 (即新的主机服务器) 上, 从而在最短 的时间内切换该数据块的主写点并恢复外部数据写入。
步骤 S205: 在所述第二服务器的故障恢复后, 将该数据块的快照在所述第二服务器上导 入;
例如, 可从冷备中心将该数据块的快照导入所述第二服务器上。
步骤 S206: 对所述第二服务器上的该数据块配置可同步标志;
一般地, 服务器中的数据会定期 (例如每天早上某个时间) 做一次快照 (Snapshot), 并 将该快照存储在冷备中心, 以备未来恢复数据时使用; 在做快照时, 既可以针对主机服务器 上的数据制作快照, 也可以针对从机服务器上的数据制作快照。 另外, 因为主机服务器是主 写点, 主机服务器上还会记录一份完整的写操作流水 (Binlog), 用于数据同歩或恢复。
在第二服务器的故障恢复后, 可以先从冷备中心获取该数据块于最近时 | (当天或者前 一天) 的快照, 并将该快照在所述第二服务器上导入, 之后再由配置中心对第二服务器上的 该数据块配置可同步标志 (S)使其成为该数据块的从机服务器,使第一服务器与第二服务器之 间对该数据块而言在当前构成主机与从机的关系, 即可由同步组件将该数据块于快照点之后 的新写入数据从第一服务器上发送至第二服务器上进行增量数据同歩, 从而大大减少同歩数 据所花费的时间。
步骤 S207: 由同步组件将所述第一服务器上该数据块的写入数据同歩至所述第二服务器 上;
由于在经过上述歩骤 S205和步骤 S206后, 所述第一服务器与所述第二服务器之间对该 数据块而言己构成主机与从机的关系, 因此可由同歩组件将所述第一服务器上该数据块的写 入数据 (写操作流水) 发送至所述第二服务器上进行数据同歩, 使所述第二服务器上该数据 块的数据与所述第一服务器上该数据块的数据维持同步状态。
步骤 S208: 在要恢复所述第二服务器针对该数据块的主机地位时, 移除所述第一服务器 上该数据块的可写标志;
步骤 S209: 由同步组件将所述第一服务器上该数据块的最新写入数据同歩至所述第二服 务器上;
在所述第二服务器恢复正常服务之后, 还需要再做一次主从切换, 将主写点从当前的第 一服务器切换回原来的主机即第二服务器上, 以恢复所述第二服务器的主机地位, 这是因为 原来作为主机的第二服务器一般在物理部署上比原来作为从机的第一服务器有性能优势, 例 如网络条件好、离接入服务器较近等。在上述步骤 S207中已经将第一服务器上该数据块的数
据同步至第二服务器上, 使所述第二服务器上该数据块的数据与所述第一服务器上该数据块 的数据基本一致, 除了刚写入所述第一服务器上的最新数据正在同歩或者正在等待同歩至所 述第二服务器上之外。 在要恢复所述第二服务器的主机地位时, 可 ώ配置中心移除所述第一 服务器上该数据块的可写标志 (w), 对所述第一服务器进行短暂时间 (例如几秒钟) 的禁写, 同时在禁写期间保持第一服务器上该数据块的主标志(M)和第二服务器上该数据块的可同歩 标志 (S),由同步组件将第一服务器上针对该数据块的最新写入数据发送至第二服务器上进行 同步, 使第二服务器上该数据块的数据同步到与第一服务器上该数据块的数据完全一致, 让 第二服务器与第一服务器上该数据块的数据达到相同的同歩点。
步骤 S210: 在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后, 移除所 述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标志, 对所述 第二服务器上的该数据块配置主标志和可写标志以及对所述第一服务器上的该数据块配置可 同步标志。
在第二服务器与第一服务器上该数据块的数据达到相同的同歩点后, 可由配置中心移除 第一服务器上该数据块的主标志 (M)和移除第二服务器上该数据块的可同歩标志 (S), 对第二 服务器上的该数据块配置主标志 (M)和可写标志 (W), 以及对第一服务器上的该数据块配置可 同歩标志 (S), 使第二服务器成为该数据块的主机服务器, 使第一服务器该数据块的成为从机 服务器。 此时第二服务器被恢复到原来的主机身份, 第一服务器被恢复到原来的从机身份。 至此, 该数据块的外部数据写入被重新转移至所述第二服务器上, 至此所述第二服务器出现 故障的整个数据同步恢复过程完成。
上述实施例中提出的数据同步处理方法, 可应用于对主机服务器上的数据进行迁移或主 机服务器出现故障而无法正常服务等情形下的数据同歩处理。 在数据迁移时, 通过对新设备 配置可同步标志, 将新设备搭建为从机, 再利用同步组件的特性, 由同歩组件将主机服务器 上数据同步到搭建为从机的新设备上, 避免传统方法中繁琐的重做流水操作, 并且在整个数 据迁移的过程中, 只需要在进行数据的主写点切换之前对主机服务器进行短暂时间的禁写。 在主机服务器出现故障时, 通过直接将一个从机服务器提升为新的主机服务器, 达到快速进 行数据的主写点切换并及时恢复外部的数据写入的目的, 避免传统方案中需要等待主机服务 器的故障恢复之后再在主机服务器上进行繁琐的重做流水操作; 另外, 若要将数据的主写点 切回原来的主机服务器, 也只需要在进行主写点切换之前对当前的主机服务器进行短暂时间 的禁写。 因此, 上述数据同步处理方法中, 数据的主写点切换在很短的时间内完成, 外部数 据在短时间之内即可重新写入, 无需用户长时间的等待, 避免传统方法中需要对主机服务器
进行长时间的禁写操作而影响用户写入的情况出现, 大幅降低用户对后台运维和故障的感知 程度, 同时达到简化故障恢复流程, 降低运维成本的目的。
请参考图 4, 图 4为本发明第一实施例提供的数据同歩处理系统的结构示意图, 所述数 据同歩处理系统包括:
第一服务器 301 ;
第二服务器 302;
配置模块 303, 用于对所述第一服务器 301上的数据块配置主标志和可写标志; 导入模块 304, 用于将该数据块的快照在所述第二服务器 302上导入;
所述配置模块 303还用于对所述第二服务器 302上的该数据块配置可同步标志; 同步组件 305, 用于将所述第一服务器 301上该数据块的写入数据同歩至所述第二服务 器 302上;
所述配置模块 303还用于在要从所述第一服务器 301上迁出该数据块时, 移除所述第一 服务器 301上该数据块的可写标志;
所述配置模块 303还用于在所述第二服务器 302上该数据块的数据与所述第一服务器 301 上该数据块的数据完全同步后, 移除所述第一服务器 301上该数据块的主标志和移除所述第 二服务器 302上该数据块的可同歩标志, 以及对所述第二服务器 302上的该数据块配置主标 志和可写标志。
所述同歩组件 305拥有将标有主标志的主机服务器上的数据同歩到标有可同歩标志的从 机服务器上的特性。 '
进一步地, 上述第一实施例中的数据同步处理系统还包括清理模块 306, 所述配置模块 303在移除所述第一服务器 301上该数据块的主标志之后, 所述清理模块 306清理所述第一 服务器 301上的该数据块以回收该数据块所占用的空间。
请参考图 5 , 图 5为本发明第二实施例提供的数据同步处理系统的结构示意图, 所述数 据同步处理系统包括- 第一服务器 401 ;
第二服务器 402;
配置模块 403, 用于对第一服务器 401上的数据块配置可同歩标志, 以及用于对第二服 务器 402上的该数据块配置主标志和可写标志;
同步组件 404, 用于将所述第二服务器 402上该数据块的写入数据同歩至所述第一服务 器 401上;
所述配置模块 403还用于若所述第二服务器 402出现故障时,则移除所述第二服务器 402 上该数据块的主标志和移除所述第一服务器 401上该数据块的可同歩标志, 以及对所述第一 服务器 401上的该数据块配置主标志和可写标志;
导入模块 405, 用于在所述第二服务器 402的故障恢复后, 将该数据块的快照在所述第 二服务器 402上导入
所述配置模块 403还用于在所述第二服务器 402的故障恢复后, 对所述第二服务器 402 上的该数据块配置可同步标志;
所述同步组件 404还用于在所述第二服务器 402的故障恢复后, 将所述第一服务器 401 上该数据块的写入数据同步至所述第二服务器 402;
所述配置模块 403还用于在要恢复所述第二服务器 402针对该数据块的主机地位时, 移 除所述第一服务器 401上该数据块的可写标志;
所述配置模块 403还用于在所述第二服务器 402上该数据块的数据与所述第一服务器 401 上该数据块的数据完全同步后, 移除所述第一服务器 401上该数据块的主标志和移除所述第 二服务器 402上该数据块的可同步标志, 对所述第二服务器 402上的该数据块配 B主标志和 可写标志以及对所述第一服务器 401上的该数据块配置可同歩标志。
所述同步组件 404拥有将标有主标志的主机服务器上的数据同歩到标有可同歩标志的从 机服务器上的特性。
关于上述实施例中数据同步处理系统的进一步细节, 还可参阅上述实施例中数据同歩处 理方法及相关描述。
需要说明的是, 在本文中, 术语 "包括"、 "包含"或者其任何其他变体意在涵盖非排他 性的包含, 从而使得包括一系列要素的过程、 方法、 物品或者设备不仅包括那些要素, 而且 还包括没有明确列出的其他要素, 或者是还包括为这种过程、 方法、 物品或者设备所固有的 要素。 在没有更多限制的情况下, 由语句 "包括一个…… " 限定的要素, 并不排除在包括所 述要素的过程、 方法、 物品或者设备中还存在另外的相同要素。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程, 是可以通过计 算机程序来指令相关的硬件来完成, 所述的程序可存储于一计算机可读取存储介质中, 该程 序在执行时, 可包括如上述各方法的实施例的流程。其中, 所述的存储介质可为磁碟、 光盘、 只读存储记忆体(Read Only Memory, ROM)或隨机存储记忆体(Random Access Memory, RAM) 等。
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的精神和原则之
内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内,
Claims
1、 一种数据同步处理方法, 其特征在于, 包括:
提供对数据块配置有主标志和可写标志的第一服务器;
提供第二服务器, 并将该数据块的快照在所述第二服务器上导入;
对所述第二服务器上的该数据块配置可同步标志;
一权
由同歩组件将所述第一服务器上该数据块的写入数据同歩至所述第二服务器上; 在要从所述第一服务器上迁出该数据块时,移除所述第一服务器上该数据块的可写标志;
利
由同步组件将所述第一服务器上该数据块的最新写入数据同步至所述第二服务器上; 在所述第二服务器与所述第一服务器上该数据块的数据完全同步后, 移除所述第一服务 器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标志, 以及对所述第二服 务器上的该数据块配置主标志和可写标志。
2、 根据权利要求 1所述的数据同步处理方法, 其特求征在于, 在移除所述第一服务器上该 数据块的主标志之后还包括: 清理所述第一服务器上的该数据块以回收该数据块所占用的空 间。
3、 一种数据同步处理方法, 其特征在于, 包括- 提供对数据块配置有可同歩标志的第一服务器;
提供对该数据块配置有主标志和可写标志的第二服务器; .
由同步组件将所述第二服务器上该数据块的写入数据同歩至所述第一服务器上; 若所述第二服务器出现故障, 则移除所述第二服务器上该数据块的主标志和移除所述第 一服务器上该数据块的可同步标志, 以及对所述第一服务器上的该数据块配置主标志和可写 标志;
在所述第二服务器的故障恢复后, 将该数据块的快照在所述第二服务器上导入; 对所述第二服务器上的该数据块配置可同步标志;
由同歩组件将所述第一服务器上该数据块的写入数据同歩 S所述第二服务器上; 在要恢复所述第二服务器针对该数据块的主机地位时, 移除所述第一服务器上该数据块 的可写标志;
由同歩组件将所述第一服务器上该数据块的最新写入数据同步至所述第二服务器上; 在所述第二服务器与所述第一服务器上该数据块的数据完全同歩后, 移除所述第一服务 器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标志, 对所述第二服务器
上的该数据块配置主标志和可写标志以及对所述第- -服务器上的该数据块配置可同步标志。
4、 一种数据同步处理系统, 其特征在于, 包括:
第一服务器;
第二服务器;
配置模块, 用于对所述第一服务器上的数据块配置主标志和可写标志;
导入模块, 用于将该数据块的快照在所述第二服务器上导入;
所述配置模块还用于对所述第二服务器上的该数据块配置 π了同歩标志;
同歩组件, 用于将所述第一服务器上该数据块的写入数据同歩至所述第二服务器上; 所述配置模块还用于在要从所述第一服务器上迁出该数据块时, 移除所述第 -服务器上 该数据块的可写标志;
所述配置模块还用于在所述第二服务器与所述第一服务器上该数据块的数据完全同歩 后, 移除所述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同歩标 志, 以及对所述第二服务器上的该数据块配置主标志和可写标志。
5、 根据权利要求 4所述的数据同步处理系统, 其特征在于, 还包括清理模块, 所述配置 模块在移除所述第一服务器上该数据块的主标志之后, 所述清理模块清理所述第一服务器上 的该数据块以回收该数据块所占用的空间。
6、根据权利要求 4所述的数据同步处理系统, 其特征在于, 所述同歩组件拥有将标有主 标志的主机服务器上的数据同歩到标有可同步标志的从机服务器上的特性。
7、 种数据同步处理系统, 其特征在于, 包括:
第- .服务器;
第二服务器;
配置模块, 用于对第一服务器上的数据块配置可同步标志, 以及用于对第二服务器上的 该数据块配置主标志和可写标志;
同歩组件, 用于将所述第二服务器上该数据块的写入数据同步至所述第一服务器上: 所述配置模块还用于若所述第二服务器出现故障时, 则移除所述第二服务器上该数据块 的主标志和移除所述第一服务器上该数据块的可同歩标志, 以及对所述第一服务器上的该数 据块配置主标志和可写标志;
导入模块, 用于在所述第二服务器的故障恢复后, 将该数据块的快照在所述第二服务器 上导入;
所述配置模块还用于在所述第二服务器的故障恢复后, 对所述第二服务器 h:的该数据块
配置可同步标志;
所述同步组件还用于在所述第二服务器的故障恢复后, 将所述第一服务器上该数据块的 写入数据同步至所述第二服务器上;
所述配置模块还用于在要恢复所述第二服务器针对该数据块的主机地位时, 移除所述第 一服务器上该数据块的可写标志;
所述配置模块还用于在所述第二服务器与所述第一服务器上该数据块的数据完全同歩 后, 移除所述第一服务器上该数据块的主标志和移除所述第二服务器上该数据块的可同步标 志, 对所述第二服务器上的该数据块配置主标志和可写标志以及对所述第一服务器上的该数 据块配置可同步标志。
8、根据权利要求 7所述的数据同步处理系统, 其特征在于, 所述同歩组件拥有将标有主 标志的主机服务器上的数据同步到标有可同步标志的从机服务器上的特性。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US14/749,579 US9525733B2 (en) | 2012-12-25 | 2015-06-24 | Method and system for data synchronization |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210570241.0A CN103905220B (zh) | 2012-12-25 | 2012-12-25 | 数据同步处理方法及系统 |
| CN201210570241.0 | 2012-12-25 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US14/749,579 Continuation US9525733B2 (en) | 2012-12-25 | 2015-06-24 | Method and system for data synchronization |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2014101510A1 true WO2014101510A1 (zh) | 2014-07-03 |
Family
ID=50996376
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2013/084463 Ceased WO2014101510A1 (zh) | 2012-12-25 | 2013-09-27 | 数据同步处理方法及系统 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US9525733B2 (zh) |
| CN (1) | CN103905220B (zh) |
| WO (1) | WO2014101510A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108900497A (zh) * | 2018-06-25 | 2018-11-27 | 江苏欧软信息科技有限公司 | 一种异构系统间的数据同步方法及系统 |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105955989B (zh) * | 2015-12-31 | 2020-12-22 | 华云数据控股集团有限公司 | 一种云平台数据库主从服务器的建立方法 |
| US11036676B2 (en) * | 2016-03-04 | 2021-06-15 | International Business Machines Corporation | Modifying storage space consumed by snapshots |
| CN106453641B (zh) * | 2016-11-24 | 2018-05-22 | 深圳市小满科技有限公司 | 企业云服务平台动态扩容方法、装置及系统 |
| US10430270B2 (en) * | 2017-12-04 | 2019-10-01 | Bank Of America Corporation | System for migrating data using dynamic feedback |
| CN111858143A (zh) * | 2019-04-24 | 2020-10-30 | 伊姆西Ip控股有限责任公司 | 用于管理存储系统的方法、设备和计算机可读存储介质 |
| CN112138372B (zh) * | 2020-10-14 | 2022-07-29 | 腾讯科技(上海)有限公司 | 分布式系统中的数据同步方法及相关设备 |
| CN113792024B (zh) * | 2021-03-02 | 2025-08-22 | 北京沃东天骏信息技术有限公司 | 用于迁移数据的方法、装置、设备以及存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040260953A1 (en) * | 2003-06-18 | 2004-12-23 | Microsoft Corporation | Password synchronization in a sign-on management system |
| CN101316161A (zh) * | 2008-06-25 | 2008-12-03 | 广东威创视讯科技股份有限公司 | 一种分布式视频同步显示方法和系统 |
| CN101166309B (zh) * | 2007-08-10 | 2010-06-23 | 中兴通讯股份有限公司 | 一种双归属系统中实现用户数据同步的方法 |
| CN102124450A (zh) * | 2008-08-20 | 2011-07-13 | 通用电气智能平台有限公司 | 用于过程控制服务器的同步化的方法和系统 |
Family Cites Families (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5784503A (en) * | 1994-08-26 | 1998-07-21 | Unisys Corp | Check reader utilizing sync-tags to match the images at the front and rear faces of a check |
| US6259829B1 (en) * | 1995-04-07 | 2001-07-10 | Unisys Corporation | Check Reading apparatus and method utilizing sync tags for image matching |
| US20030088442A1 (en) * | 2001-10-23 | 2003-05-08 | Michael Martin W. | Inventory management system and method |
| US20070094466A1 (en) * | 2001-12-26 | 2007-04-26 | Cisco Technology, Inc., A Corporation Of California | Techniques for improving mirroring operations implemented in storage area networks and network based virtualization |
| US7805403B2 (en) * | 2007-01-07 | 2010-09-28 | Apple Inc. | Synchronization methods and systems |
| US8285121B2 (en) * | 2007-10-07 | 2012-10-09 | Fall Front Wireless Ny, Llc | Digital network-based video tagging system |
| US20100293143A1 (en) * | 2009-05-13 | 2010-11-18 | Microsoft Corporation | Initialization of database for synchronization |
| US9047312B1 (en) * | 2011-03-30 | 2015-06-02 | Amazon Technologies, Inc. | System and method for deletion of extraneous delete marker objects |
| CN102662751B (zh) * | 2012-03-30 | 2016-05-11 | 浪潮电子信息产业股份有限公司 | 一种提高基于热迁移虚拟机系统可用性的方法 |
| US9529810B2 (en) * | 2014-02-18 | 2016-12-27 | Ca, Inc. | Methods of synchronizing files including synchronized hash map linked lists and related data processing nodes |
-
2012
- 2012-12-25 CN CN201210570241.0A patent/CN103905220B/zh active Active
-
2013
- 2013-09-27 WO PCT/CN2013/084463 patent/WO2014101510A1/zh not_active Ceased
-
2015
- 2015-06-24 US US14/749,579 patent/US9525733B2/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040260953A1 (en) * | 2003-06-18 | 2004-12-23 | Microsoft Corporation | Password synchronization in a sign-on management system |
| CN101166309B (zh) * | 2007-08-10 | 2010-06-23 | 中兴通讯股份有限公司 | 一种双归属系统中实现用户数据同步的方法 |
| CN101316161A (zh) * | 2008-06-25 | 2008-12-03 | 广东威创视讯科技股份有限公司 | 一种分布式视频同步显示方法和系统 |
| CN102124450A (zh) * | 2008-08-20 | 2011-07-13 | 通用电气智能平台有限公司 | 用于过程控制服务器的同步化的方法和系统 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108900497A (zh) * | 2018-06-25 | 2018-11-27 | 江苏欧软信息科技有限公司 | 一种异构系统间的数据同步方法及系统 |
| CN108900497B (zh) * | 2018-06-25 | 2021-11-02 | 江苏欧软信息科技有限公司 | 一种异构系统间的数据同步方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| HK1199678A1 (zh) | 2015-07-10 |
| CN103905220B (zh) | 2018-02-27 |
| US20150312340A1 (en) | 2015-10-29 |
| US9525733B2 (en) | 2016-12-20 |
| CN103905220A (zh) | 2014-07-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2014101510A1 (zh) | 数据同步处理方法及系统 | |
| US8806274B1 (en) | Snapshot assisted synchronous replication | |
| CN102142008B (zh) | 分布式内存数据库的实现方法、系统、令牌控制器及内存数据库 | |
| CN102891849B (zh) | 业务数据同步方法、恢复方法及装置和网络设备 | |
| WO2014059804A1 (zh) | 数据同步方法及系统 | |
| CN106919465B (zh) | 用于存储系统中多重数据保护的方法和装置 | |
| US11892922B2 (en) | State management methods, methods for switching between master application server and backup application server, and electronic devices | |
| CN101739313B (zh) | 一种连续数据保护和恢复方法 | |
| WO2016070375A1 (zh) | 一种分布式存储复制系统和方法 | |
| WO2010118657A1 (zh) | 一种数据恢复的方法、数据节点及分布式文件系统 | |
| WO2010148822A1 (zh) | 基于多副本协同的写操作方法、系统及节点 | |
| CN103336728A (zh) | 一种磁盘数据恢复方法 | |
| WO2020063600A1 (zh) | 数据容灾方法与站点 | |
| CN104993940A (zh) | 一种减少主备节点故障切换过程中数据丢失的方法和装置 | |
| CN107329859B (zh) | 一种数据保护方法及存储设备 | |
| CN106528005A (zh) | 一种分布式存储系统的磁盘添加方法及装置 | |
| CN106341251A (zh) | 基于双主控的主备倒换方法及装置 | |
| CN110928728A (zh) | 一种基于快照的虚拟机复制、切换方法及系统 | |
| CN111176900A (zh) | 一种分布式存储系统及其数据恢复方法、装置和介质 | |
| US9513996B2 (en) | Information processing apparatus, computer-readable recording medium having stored program for controlling information processing apparatus, and method for controlling information processing apparatus | |
| CN110427423A (zh) | 一种避免数据库会话中断的方法、设备及可读介质 | |
| CN103544081B (zh) | 双元数据服务器的管理方法和装置 | |
| CN103581262A (zh) | 一种主备数据同步方法、装置和系统 | |
| CN107621994B (zh) | 一种数据快照创建的方法及装置 | |
| CN109491980A (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: 13868136 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 (EPO FORM 1205N DATED 02-11-2015) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 13868136 Country of ref document: EP Kind code of ref document: A1 |