[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2017008648A1 - 集群切换方法与设备 - Google Patents

集群切换方法与设备 Download PDF

Info

Publication number
WO2017008648A1
WO2017008648A1 PCT/CN2016/088300 CN2016088300W WO2017008648A1 WO 2017008648 A1 WO2017008648 A1 WO 2017008648A1 CN 2016088300 W CN2016088300 W CN 2016088300W WO 2017008648 A1 WO2017008648 A1 WO 2017008648A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
primary cluster
new
read
operation request
Prior art date
Application number
PCT/CN2016/088300
Other languages
English (en)
French (fr)
Inventor
张婷
邹忠郁
李文兆
杨铭
吴锦波
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017008648A1 publication Critical patent/WO2017008648A1/zh
Priority to US15/870,572 priority Critical patent/US10609141B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols 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]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • H04L67/125Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms

Definitions

  • the present application relates to the field of computers, and in particular, to a cluster switching method and device.
  • data is stored in a single cluster.
  • data is often backed up to other clusters. This process is called Inter-cluster data synchronization.
  • the change process is called switching the primary cluster. How to ensure the consistency of data synchronization between clusters and ensure that there is no impact on users during cluster switching is a key technical solution for synchronization and handover between clusters.
  • the current synchronization technology solution is generally divided into an asynchronous synchronization scheme and a synchronous synchronization scheme between clusters, which respectively combine different handover schemes:
  • Asynchronous synchronization scheme using asynchronous modules to copy data from the primary cluster to the secondary cluster can ensure data consistency, but has a certain delay.
  • the primary cluster When the primary cluster needs to be switched to the external service, the primary cluster will appear. Part of the data has not been synchronized to the situation on the slave cluster. After the switchover, before the end of the data synchronization, the part of the data is invisible to the user, and the data is temporarily lost. During the part of the data synchronization, the user pairs Overwriting of this part of the data will cause data consistency problems. Therefore, before the switchover is required, the write of the primary cluster data will be stopped. When the data of the primary cluster is completely synchronized to the slave cluster, the switch is performed, and then the write permission of the user is opened. It does not affect user access and can solve data consistency problems, but due to latency, prohibiting user writes before switching can affect user usage.
  • An object of the present application is to provide a cluster switching method and device, which can resolve inter-cluster data migration or When backing up, it affects the user's use. Switching between clusters does not guarantee consistent problems.
  • a cluster switching method comprising:
  • the remaining primary data to be synchronized on the old primary cluster is synchronized to the new primary cluster, wherein the priority of the remaining original data on the new primary cluster is prioritized.
  • the write operation request is responded to on the new primary cluster.
  • the method further includes:
  • the write operation request includes a request for adding, rewriting, and deleting data.
  • the write operation request when the write operation request is to add or rewrite data, when the remaining original data to be synchronized on the old primary cluster is synchronized to the new primary cluster, on the new primary cluster.
  • a write operation request in response to a write operation request, it also includes:
  • the new primary cluster is responded during synchronization of the remaining original data to be synchronized on the old primary cluster to the new primary cluster. While writing the operation request, it also includes:
  • the delete operation request is read from the message queue, and after the read-to-delete operation request keeps the corresponding data on the old and new primary clusters consistent, the read delete operation request in the message queue is deleted.
  • deleting the read deletion operation request in the message queue includes:
  • the deleted data corresponding to the read delete operation request does not exist on the old primary cluster but exists on the new primary cluster, the corresponding deleted data on the new primary cluster is synchronized to the old primary cluster. Delete the read delete operation request described in the message queue;
  • the read delete operation request in the message queue is deleted.
  • the read operation requests responded on the old and new primary clusters include:
  • the corresponding data read on the new primary cluster is returned.
  • a cluster switching device is further provided, where the device includes:
  • a synchronization device configured to synchronize the remaining original data to be synchronized on the old primary cluster to the new primary cluster after the old primary cluster starts to switch to the new primary cluster, where the remaining is performed on the new primary cluster
  • the priority of the original data is set to low level
  • a write-response device during synchronization for responding to a write operation request on a new primary cluster during synchronization of remaining original data to be synchronized on the old primary cluster to a new primary cluster, wherein the write operation requests corresponding new data Priority Level is set to advanced, and only allows versions of the higher priority data on the new primary cluster to override another version of the same data with a lower priority or higher level;
  • the synchronous end write response device is configured to respond to the write operation request on the new primary cluster after synchronizing the remaining original data to be synchronized on the old primary cluster to the new primary cluster.
  • the device further includes a synchronization period read response device for synchronizing the remaining original data to be synchronized on the old primary cluster to the new primary cluster, on the old and new primary clusters. Responding read operation request;
  • the apparatus further includes a synchronization end read response device for responding to the read operation request on the new primary cluster after synchronizing the remaining original data to be synchronized on the old primary cluster to the new primary cluster.
  • the write operation request includes a request for adding, rewriting, and deleting data.
  • the device further includes a new or rewriting request message queue device, configured to: when the write operation request is to add or rewrite data, the remaining to be synchronized on the old primary cluster During synchronization of the original data to the new primary cluster, the new or rewritten operation request is written to the message queue while the new primary cluster is responding to the write operation request, and the new or rewritten operation is read from the message queue. The request, after synchronizing the newly added or rewritten data on the new primary cluster corresponding to the read new or rewrite operation request to the old primary cluster, deletes the read write operation request in the message queue.
  • the newly added or rewritten request message queue device is configured to determine whether there is new or rewritten data corresponding to the read new or rewrite operation request on the new primary cluster, and if yes, Synchronizing the newly added or rewritten data to the old primary cluster, and deleting the read or rewrite operation request read in the message queue; if not, deleting the read new or rewritten in the message queue Operation request.
  • the device further includes a delete request message queue device, configured to synchronize remaining original data to be synchronized on the old primary cluster to when the write operation request is a request for deleting the data
  • the delete operation request is written to the message queue, and the delete operation request is read from the message queue, and the read operation request is made according to the read-to-delete operation request. After the corresponding data on the old and new primary clusters are consistent, the read delete operation request in the message queue is deleted.
  • the deletion request message queue device is configured to delete the read in the message queue if the deleted data corresponding to the read deletion operation request does not exist on the old and new primary clusters If the deleted data corresponding to the delete operation request does not exist on the new primary cluster but exists on the old primary cluster, delete the corresponding deleted data on the old primary cluster.
  • Delete the read delete operation request in the message queue if the delete data corresponding to the read delete operation request does not exist on the old primary cluster, After the new primary cluster exists, the corresponding deleted data on the new primary cluster is synchronized to the old primary cluster, and the read delete operation request in the message queue is deleted; if the delete operation request is read If the corresponding deleted data exists on both the old and new primary clusters, the read delete operation request in the message queue is deleted.
  • the synchronization period read response device is configured to determine whether data corresponding to the read operation request is read from the old and new primary clusters, if the old or new primary cluster is in the old or new primary cluster. If the corresponding data is read, the data is returned; if the corresponding data is read in both the old and new primary clusters, the corresponding data read on the new primary cluster is returned.
  • the present application responds to the write operation request on the new primary cluster during the synchronization of the old primary cluster to the new primary cluster, and sets the priority of the new data corresponding to the write operation request to the advanced level.
  • the version of the data with the priority of the advanced primary cluster is only allowed to cover the other version of the same data with the lower priority or the higher level, and the main cluster of the external service can be switched without affecting the user's use. That is, in the case that it is not necessary to prohibit user access, the user can read and write all the data after the start of the handover to the end of the handover, and the data on the old and new primary clusters can be ensured to achieve the seamless migration of data between the clusters. Or backup.
  • the present application reads the new or rewrite operation request from the message queue by writing the new or rewrite operation request into the message queue, and the new corresponding to the read new or rewrite operation request
  • the read write operation request in the message queue is deleted, thereby ensuring the consistency of the data on the old and new primary clusters. Data synchronization on both clusters is always maintained to meet the need to switch back to the old primary cluster A from the new primary cluster B.
  • the present application reads the delete operation request from the message queue by writing the delete operation request into the message queue, and keeps the corresponding data on the old and new primary clusters consistent according to the read-to-delete operation request. , delete the read delete operation request in the message queue, thereby ensuring the consistency of data on the old and new primary clusters, and always maintaining data synchronization on the two clusters to meet when there is a new primary cluster B Switch back to the old primary cluster A requirements.
  • FIG. 1 shows a flow chart of a cluster switching method in accordance with an aspect of the present application
  • FIG. 2 shows a flow chart of a cluster switching method in accordance with a preferred embodiment of the present application
  • FIG. 3 is a flowchart showing a cluster switching method according to another preferred embodiment of the present application.
  • FIG. 4 shows a flow chart of a cluster switching method according to still another preferred embodiment of the present application.
  • FIG. 5 is a flowchart showing a cluster switching method according to still another preferred embodiment of the present application.
  • FIG. 6 shows a flow chart of a cluster switching method according to still another preferred embodiment of the present application.
  • FIG. 7 is a structural diagram of a cluster switching device according to another aspect of the present application.
  • FIG. 8 is a structural diagram of a cluster switching device according to a preferred embodiment of the present application.
  • FIG. 9 is a structural diagram of a cluster switching device according to another preferred embodiment of the present application.
  • FIG. 10 is a block diagram showing a cluster switching device according to still another preferred embodiment of the present application.
  • the terminal, the device of the service network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage,
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • the application provides a cluster switching method, including:
  • Step S1 After the old primary cluster starts to switch to the new primary cluster, synchronize the remaining original data to be synchronized on the old primary cluster to the new primary cluster, where the new primary cluster is taken from the old primary cluster.
  • the priority of the remaining original data that is synchronized is set to a low level; specifically, the time when the old primary cluster A synchronizes with the new primary cluster B is started before the old primary cluster A switches to the new primary cluster B, the old master When cluster A is synchronized to the new primary cluster B, the old The switch between the primary cluster A and the new primary cluster B is also completed.
  • the old primary cluster A to the new primary cluster B refers to the backup of the original data on the old primary cluster A to the primary cluster B, in the old After the primary cluster A switches to the new primary cluster B, the new primary cluster B provides data read and write services to the user. In addition, since the old primary cluster A synchronizes with the new primary cluster B, the cluster switching starts.
  • the original data synchronized from the old primary cluster A on the primary cluster B includes the original data synchronized from the old primary cluster A on the new primary cluster B before the start of the cluster handover, and after the cluster switching starts to the end of the cluster handover, the new The remaining raw data from the old primary cluster A on the primary cluster B, for example, the original 5000 original data on the old primary cluster A, and the original data synchronized from the old primary cluster A on the new primary cluster B.
  • the original data of the new primary cluster B synchronized from the old primary cluster A is also To include cluster switching start to cluster switching
  • the new primary cluster B needs the remaining 3000 original data synchronized from the old primary cluster A.
  • the priority of the original data synchronized from the old primary cluster A is set to a low level, such as level 0, to distinguish the new data corresponding to the subsequent write operation request, such as level 1;
  • Step S2 during the synchronization of the old primary cluster to the new primary cluster, responding to the write operation request on the new primary cluster, and setting the priority of the new data corresponding to the write operation request to the advanced level, wherein only the new one is allowed.
  • the version of the primary cluster whose priority is advanced data covers another version of the same data whose priority is low or advanced; specifically, step S1 and step S2 are performed simultaneously, and after the cluster switching starts, the new primary cluster B
  • There will be two types of data one is new data, and the other is raw data synchronized from the old primary cluster A. In order to prevent the original data from the old primary cluster A from being overwritten with new data, and to ensure new data.
  • level 1 data can cover raw data (lower level data such as level 0 data) or updated new data (same level data such as level 1 data) synchronized from the old master cluster A.
  • the setting here only allows the new master cluster B.
  • the version with the priority of the advanced data covers another version of the same data with the lower priority or the higher level.
  • the value of the corresponding value is still 200;
  • step S4 after the remaining original data to be synchronized on the old primary cluster is synchronized to the new primary cluster, the write operation request is responded to on the new primary cluster. Specifically, step S4 is performed after step S1 and step S2. After the cluster synchronization ends, since all the original data of the old primary cluster A has been synchronized to the new primary cluster B, as long as the new primary cluster B is present. It is only necessary to respond to the data write operation request, and it is no longer necessary to distinguish the priority of the data on the new primary cluster B.
  • the primary cluster of the external service can be switched without affecting the user's use, that is, the user can read and write all the data after the start of the handover to the end of the handover, without the user being prohibited from accessing, and the old Data on the new and new primary clusters can be consistent, enabling seamless migration or backup of data between clusters.
  • step S1 when step S1 is performed, the method further includes performing step S3 to synchronize remaining original data to be synchronized on the old primary cluster to the new primary cluster. During this period, read requests are responded to on the old and new primary clusters;
  • step S5 is further included, and after the remaining original data to be synchronized on the old primary cluster is synchronized to the new primary cluster, the read operation request is responded to on the new primary cluster. Specifically, before the end of the cluster synchronization, it is necessary to respond to the data read operation request during the synchronization of the old primary cluster A to the new primary cluster B on the old and new primary clusters, to avoid some primitives before the cluster synchronization ends. If the data has not been synchronized to the new primary cluster, even if the original data is not found on the new primary cluster B, the original data needed can be found on the old primary cluster, so it is necessary to be in the old one at the same time.
  • the new primary cluster responds to the data read operation request during the synchronization of the old primary cluster A to the new primary cluster B; and after the cluster synchronization ends, since all the original data of the old primary cluster has been synchronized to the new primary On the cluster, so as long as you respond to data read operations requests on the new primary cluster, you can meet the user's data needs.
  • the write operation request includes a request for adding, rewriting, and deleting data.
  • the user's write operation requests to add new data to the new primary cluster, or modify the existing data version, or the existing data. Delete to meet the user's various write operations needs.
  • step S2 when the write operation request is to add or rewrite data, step S2 is performed, and the remaining remaining on the old primary cluster is to be synchronized. While the raw data is synchronized to the new primary cluster, in response to the write operation request on the new primary cluster, it also includes:
  • Step S20 writing the new or rewriting operation request into the message queue
  • Step S21 reading a new or rewriting operation request from the message queue, and adding or rewriting the read operation
  • the read write operation request in the message queue is deleted, and the write operation in the message queue is performed here.
  • the request is used to mark the new or rewritten data on the new primary cluster B to be synchronized to the old primary cluster A, and synchronize a new or rewritten data on the new primary cluster B to the old primary cluster A every time it is completed.
  • the corresponding write operation request is deleted, thereby ensuring the consistency of the data on the old and new primary clusters, and always maintaining the data synchronization on the two clusters to meet when the new primary cluster B is switched back.
  • the needs of the old primary cluster A Those skilled in the art should understand that the description of the above message queue is only an example, and other descriptions of existing or future message queues may be applicable to the present application, and should also be included in the scope of protection of the present application. The reference is included here.
  • the new or rewritten data on the new primary cluster corresponding to the read or rewrite operation request in step S21 is synchronized to After the old primary cluster, delete the read write request described in the message queue, including:
  • Step S211 it is determined whether there is new or rewritten data corresponding to the read new or rewrite operation request on the new primary cluster, if yes, go to step S212, if not, go to step S213;
  • Step S212 synchronizing the newly added or rewritten data to the old primary cluster, and deleting the read new or rewriting operation request in the message queue; if the data synchronization fails once, the device may be continuously retried Until the new or rewritten data of the new primary cluster is successfully synchronized into the old primary cluster A;
  • the new or rewritten data is written to the new primary cluster B
  • the corresponding update is recorded in the message queue.
  • Rewriting the operation request but at this time, it is not necessary to synchronize the data that is not in the new primary cluster B to the old primary set A, and directly delete the read or new read operation request in the message queue, thereby ensuring the old Consistency with the data on the new primary cluster.
  • Those skilled in the art should be able to understand whether the description of the newly added or rewritten operation request on the new primary cluster is only an example, and whether other existing or future new clusters may appear to be read.
  • the description of the addition or rewriting operation request is applicable to the present application and is also included in the scope of the present application and is hereby incorporated by reference.
  • step S2 when the write operation request is a request for deleting data, step S2 is performed, and the remaining original to be synchronized on the old primary cluster is performed. While the data is being synchronized to the new primary cluster, in response to the write operation request on the new primary cluster, it also includes:
  • Step S30 writing the delete operation request into the message queue
  • Step S31 Read the delete operation request from the message queue, keep the corresponding data on the old and new primary clusters consistent according to the read-to-delete operation request, and delete the read delete operation request in the message queue. .
  • the write operation request in the message queue is used to mark the deleted data on the new primary cluster B to be consistent with the corresponding data on the old primary cluster A, and each deleted data on the new primary cluster B is completed.
  • the corresponding write operation request is deleted, thereby ensuring the consistency of the data on the old and new primary clusters, and always maintaining the data synchronization on the two clusters to meet the needs. Switching back from the new primary cluster B to the old primary cluster A.
  • the read delete operation in the message queue is deleted. Requests, including:
  • the deleted data corresponding to the deletion operation request does not exist on the new primary cluster but exists on the old primary cluster, delete the corresponding deleted data on the old primary cluster, and delete the read in the message queue.
  • the deletion operation request is obtained; here, since the corresponding data on the new primary cluster has been deleted, the corresponding deletion data on the old primary cluster should be correspondingly, and then the read deletion operation request in the message queue is deleted. , so that the corresponding data on the old and new primary clusters are consistent;
  • the corresponding deleted data on the new primary cluster is synchronized to the old primary cluster.
  • Delete the read delete operation request in the message queue since the data that should be deleted on the new primary cluster B is not deleted, in order to keep the old primary cluster A and the new primary cluster B consistent, After the undeleted data deletion on the new primary cluster B is synchronized to the old primary cluster A, the corresponding delete operation request in the message queue is deleted;
  • the read delete operation request in the message queue is deleted.
  • the corresponding data on the old and new primary clusters have been consistent, and the read delete operation request in the message queue is directly deleted.
  • Those skilled in the art should be able to understand that the description of the corresponding data on the old and new primary clusters described above is only an example, and other existing or new possible primary clusters may appear correspondingly on the primary cluster. A consistent description of the data, as applicable to the present application, is also intended to be included within the scope of the present disclosure and is hereby incorporated by reference.
  • the old primary cluster is The read operation requests that are responded to on the old and new primary clusters during the synchronization of the remaining raw data to be synchronized to the new primary cluster, including:
  • Step S41 determining whether the data corresponding to the read operation request is read from the old and new primary clusters
  • Step S42 if the corresponding data is read in the old or new primary cluster, the data is returned; if the corresponding data is read from one of the old or new primary clusters, Then directly return the read data to meet the user's reading needs;
  • step S43 if the corresponding data is read in both the old and new primary clusters, the corresponding data read on the new primary cluster is returned.
  • the corresponding data is read on the old or new primary cluster at the same time, since the data on the new primary cluster B is either the same as the data version on the old primary cluster A, or is older than the old one.
  • the version of the data version updated on the primary cluster A that is, the updated version of the corresponding data with the higher priority, so that the corresponding data read on the new primary cluster can be returned to the user.
  • the corresponding data is not read on the old or new primary cluster, the information that the read failure can be returned to the user.
  • a cluster switching device 100 is further provided, where the device 100 includes:
  • the synchronization device 1 is configured to synchronize the remaining original data to be synchronized on the old primary cluster to the new primary cluster after the old primary cluster starts to switch to the new primary cluster, where the new primary cluster is The priority of the remaining original data is set to a low level; specifically, the time when the old primary cluster A synchronizes with the new primary cluster B is started before the old primary cluster A switches to the new primary cluster B, and the old primary cluster A When the new primary cluster B is synchronized, the old primary cluster A is switched to the new primary cluster B.
  • the old primary cluster A to the new primary cluster B refers to the original data on the old primary cluster A.
  • the new primary cluster B Back up to the primary cluster B, after the old primary cluster A is switched to the new primary cluster B, the new primary cluster B provides data read and write services to the user, and the old primary cluster A moves to the new primary cluster.
  • B synchronization starts before the cluster switching, and the original data synchronized from the old primary cluster A on the new primary cluster B includes the original data synchronized from the old primary cluster A on the new primary cluster B before the cluster switching starts, and
  • the cluster switch ends, the new master set
  • the remaining raw data synchronized from the old primary cluster A on group B for example, the original 5000 original data on the old primary cluster A, and the original data synchronized from the old primary cluster A on the new primary cluster B includes the cluster.
  • the new primary cluster B Before the switch starts, the new primary cluster B has 2000 of the 5000 original data that has been synchronized from the old primary cluster A. Then the original data of the new primary cluster B synchronized from the old primary cluster A is also included. After the cluster switching starts and the cluster switching ends, the new primary cluster B needs the remaining 3000 original data synchronized from the old primary cluster A. Here, whether before the cluster switching starts or after the cluster switching starts, the cluster switching is started. At the end, the priority of the original data synchronized from the old primary cluster A on the new primary cluster B is set to a low level such as level 0, to be advanced with the subsequent settings. The new data corresponding to the write operation request is distinguished by level 1;
  • the synchronous write response device 2 is configured to respond to the write operation request on the new primary cluster during synchronization of the remaining original data to be synchronized on the old primary cluster to the new primary cluster, wherein the write operation request corresponds to the new
  • the priority of the data is set to advanced, and only the version of the advanced data on the new primary cluster is allowed to overwrite another version of the same data with a lower priority or higher level; specifically, the synchronization device 1 and the synchronization period are written.
  • the response device 2 is performed simultaneously.
  • the new primary cluster B After the cluster switching starts, there are two types of data on the new primary cluster B, one is new data, and the other is raw data synchronized from the old primary cluster A, in order to prevent The original data synchronized from the old primary cluster A overwrites the new data, and ensures that new data such as level 1 data can cover the original data (lower level data such as level 0 data) or new data updated from the old master cluster A ( The same level of data, such as level 1 data), the setting here only allows the new primary cluster B to have a higher priority version of the data over the other version of the same data with a lower priority or higher level, for example, new
  • the lower level cannot cover the same data advanced version, and the value of the a data on the new primary cluster still corresponds to 200;
  • the synchronous end write response device 3 is configured to respond to the write operation request on the new primary cluster after synchronizing the remaining original data to be synchronized on the old primary cluster to the new primary cluster. Specifically, the synchronous end write response device 3 is performed after the synchronization device 1 and the write response device 2 are executed during the synchronization. After the cluster synchronization ends, all the original data of the old primary cluster A are already synchronized to the new primary cluster B. Up, so as long as the data write operation request is responded to on the new primary cluster B, it is no longer necessary to distinguish the priority of the data on the new primary cluster B.
  • the primary cluster of the external service can be switched without affecting the user's use, that is, the user can read and write all the data after the start of the handover to the end of the handover, without the user being prohibited from accessing, and the old Data on the new and new primary clusters can be consistent, enabling seamless migration or backup of data between clusters.
  • the device 100 further includes a synchronization period read response device 4 for synchronizing the remaining original data to be synchronized on the old primary cluster to a new one. a read operation request responsive on the old and new primary clusters during the primary cluster;
  • the device 100 further includes a synchronization end read response device 5 for responding to the read operation request on the new primary cluster after synchronizing the remaining original data to be synchronized on the old primary cluster to the end of the new primary cluster. Specifically, before the end of the cluster synchronization, it is necessary to respond to the data read operation request during the synchronization of the old primary cluster A to the new primary cluster B on the old and new primary clusters, to avoid some primitives before the cluster synchronization ends. If the data has not been synchronized to the new primary cluster, even if the original data is not found on the new primary cluster B, the original data needed can be found on the old primary cluster, so it is necessary to be in the old one at the same time.
  • the new primary cluster responds to the data read operation request during the synchronization of the old primary cluster A to the new primary cluster B; and after the cluster synchronization ends, since all the original data of the old primary cluster has been synchronized to the new primary On the cluster, so as long as you respond to data read operations requests on the new primary cluster, you can meet the user's data needs.
  • the write operation request includes a request for adding, rewriting, and deleting data.
  • the user's write operation requests to add new data to the new primary cluster, or modify the existing data version, or the existing data. Delete to meet the user's various write operations needs.
  • the device 100 further includes a new or rewrite request message queue device 6 for when the write operation request is added to the data or
  • a new or rewrite request message queue device 6 for when the write operation request is added to the data or
  • the new or rewritten operation request is written to the message queue while responding to the write operation request on the new primary cluster. Reading the new or rewriting operation request from the message queue, and synchronizing the newly added or rewritten data on the new primary cluster corresponding to the read new or rewritten operation request to the old primary cluster. Delete the read write request described in the message queue.
  • the write operation request in the message queue is used to mark the new or rewritten data on the new primary cluster B to be synchronized to the old primary cluster A, and each time a new primary cluster B is added or After the data is rewritten to the old primary cluster A, the corresponding write operation request is deleted, thereby ensuring the consistency of the data on the old and new primary clusters, and always maintaining the data synchronization on the two clusters to satisfy the situation. There is also a need to switch back from the new primary cluster B to the old primary cluster A.
  • the new or rewrite request message queue device 6 is configured to determine whether there is a new one corresponding to the read new or rewrite operation request on the new primary cluster. Or rewrite According to the existing or rewritten data, if it exists, the newly added or rewritten operation request is deleted from the message queue, and if the data synchronization fails, the data can be continuously stopped.
  • the device 100 further includes a delete request message queue device 7 for when the write operation request is a request for deleting data, Synchronizing the remaining raw data to be synchronized on the old primary cluster to the new primary cluster, writing the delete operation request to the message queue and reading from the message queue while responding to the write operation request on the new primary cluster Deleting the operation request, and deleting the corresponding deletion data on the old and new primary clusters according to the read-to-delete operation request, deleting the read deletion operation request in the message queue.
  • a delete request message queue device 7 for when the write operation request is a request for deleting data, Synchronizing the remaining raw data to be synchronized on the old primary cluster to the new primary cluster, writing the delete operation request to the message queue and reading from the message queue while responding to the write operation request on the new primary cluster Deleting the operation request, and deleting the corresponding deletion data on the old and new primary clusters according to the read-to-delete operation request, deleting the read deletion operation request in the message queue.
  • the write operation request in the message queue is used to mark the deleted data on the new primary cluster B to be consistent with the corresponding data on the old primary cluster A, and delete data on the new primary cluster B every time the completion is completed.
  • the corresponding write operation request is deleted, thereby ensuring the consistency of the data on the old and new primary clusters, and always maintaining the data synchronization on the two clusters to meet the needs. There is a need to switch back from the new primary cluster B to the old primary cluster A.
  • the delete request message queue device 7 is configured to: if the deleted data corresponding to the read delete operation request does not exist on the old and new primary clusters, Deleting the read delete operation request in the message queue. At this time, the corresponding data on the old and new primary clusters have been consistent, and the read delete operation request in the message queue is directly deleted. If the deleted data corresponding to the delete operation request does not exist on the new primary cluster but exists on the old primary cluster, delete the corresponding deleted data on the old primary cluster, and delete the message queue. The deleted operation request is read.
  • the corresponding deleted data on the old primary cluster should be correspondingly deleted, and then the read delete operation in the message queue is deleted. Request so that the corresponding data on the old and new primary clusters are consistent; If the deleted data corresponding to the read delete operation request does not exist on the old primary cluster but exists on the new primary cluster, the corresponding deleted data on the new primary cluster is synchronized to the old primary cluster. Delete the read delete operation request in the message queue.
  • the corresponding delete operation request in the message queue is deleted; if the delete data corresponding to the delete operation request is read in the old and new If the primary cluster exists, the deleted operation request read in the message queue is deleted, where the corresponding data on the old and new primary clusters have been consistent, and the read in the message queue is directly deleted.
  • the delete operation request can be reached.
  • the synchronization period read response device 4 is configured to determine whether data corresponding to the read operation request is read from the old and new primary clusters, if If the old or new primary cluster reads the corresponding data, it returns the data.
  • the corresponding data is read from one of the old or new primary clusters, the data is directly returned.
  • the read data can be used to meet the user's reading needs; if the corresponding data is read in both the old and new primary clusters, the corresponding data read on the new primary cluster is returned.
  • the corresponding data is read on the old or new primary cluster at the same time, since the data on the new primary cluster B is either the same as the data version on the old primary cluster A, or is older than the old primary cluster.
  • the version of the data version updated on A that is, the updated version of the corresponding data with higher priority, so that the corresponding data read on the new main cluster can be returned to the user.
  • the present application responds to a write operation request on a new primary cluster during the synchronization of the old primary cluster to the new primary cluster, and sets the priority of the new data corresponding to the write operation request to a high level, wherein It is only allowed to overwrite the version of the advanced data on the new primary cluster with another version of the same data with a lower priority or higher level, and can switch the primary cluster of the external service without affecting the user's use.
  • the user can read and write all data after the start of the switch to the end of the switchover, and the data on the old and new primary clusters can be consistent, and seamless migration or backup of data between clusters can be realized.
  • the present application reads the new or rewrite operation request from the message queue by writing the new or rewrite operation request into the message queue, and the new corresponding to the read new or rewrite operation request After the new or rewritten data on the primary cluster B is synchronized to the old primary cluster A, the read write operation request in the message queue is deleted, thereby ensuring the consistency of the data on the old and new primary clusters. Always keep the data on both clusters synchronized to meet When there is a need to switch back from the new primary cluster B to the old primary cluster A.
  • the present application reads the delete operation request from the message queue by writing the delete operation request into the message queue, and keeps the corresponding data on the old and new primary clusters consistent according to the read-to-delete operation request. , delete the read delete operation request in the message queue, thereby ensuring the consistency of data on the old and new primary clusters, and always maintaining data synchronization on the two clusters to meet when there is a new primary cluster B Switch back to the old primary cluster A requirements.
  • the present invention can be implemented in software and/or a combination of software and hardware, for example, using an application specific integrated circuit (ASIC), a general purpose computer, or any other similar hardware device.
  • the software program of the present invention may be executed by a processor to implement the steps or functions described above.
  • the software program (including related data structures) of the present invention can be stored in a computer readable recording medium such as a RAM memory, a magnetic or optical drive or a floppy disk and the like.
  • some of the steps or functions of the present invention may be implemented in hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.
  • a portion of the invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide a method and/or solution in accordance with the present invention.
  • the program instructions for invoking the method of the present invention may be stored in a fixed or removable recording medium and/or transmitted by a data stream in a broadcast or other signal bearing medium, and/or stored in a The working memory of the computer device in which the program instructions are run.
  • an embodiment in accordance with the present invention includes a device including a memory for storing computer program instructions and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, triggering
  • the apparatus operates based on the aforementioned methods and/or technical solutions in accordance with various embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Hardware Redundancy (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供一种集群切换方法与设备,本申请通过在旧的主集群向新的主集群同步期间,在新的主集群上响应写操作请求,并将写操作请求对应的新数据的优先级设置为高级,其中,只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本,能够在不影响用户使用的情况下,切换对外服务的主集群,即在不需要禁止用户访问的情况下,在切换开始后至切换结束期间使用户能读写到全部数据,并且旧的和新的主集群上数据能够保证一致,实现集群间数据的无缝迁移或备份。

Description

集群切换方法与设备
本申请要求2015年07月13日递交的申请号为201510408179.9、发明名称为“集群切换方法与设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机领域,尤其涉及一种集群切换方法与设备。
背景技术
在云存储系统中,数据存储于单个集群,为了提高数据存储的安全性、提供集群级别的容灾方案,或者实现集群间的数据迁移,往往需要将数据备份到其他的集群,该过程称为集群间数据同步。当需要将用户读写访问的集群从主集群变更成从集群时,该变更过程称为切换主集群。如何保证集群间数据同步的一致性、以及保证集群切换时对用户无影响是集群间同步和切换的关键技术方案。
目前的同步技术方案一般分为集群间的异步的同步方案和同步的同步方案,分别结合不同的切换方案:
1.异步的同步方案中,使用异步模块将数据从主集群拷贝到从集群,可以保证数据一致性,但是具有一定的延时性,当需要切换对外服务的主集群时,会出现主集群上的部分数据还未同步到从集群上的情况,导致切换后,在这部分数据同步结束前,该部分数据对用户不可见,出现数据短暂丢失的情况,并且在该部分数据同步期间,用户对该部分数据的覆盖写会导致数据一致性问题,因此当需要切换之前,会停止主集群数据的写入,当主集群的数据完全同步到从集群之后,进行切换,再开放用户的写权限,从而不会影响用户访问,并且能解决数据一致性问题,但是由于延时性,切换前禁止用户写入会影响用户使用。
2.同步的同步方案中,在用户写入数据时,数据分别写入主集群和从集群,集群切换简单,当主集群和从集群同时成功时返回用户成功,但会降低用户的访问成功率,提高了用户访问延时,并且难以解决主从集群间有一份数据写失败时的数据一致性问题,对于已经存在于主集群中的数据无法实现拷贝。
发明内容
本申请的一个目的是提供一种集群切换方法与设备,能够解决集群间数据间迁移或 备份时,影响用户使用,切换集群间数据不能够保证一致的问题。
根据本申请的一个方面,提供了一种集群切换方法,该方法包括:
在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上所述剩余原始数据的优先级设置为低级;
在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求,其中,将写操作请求对应的新数据的优先级设置为高级,并只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;
在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。
进一步的,上述方法中,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,还包括:
在旧的和新的主集群上响应的读操作请求;
在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,还包括:
在新的主集群上响应读操作请求。
进一步的,上述方法中,所述写操作请求包括对数据的新增、改写和删除操作请求。
进一步的,上述方法中,当所述写操作请求为对数据的新增或改写时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
将所述新增或改写操作请求写入消息队列;
从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求。
进一步的,上述方法中,读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求,包括:
判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数据,
若存在,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的新增或改写操作请求;
若不存在,删除消息队列中所述读取到的新增或改写操作请求。
进一步的,上述方法中,当所述写操作请求为对数据的删除操作请求时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
将所述删除操作请求写入消息队列;
从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求。
进一步的,上述方法中,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求,包括:
若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求;
若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求;
若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求;
若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求。
进一步的,上述方法中,将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求,包括:
判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,
若在旧的或新的主集群读取到对应的数据,则返回该数据;
若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据。
根据本申请的另一面还提供一种集群切换设备,其中,该设备包括:
同步装置,用于在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上所述剩余原始数据的优先级设置为低级;
同步期间写响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求,其中,将写操作请求对应的新数据的优先 级设置为高级,并只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;
同步结束写响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。
进一步的,上述设备中,所述设备还包括同步期间读响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求;
所述设备还包括同步结束读响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应读操作请求。
进一步的,上述设备中,所述写操作请求包括对数据的新增、改写和删除操作请求。
进一步的,上述设备中,所述设备还包括新增或改写请求消息队列装置,用于当所述写操作请求为对数据的新增或改写时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述新增或改写操作请求写入消息队列,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求。
进一步的,上述设备中,所述新增或改写请求消息队列装置,用于判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数据,若存在,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的新增或改写操作请求;若不存在,删除消息队列中所述读取到的新增或改写操作请求。
进一步的,上述设备中,所述设备还包括删除请求消息队列装置,用于当所述写操作请求为对数据的删除操作请求时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述删除操作请求写入消息队列,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求。
进一步的,上述设备中,所述删除请求消息队列装置,用于若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而 在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求。
进一步的,上述设备中,所述同步期间读响应装置,用于判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,若在旧的或新的主集群读取到对应的数据,则返回该数据;若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据。
与现有技术相比,本申请通过在旧的主集群向新的主集群同步期间,在新的主集群上响应写操作请求,并将写操作请求对应的新数据的优先级设置为高级,其中,只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本,能够在不影响用户使用的情况下,切换对外服务的主集群,即在不需要禁止用户访问的情况下,在切换开始后至切换结束期间使用户能读写到全部数据,并且旧的和新的主集群上数据能够保证一致,实现集群间数据的无缝迁移或备份。
进一步的,本申请通过将所述新增或改写操作请求写入消息队列,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群B上的新增或改写数据同步到旧的主集群A上后,删除消息队列中所述读取到的写操作请求,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。
进一步的,本申请通过将所述删除操作请求写入消息队列,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致,删除消息队列中所述读取到的删除操作请求,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1示出根据本申请一个方面的一种集群切换方法的流程图;
图2示出根据本申请一个优选实施例的一种集群切换方法的流程图;
图3示出根据本申请另一个优选实施例的一种集群切换方法的流程图;
图4示出根据本申请又一个优选实施例的一种集群切换方法的流程图;
图5示出根据本申请再一个优选实施例的一种集群切换方法的流程图;
图6示出根据本申请又一个优选实施例的一种集群切换方法的流程图;
图7示出根据本申请另一个方面的一种集群切换设备的结构图;
图8示出根据本申请一个优选实施例的一种集群切换设备的结构图;
图9示出根据本申请另一个优选实施例的一种集群切换设备的结构图;
图10示出根据本申请又一个优选实施例的一种集群切换设备的结构图。
附图中相同或相似的附图标记代表相同或相似的部件。
具体实施方式
下面结合附图对本发明作进一步详细描述。
在本申请一个典型的配置中,终端、服务网络的设备和可信方均包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
如图1所示,本申请提供一种集群切换方法,包括:
步骤S1,在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上从旧的主集群同步来的剩余原始数据的优先级设置为低级;具体的,旧的主集群A向新的主集群B同步的时间是在旧的主集群A向新的主集群B切换之前开始,旧的主集群A向新的主集群B同步完成时,旧 的主集群A向新的主集群B切换也随之完成,这里旧的主集群A向新的主集群B是指将旧的主集群A上的原始数据备份到主集群B,以在旧的主集群A向新的主集群B切换完成后由新的主集群B对外向用户提供数据读写服务,另外,由于旧的主集群A向新的主集群B同步先于集群切换开始,新的主集群B上从旧的主集群A同步来的原始数据包括集群切换开始前,新的主集群B上从旧的主集群A同步来的原始数据,及集群切换开始后至集群切换结束,新的主集群B上从旧的主集群A同步来的剩余的原始数据,例如,旧的主集群A上原有5000条原始数据,新的主集群B上从旧的主集群A同步来的原始数据包括集群切换开始前,新的主集群B上已经从旧的主集群A同步来的5000条原始数据中的2000条,那么新的主集群B上从旧的主集群A同步来的原始数据还要包括集群切换开始后至集群切换结束,新的主集群B上需要从旧的主集群A同步来的剩余的3000条原始数据,在此,无论是集群切换开始前,还是集群切换开始后至集群切换结束,新的主集群B上从旧的主集群A同步来的原始数据的优先级都设置为低级如0级,以与后续设置为高级的写操作请求对应的新数据如1级相区分;
步骤S2,在旧的主集群向新的主集群同步期间,在新的主集群上响应写操作请求,并将写操作请求对应的新数据的优先级设置为高级,其中,只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;具体的,步骤S1和步骤S2是同时进行的,在集群切换开始后,新的主集群B上会存在两类数据,一类是新数据,另一类是从旧的主集群A同步来的原始数据,为了防止从旧的主集群A同步来的原始数据覆盖新数据,并保证新数据如1级数据能够覆盖从旧的主集群A同步来的原始数据(低级数据如0级数据)或者更新的新数据(同级数据如1级数据),这里设置只允许新的主集群B上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本,例如,新的主集群B上有一从旧的主集群上同步来的原始数据a=100,随后用户发起一个写操作请求所对应的新数据为a=200,由于a=100的数据级别为低级如0级,而a=200的数据级别为高级如1级,则高级数据覆盖同一数据低级版本,新的主集群B上a数据的值对应更新为200,如果,接着又有用户发起一个更新的写操作请求所对应的新数据为a=300,则高级覆盖同一数据之前同级版本,新的主集群上a数据的值对应更新为300;又如,在新的主集群B上用户发起一个写操作请求所对应的新数据为a=200,随后,又有一从旧的主集群A上同步来的原始数据a=100,由于a=100的数据级别为低级如0级,而a=200的数据级别为高级如1级,则低级不能覆盖同一数据高级版本,新的主集群上a数据的值对应仍为200;
步骤S4,在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。具体的,步骤S4是在步骤S1和步骤S2之后进行,在集群同步结束后,由于旧的主集群A的所有原始数据已经都同步到新的主集群B上,所以只要在新的主集群B上响应数据写操作请求即可,也不再需要区分新的主集群B上数据的优先级。本实施例能够在不影响用户使用的情况下,切换对外服务的主集群,即在不需要禁止用户访问的情况下,在切换开始后至切换结束期间使用户能读写到全部数据,并且旧的和新的主集群上数据能够保证一致,实现集群间数据的无缝迁移或备份。
如图2所示,本申请的集群切换方法一优选的实施例中,执行步骤S1的同时,还包括执行步骤S3,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求;
步骤S3之后,在执行步骤S4的同时,还包括执行步骤S5,在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应读操作请求。具体的,在集群同步结束前,需要在旧的和新的主集群上响应在旧的主集群A向新的主集群B同步期间的数据读操作请求,以避免集群同步结束前,在有些原始数据还没有同步到新的主集群的情况下,即使没有在新的主集群B上找到需要的原始数据,还可以在旧的主集群上找到需要的原始数据,所以这时需要同时在旧的和新的主集群上响应在旧的主集群A向新的主集群B同步期间的数据读操作请求;而在集群同步结束后,由于旧的主集群的所有原始数据已经都同步到新的主集群上,所以只要在新的主集群上响应数据读操作请求即可,都可以满足用户的数据需求。
本申请的集群切换方法一优选的实施例中,所述写操作请求包括对数据的新增、改写和删除操作请求。具体的,旧的主集群向新的主集群切换开始后,用户的写操作请求在新的主集群上新增其没有的数据,或者对已有的数据版本的修改,或者对已有数据的删除,从而满足用户的各种写操作需求。本领域技术人员应能理解上述写操作请求的描述仅为举例,其他现有的或今后可能出现的写操作请求的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图3所示,本申请的集群切换方法一优选的实施例中,当所述写操作请求为对数据的新增或改写时,执行步骤S2,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
步骤S20,将所述新增或改写操作请求写入消息队列;
步骤S21,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操 作请求所对应的新的主集群B上的新增或改写数据同步到旧的主集群A上后,删除消息队列中所述读取到的写操作请求,在此,消息队列中的写操作请求用于标注新的主集群B上待同步到旧的主集群A上的新增或改写数据,在每完成将新的主集群B上的一个新增或改写数据同步到旧的主集群A上之后,则将对应的一个写操作请求删除,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。本领域技术人员应能理解上述消息队列的描述仅为举例,其他现有的或今后可能出现的消息队列的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图4所示,本申请的集群切换方法一优选的实施例中,步骤S21中的将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求,包括:
步骤S211,判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数据,若存在,转到步骤S212,若不存在,转到步骤S213;
步骤S212,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的新增或改写操作请求;在此,如果一次数据同步失败,可以不停地重试,直到新的主集群的新增或改写数据被成功同步入旧的主集群A为止;
步骤S213,删除消息队列中所述读取到的新增或改写操作请求,在此,当新增或改写数据写入新的主集群B失败时,虽然消息队列里记录有对应的新增或改写操作请求,但此时不需要同步新的主集群B中没有的数据到旧的主集A,直接将消息队列中所述读取到的新增或改写操作请求删除即可,从而保证旧的和新的主集群上数据的一致性。本领域技术人员应能理解上述新的主集群上是否存在读取到的新增或改写操作请求的描述仅为举例,其他现有的或今后可能出现的新的主集群上是否存在读取到的新增或改写操作请求的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图5所示,本申请的集群切换方法一优选的实施例中,当所述写操作请求为对数据的删除操作请求时,执行步骤S2,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
步骤S30,将所述删除操作请求写入消息队列;
步骤S31,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致,删除消息队列中所述读取到的删除操作请求。在 此,消息队列中的写操作请求用于标注新的主集群B上待与旧的主集群A上的对应数据保持一致的删除数据,在每完成将新的主集群B上的一个删除数据与旧的主集群A上数据一致之后,则将对应的一个写操作请求删除,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。本领域技术人员应能理解上述消息队列的描述仅为举例,其他现有的或今后可能出现的消息队列的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
本申请的集群切换方法一优选的实施例中,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求,包括:
若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求;此时,所述旧的和新的主集群上的对应数据已经保持一致,直接删除消息队列中所述读取到的删除操作请求即可;
若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求;在此,由于新的主集群上的对应数据已经删除,则应对应将旧的主集群上对应的删除数据,然后删除消息队列中所述读取到的删除操作请求,从而使所述旧的和新的主集群上的对应数据保持一致;
若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求;在此,由于新的主集群B上应该删除的数据没有删除,为了使旧的主集群A与新的主集群B始终保持一致,可以将新的主集群B上该未删除的数据删除同步到旧的主集群A后,再删除消息队列中对应的删除操作请求;
若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求。在此,所述旧的和新的主集群上的对应数据已经保持一致,直接删除消息队列中所述读取到的删除操作请求即可。本领域技术人员应能理解上述所述旧的和新的主集群上的对应数据保持一致的描述仅为举例,其他现有的或今后可能出现的所述旧的和新的主集群上的对应数据保持一致的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图6所示,本申请的集群切换方法一优选的实施例中,步骤S3,在将旧的主集群 上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求,包括:
步骤S41,判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,
步骤S42,若在旧的或新的主集群读取到对应的数据,则返回该数据;在此,若从旧的或新的主集群中的其中一个主集群上读取到对应的数据,则直接向返回该读取到的数据即可,以满足用户的读取需求;
步骤S43,若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据。在此,若同时在旧的或新的主集群上都读取到对应的数据,由于新的主集群B上的数据要么是跟旧的主集群A上的数据版本一致,要么是比旧的主集群A上的数据版本更新的版本,即替换后的优先级更高的对应数据的更新版本,所以向用户返回新的主集群上读取到的对应的数据即可。另外,如果在旧的或新的主集群上都未读取到对应的数据,则可以向用户返回读取失败的信息。
如图7所示,根据本申请的另一面,还提供一种集群切换设备100,其中,该设备100包括:
同步装置1,用于在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上所述剩余原始数据的优先级设置为低级;具体的,旧的主集群A向新的主集群B同步的时间是在旧的主集群A向新的主集群B切换之前开始,旧的主集群A向新的主集群B同步完成时,旧的主集群A向新的主集群B切换也随之完成,这里旧的主集群A向新的主集群B是指将旧的主集群A上的原始数据备份到主集群B,以在旧的主集群A向新的主集群B切换完成后由新的主集群B对外向用户提供数据读写服务,另外,由于旧的主集群A向新的主集群B同步先于集群切换开始,新的主集群B上从旧的主集群A同步来的原始数据包括集群切换开始前,新的主集群B上从旧的主集群A同步来的原始数据,及集群切换开始后至集群切换结束,新的主集群B上从旧的主集群A同步来的剩余的原始数据,例如,旧的主集群A上原有5000条原始数据,新的主集群B上从旧的主集群A同步来的原始数据包括集群切换开始前,新的主集群B上已经从旧的主集群A同步来的5000条原始数据中的2000条,那么新的主集群B上从旧的主集群A同步来的原始数据还要包括集群切换开始后至集群切换结束,新的主集群B上需要从旧的主集群A同步来的剩余的3000条原始数据,在此,无论是集群切换开始前,还是集群切换开始后至集群切换结束,新的主集群B上从旧的主集群A同步来的原始数据的优先级都设置为低级如0级,以与后续设置为高级 的写操作请求对应的新数据如1级相区分;
同步期间写响应装置2,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求,其中,将写操作请求对应的新数据的优先级设置为高级,并只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;具体的,同步装置1和同步期间写响应装置2是同时进行的,在集群切换开始后,新的主集群B上会存在两类数据,一类是新数据,另一类是从旧的主集群A同步来的原始数据,为了防止从旧的主集群A同步来的原始数据覆盖新数据,并保证新数据如1级数据能够覆盖从旧的主集群A同步来的原始数据(低级数据如0级数据)或者更新的新数据(同级数据如1级数据),这里设置只允许新的主集群B上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本,例如,新的主集群B上有一从旧的主集群上同步来的原始数据a=100,随后用户发起一个写操作请求所对应的新数据为a=200,由于a=100的数据级别为低级如0级,而a=200的数据级别为高级如1级,则高级数据覆盖同一数据低级版本,新的主集群B上a数据的值对应更新为200,如果,接着又有用户发起一个更新的写操作请求所对应的新数据为a=300,则高级覆盖同一数据之前同级版本,新的主集群上a数据的值对应更新为300;又如,在新的主集群B上用户发起一个写操作请求所对应的新数据为a=200,随后,又有一从旧的主集群A上同步来的原始数据a=100,由于a=100的数据级别为低级如0级,而a=200的数据级别为高级如1级,则低级不能覆盖同一数据高级版本,新的主集群上a数据的值对应仍为200;
同步结束写响应装置3,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。具体的,同步结束写响应装置3是在同步装置1和同步期间写响应装置2执行之后进行,在集群同步结束后,由于旧的主集群A的所有原始数据已经都同步到新的主集群B上,所以只要在新的主集群B上响应数据写操作请求即可,也不再需要区分新的主集群B上数据的优先级。本实施例能够在不影响用户使用的情况下,切换对外服务的主集群,即在不需要禁止用户访问的情况下,在切换开始后至切换结束期间使用户能读写到全部数据,并且旧的和新的主集群上数据能够保证一致,实现集群间数据的无缝迁移或备份。
如图8所示,本申请的集群切换设备一优选的实施例中,所述设备100还包括同步期间读响应装置4,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求;
所述设备100还包括同步结束读响应装置5,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应读操作请求。具体的,在集群同步结束前,需要在旧的和新的主集群上响应在旧的主集群A向新的主集群B同步期间的数据读操作请求,以避免集群同步结束前,在有些原始数据还没有同步到新的主集群的情况下,即使没有在新的主集群B上找到需要的原始数据,还可以在旧的主集群上找到需要的原始数据,所以这时需要同时在旧的和新的主集群上响应在旧的主集群A向新的主集群B同步期间的数据读操作请求;而在集群同步结束后,由于旧的主集群的所有原始数据已经都同步到新的主集群上,所以只要在新的主集群上响应数据读操作请求即可,都可以满足用户的数据需求。
本申请的集群切换设备一优选的实施例中,所述写操作请求包括对数据的新增、改写和删除操作请求。具体的,旧的主集群向新的主集群切换开始后,用户的写操作请求在新的主集群上新增其没有的数据,或者对已有的数据版本的修改,或者对已有数据的删除,从而满足用户的各种写操作需求。本领域技术人员应能理解上述写操作请求的描述仅为举例,其他现有的或今后可能出现的写操作请求的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图9所示,本申请的集群切换设备一优选的实施例中,所述设备100还包括新增或改写请求消息队列装置6,用于当所述写操作请求为对数据的新增或改写时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述新增或改写操作请求写入消息队列,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求。在此,消息队列中的写操作请求用于标注新的主集群B上待同步到旧的主集群A上的新增或改写数据,在每完成将新的主集群B上的一个新增或改写数据同步到旧的主集群A上之后,则将对应的一个写操作请求删除,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。本领域技术人员应能理解上述消息队列的描述仅为举例,其他现有的或今后可能出现的消息队列的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
本申请的集群切换设备一优选的实施例中,所述新增或改写请求消息队列装置6,用于判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数 据,若存在,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的新增或改写操作请求,在此,如果一次数据同步失败,可以不停地重试,直到新的主集群的新增或改写数据被成功同步入旧的主集群A为止;若不存在,删除消息队列中所述读取到的新增或改写操作请求,在此,当新增或改写数据写入新的主集群B失败时,虽然消息队列里记录有对应的新增或改写操作请求,但此时不需要同步新的主集群B中没有的数据到旧的主集A,直接将消息队列中所述读取到的新增或改写操作请求删除即可,从而保证旧的和新的主集群上数据的一致性。本领域技术人员应能理解上述新的主集群上是否存在读取到的新增或改写操作请求的描述仅为举例,其他现有的或今后可能出现的新的主集群上是否存在读取到的新增或改写操作请求的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
如图10所示,本申请的集群切换设备一优选的实施例中,所述设备100还包括删除请求消息队列装置7,用于当所述写操作请求为对数据的删除操作请求时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述删除操作请求写入消息队列,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求。在此,消息队列中的写操作请求用于标注新的主集群B上待与旧的主集群A上的对应数据保持一致的删除数据,在每完成将新的主集群B上的一个删除数据与旧的主集群A上数据一致之后,则将对应的一个写操作请求删除,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。本领域技术人员应能理解上述消息队列的描述仅为举例,其他现有的或今后可能出现的消息队列的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
本申请的集群切换设备一优选的实施例中,所述删除请求消息队列装置7,用于若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求,此时,所述旧的和新的主集群上的对应数据已经保持一致,直接删除消息队列中所述读取到的删除操作请求即可;若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求,在此,由于新的主集群上的对应数据已经删除,则应对应将旧的主集群上对应的删除数据,然后删除消息队列中所述读取到的删除操作请求,从而使所述旧的和新的主集群上的对应数据保持一致; 若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求,在此,由于新的主集群B上应该删除的数据没有删除,为了使旧的主集群A与新的主集群B始终保持一致,可以将新的主集群B上该未删除的数据删除同步到旧的主集群A后,再删除消息队列中对应的删除操作请求;若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求,在此,所述旧的和新的主集群上的对应数据已经保持一致,直接删除消息队列中所述读取到的删除操作请求即可。本领域技术人员应能理解上述所述旧的和新的主集群上的对应数据保持一致的描述仅为举例,其他现有的或今后可能出现的所述旧的和新的主集群上的对应数据保持一致的描述如可适用于本申请,也应包含在本申请保护范围以内,并在此以引用方式包含于此。
本申请的集群切换设备一优选的实施例中,所述同步期间读响应装置4,用于判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,若在旧的或新的主集群读取到对应的数据,则返回该数据,在此,若从旧的或新的主集群中的其中一个主集群上读取到对应的数据,则直接向返回该读取到的数据即可,以满足用户的读取需求;若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据,在此,若同时在旧的或新的主集群上都读取到对应的数据,由于新的主集群B上的数据要么是跟旧的主集群A上的数据版本一致,要么是比旧的主集群A上的数据版本更新的版本,即替换后的优先级更高的对应数据的更新版本,所以向用户返回新的主集群上读取到的对应的数据即可。
综上所述,本申请通过在旧的主集群向新的主集群同步期间,在新的主集群上响应写操作请求,并将写操作请求对应的新数据的优先级设置为高级,其中,只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本,能够在不影响用户使用的情况下,切换对外服务的主集群,即在不需要禁止用户访问的情况下,在切换开始后至切换结束期间使用户能读写到全部数据,并且旧的和新的主集群上数据能够保证一致,实现集群间数据的无缝迁移或备份。
进一步的,本申请通过将所述新增或改写操作请求写入消息队列,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群B上的新增或改写数据同步到旧的主集群A上后,删除消息队列中所述读取到的写操作请求,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足 当又有从新的主集群B切换回旧的主集群A的需求。
进一步的,本申请通过将所述删除操作请求写入消息队列,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致,删除消息队列中所述读取到的删除操作请求,从而保证旧的和新的主集群上数据的一致性,始终保持两个集群上的数据同步,以满足当又有从新的主集群B切换回旧的主集群A的需求。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。
需要注意的是,本发明可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。在一个实施例中,本发明的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本发明的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本发明的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个步骤或功能的电路。
另外,本发明的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本发明的方法和/或技术方案。而调用本发明的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本发明的一个实施例包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本发明的多个实施例的方法和/或技术方案。
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。装置权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一, 第二等词语用来表示名称,而并不表示任何特定的顺序。

Claims (16)

  1. 一种集群切换方法,其中,该方法包括:
    在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上所述剩余原始数据的优先级设置为低级;
    在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求,其中,将写操作请求对应的新数据的优先级设置为高级,并只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;
    在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。
  2. 如权利要求1所述的方法,其中,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,还包括:
    在旧的和新的主集群上响应的读操作请求;
    在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,还包括:
    在新的主集群上响应读操作请求。
  3. 如权利要求1或2所述的方法,其中,所述写操作请求包括对数据的新增、改写和删除操作请求。
  4. 如权利要求3所述的方法,其中,当所述写操作请求为对数据的新增或改写时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
    将所述新增或改写操作请求写入消息队列;
    从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求。
  5. 如权利要求4所述的方法,其中,读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求,包括:
    判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数据,
    若存在,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的 新增或改写操作请求;
    若不存在,删除消息队列中所述读取到的新增或改写操作请求。
  6. 如权利要求3所述的方法,其中,当所述写操作请求为对数据的删除操作请求时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,还包括:
    将所述删除操作请求写入消息队列;
    从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求。
  7. 如权利要求6所述的方法,其中,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求,包括:
    若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求;
    若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求;
    若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求;
    若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求。
  8. 如权利要求2至7任一项所述的方法,其中,将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求,包括:
    判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,
    若在旧的或新的主集群读取到对应的数据,则返回该数据;
    若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据。
  9. 一种集群切换设备,其中,该设备包括:
    同步装置,用于在旧的主集群向新的主集群切换开始后,将旧的主集群上待同步的剩余原始数据同步到新的主集群上,其中,将新的主集群上所述剩余原始数据的优先级设置为低级;
    同步期间写响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求,其中,将写操作请求对应的新数据的优先级设置为高级,并只允许在新的主集群上优先级为高级的数据的版本覆盖优先级为低级或高级的同一数据的另一版本;
    同步结束写响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应写操作请求。
  10. 如权利要求9所述的设备,其中,所述设备还包括同步期间读响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在旧的和新的主集群上响应的读操作请求;
    所述设备还包括同步结束读响应装置,用于在将旧的主集群上待同步的剩余原始数据同步到新的主集群结束后,在新的主集群上响应读操作请求。
  11. 如权利要求9或10所述的设备,其中,所述写操作请求包括对数据的新增、改写和删除操作请求。
  12. 如权利要求11所述的设备,其中,所述设备还包括新增或改写请求消息队列装置,用于当所述写操作请求为对数据的新增或改写时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述新增或改写操作请求写入消息队列,从所述消息队列中读取新增或改写操作请求,将读取到的新增或改写操作请求所对应的新的主集群上的新增或改写数据同步到旧的主集群上后,删除消息队列中所述读取到的写操作请求。
  13. 如权利要求12所述的设备,其中,所述新增或改写请求消息队列装置,用于判断新的主集群上是否存在读取到的新增或改写操作请求所对应的新增或改写数据,若存在,将该新增或改写数据同步到旧的主集群上,删除消息队列中所述读取到的新增或改写操作请求;若不存在,删除消息队列中所述读取到的新增或改写操作请求。
  14. 如权利要求11所述的设备,其中,所述设备还包括删除请求消息队列装置,用于当所述写操作请求为对数据的删除操作请求时,在将旧的主集群上待同步的剩余原始数据同步到新的主集群期间,在新的主集群上响应写操作请求的同时,将所述删除操作请求写入消息队列,从消息队列中读取删除操作请求,根据读取到删除操作请求使所述旧的和新的主集群上的对应数据保持一致后,删除消息队列中所述读取到的删除操作请求。
  15. 如权利要求14所述的设备,其中,所述删除请求消息队列装置,用于若读取到 删除操作请求所对应的删除数据在旧的和新的主集群上都不存在,则删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在新的主集群上不存在,而在旧的主集群上存在,则删除旧的主集群上对应的删除数据后,删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在旧的主集群上不存在,而在新的主集群上存在,则将新的主集群上对应的删除数据同步到旧的主集群上后,删除消息队列中所述读取到的删除操作请求;若读取到删除操作请求所对应的删除数据在旧的和新的主集群上都存在,则删除消息队列中所述读取到的删除操作请求。
  16. 如权利要求10至15任一项所述的设备,其中,所述同步期间读响应装置,用于判断是否从旧的和新的主集群上读取到所述读操作请求所对应的数据,若在旧的或新的主集群读取到对应的数据,则返回该数据;若在旧的和新的主集群都读取到对应的数据,则返回新的主集群上读取到的对应的数据。
PCT/CN2016/088300 2015-07-13 2016-07-04 集群切换方法与设备 WO2017008648A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/870,572 US10609141B2 (en) 2015-07-13 2018-01-12 Methods and apparatuses for cluster switching

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510408179.9A CN106357703B (zh) 2015-07-13 2015-07-13 集群切换方法与设备
CN201510408179.9 2015-07-13

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/870,572 Continuation US10609141B2 (en) 2015-07-13 2018-01-12 Methods and apparatuses for cluster switching

Publications (1)

Publication Number Publication Date
WO2017008648A1 true WO2017008648A1 (zh) 2017-01-19

Family

ID=57756825

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/088300 WO2017008648A1 (zh) 2015-07-13 2016-07-04 集群切换方法与设备

Country Status (3)

Country Link
US (1) US10609141B2 (zh)
CN (1) CN106357703B (zh)
WO (1) WO2017008648A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10609141B2 (en) 2015-07-13 2020-03-31 Alibaba Group Holding Limited Methods and apparatuses for cluster switching

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109358812A (zh) * 2018-10-09 2019-02-19 郑州云海信息技术有限公司 一种集群系统中io请求的处理方法、装置及相关设备
CN109840166B (zh) * 2019-01-14 2021-03-30 京东数字科技控股有限公司 一种跨集群对象存储异步备份方法、装置和系统
US11782623B2 (en) * 2020-12-15 2023-10-10 International Business Machines Corporation Transferring an operating image into a multi-tenant environment
CN113282391B (zh) * 2021-05-21 2023-09-26 北京京东振世信息技术有限公司 集群切换方法、集群切换装置、电子设备及可读存储介质
CN113590040B (zh) * 2021-07-29 2024-03-19 郑州阿帕斯数云信息科技有限公司 数据处理方法、装置、设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227315A (zh) * 2007-01-17 2008-07-23 上海市医疗保险信息中心 动态服务器集群及其控制方法
CN101557320A (zh) * 2009-05-25 2009-10-14 杭州华三通信技术有限公司 容灾的实现方法及其通信设备
WO2013153259A1 (en) * 2012-04-12 2013-10-17 Nokia Corporation Method and apparatus for facilitating switching between devices
US20140214772A1 (en) * 2013-01-28 2014-07-31 Netapp, Inc. Coalescing Metadata for Mirroring to a Remote Storage Node in a Cluster Storage System
CN104461774A (zh) * 2014-11-24 2015-03-25 华为技术有限公司 异步复制方法、装置与系统

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8949395B2 (en) * 2004-06-01 2015-02-03 Inmage Systems, Inc. Systems and methods of event driven recovery management
CN1756108A (zh) * 2004-09-29 2006-04-05 华为技术有限公司 主备系统数据同步方法
CN101237585A (zh) * 2007-01-30 2008-08-06 展讯通信(上海)有限公司 一种文本交互显示的方法
KR101496412B1 (ko) * 2008-09-19 2015-02-27 삼성전자주식회사 광대역 무선통신 시스템에서 방송메시지를 동기화하기 위한방법 및 장치
US9189167B2 (en) * 2012-05-31 2015-11-17 Commvault Systems, Inc. Shared library in a data storage system
US9268797B2 (en) * 2012-12-21 2016-02-23 Zetta Inc. Systems and methods for on-line backup and disaster recovery
US9170928B1 (en) * 2013-12-31 2015-10-27 Symantec Corporation I/O scheduling and load balancing across the multiple nodes of a clustered environment
CN106357703B (zh) 2015-07-13 2020-03-10 阿里巴巴集团控股有限公司 集群切换方法与设备
US10503427B2 (en) * 2017-03-10 2019-12-10 Pure Storage, Inc. Synchronously replicating datasets and other managed objects to cloud-based storage systems

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227315A (zh) * 2007-01-17 2008-07-23 上海市医疗保险信息中心 动态服务器集群及其控制方法
CN101557320A (zh) * 2009-05-25 2009-10-14 杭州华三通信技术有限公司 容灾的实现方法及其通信设备
WO2013153259A1 (en) * 2012-04-12 2013-10-17 Nokia Corporation Method and apparatus for facilitating switching between devices
US20140214772A1 (en) * 2013-01-28 2014-07-31 Netapp, Inc. Coalescing Metadata for Mirroring to a Remote Storage Node in a Cluster Storage System
CN104461774A (zh) * 2014-11-24 2015-03-25 华为技术有限公司 异步复制方法、装置与系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10609141B2 (en) 2015-07-13 2020-03-31 Alibaba Group Holding Limited Methods and apparatuses for cluster switching

Also Published As

Publication number Publication date
US10609141B2 (en) 2020-03-31
US20180139280A1 (en) 2018-05-17
CN106357703A (zh) 2017-01-25
CN106357703B (zh) 2020-03-10

Similar Documents

Publication Publication Date Title
WO2017008648A1 (zh) 集群切换方法与设备
US8850143B1 (en) Point in time access in a replication environment with LUN resizing
US10678663B1 (en) Synchronizing storage devices outside of disabled write windows
EP2821925B1 (en) Distributed data processing method and apparatus
US11947429B2 (en) Data disaster recovery method and site
CN109032507B (zh) 一种生成源卷存储快照的方法、系统及相关组件
WO2018058944A1 (zh) 一种删除级联快照的方法及装置
US20130262388A1 (en) Database backup to highest-used page
WO2019061352A1 (zh) 数据加载方法及装置
WO2015054897A1 (zh) 数据存储方法、数据存储装置和存储设备
JP6455898B2 (ja) データ複製の方法、一次データストレージコントローラ、装置、システム、及びプログラム
US10620871B1 (en) Storage scheme for a distributed storage system
JP2006268139A (ja) データ複製装置、方法及びプログラム並びに記憶システム
CN107621994B (zh) 一种数据快照创建的方法及装置
US11514002B2 (en) Indexing splitter for any pit replication
CN106326030B (zh) 用于存储系统中的软切换的方法和装置
US20130262804A1 (en) Data duplication system, data duplication method, and program thereof
US11188522B2 (en) Streamlined database commit for synchronized nodes
US10809939B2 (en) Disk synchronization
US10976952B2 (en) System and method for orchestrated application protection
CN117203607A (zh) 集群文件系统中的直接读取
CN111858175A (zh) 一种基于移动存储装置备份云平台数据的方法与设备
JP2007141183A (ja) 記憶制御装置及び記憶制御方法
US20200225864A1 (en) Multi Cloud Asynchronous Active/Active Transactional Storage for Availability
US9886354B1 (en) Handling aborts of backup operations

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: 16823795

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16823795

Country of ref document: EP

Kind code of ref document: A1