CN110958171A - Data synchronization method and system based on main and standby equipment - Google Patents

Data synchronization method and system based on main and standby equipment Download PDF

Info

Publication number
CN110958171A
CN110958171A CN201911205067.8A CN201911205067A CN110958171A CN 110958171 A CN110958171 A CN 110958171A CN 201911205067 A CN201911205067 A CN 201911205067A CN 110958171 A CN110958171 A CN 110958171A
Authority
CN
China
Prior art keywords
data
check
check value
standby
data group
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.)
Withdrawn
Application number
CN201911205067.8A
Other languages
Chinese (zh)
Inventor
韦健
丁奕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Centec Networks Suzhou Co Ltd
Original Assignee
Centec Networks Suzhou Co Ltd
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 Centec Networks Suzhou Co Ltd filed Critical Centec Networks Suzhou Co Ltd
Priority to CN201911205067.8A priority Critical patent/CN110958171A/en
Publication of CN110958171A publication Critical patent/CN110958171A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • H04L12/467Arrangements for supporting untagged frames, e.g. port-based VLANs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/22Arrangements for detecting or preventing errors in the information received using redundant apparatus to increase reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Power Engineering (AREA)
  • Hardware Redundancy (AREA)

Abstract

The invention discloses a data synchronization method and a system based on main and standby equipment, wherein the method comprises the following steps: s1, carrying out check calculation on the corresponding first data group and second data group in the main equipment and the standby equipment to obtain a first check value and a second check value; s2, judging whether the first check value and the second check value are the same; and S3, if the data are different, updating the second data group in the standby equipment to the first data group in the main equipment, and if the data are the same, keeping the second data group in the standby equipment unchanged. The invention only needs to synchronize the data with different check values between the main device and the standby device, thereby greatly improving the performance of data check, accelerating the switching efficiency of the main device and the standby device and reducing the load of a CPU.

Description

Data synchronization method and system based on main and standby equipment
Technical Field
The invention belongs to the technical field of data transmission, and particularly relates to a data synchronization method and system based on main and standby equipment.
Background
After the main device and the standby device are switched in the stacking environment, the new main device needs to send own data to other standby devices, and the data consistency of the whole stacking system after the main device and the standby device are switched is ensured, so that the forwarding behavior of the whole system is ensured to be consistent.
The data synchronization method in the prior art specifically comprises the following steps: and the data of the main equipment is all sent to the standby equipment for comparison, and the standby equipment ensures the data consistency with the main equipment by adding, deleting and modifying the local data.
In the prior art, in the data synchronization process, if the data volume of the main device is large, a large amount of data needs to be synchronized to the standby device, which not only affects the performance, but also increases the burden of the CPU.
Therefore, in order to solve the above technical problems, it is necessary to provide a data synchronization method and system based on a host/standby device.
Disclosure of Invention
In view of this, the present invention provides a method and a system for data synchronization based on a host/standby device.
In order to achieve the above object, an embodiment of the present invention provides the following technical solutions:
a data synchronization method based on a main device and a standby device, the method comprising:
s1, carrying out check calculation on the corresponding first data group and second data group in the main equipment and the standby equipment to obtain a first check value and a second check value;
s2, judging whether the first check value and the second check value are the same;
and S3, if the data are different, updating the second data group in the standby equipment to the first data group in the main equipment, and if the data are the same, keeping the second data group in the standby equipment unchanged.
In an embodiment, before the step S1, the method further includes:
and dividing the data in the main equipment and the standby equipment into a plurality of first data groups and a plurality of second data groups respectively.
In one embodiment, the data amount of the different first data sets is the same, and the data amount of the different second data sets is the same.
In an embodiment, the first data group includes a first MAC address, a first vlan port and a first port, and the second data group includes a second MAC address, a second vlan port and a second port.
In an embodiment, the check calculation in step S1 is implemented by parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, and MD5 check.
The technical scheme provided by another embodiment of the invention is as follows:
a data synchronization system based on a host device and a standby device, the system comprising:
the device comprises a check value acquisition unit, a check calculation unit and a check calculation unit, wherein the check value acquisition unit is used for carrying out check calculation on a first data group and a second data group corresponding to the main equipment and the standby equipment to obtain a first check value and a second check value;
a check value judgment unit for judging whether the first check value and the second check value are the same;
and the data updating module is used for updating the second data group in the standby equipment to the first data group in the main equipment when the first check value is different from the second check value.
In one embodiment, the system further comprises:
and the data processing unit is used for dividing the data in the main equipment and the standby equipment into a plurality of first data groups and a plurality of second data groups respectively.
In one embodiment, the data amount of the different first data sets is the same, and the data amount of the different second data sets is the same.
In an embodiment, the first data group includes a first MAC address, a first vlan port and a first port, and the second data group includes a second MAC address, a second vlan port and a second port.
In an embodiment, the check value obtaining unit obtains the first check value and the second check value through parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, and MD5 check.
The invention has the following beneficial effects:
the invention only needs to synchronize the data with different check values between the main device and the standby device, thereby greatly improving the performance of data check, accelerating the switching efficiency of the main device and the standby device and reducing the load of a CPU.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flow chart of a data synchronization method based on a master device and a slave device in the present invention;
FIG. 2 is a schematic block diagram of a data synchronization system based on a host/standby device according to the present invention;
FIGS. 3 a-3 c are schematic diagrams illustrating data synchronization stages according to an embodiment of the invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, the present invention discloses a data synchronization method based on a master device and a slave device, including:
s1, carrying out check calculation on the corresponding first data group and second data group in the main equipment and the standby equipment to obtain a first check value and a second check value;
s2, judging whether the first check value and the second check value are the same;
and S3, if the data are different, updating the second data group in the standby equipment to the first data group in the main equipment, and if the data are the same, keeping the second data group in the standby equipment unchanged.
Preferably, step S1 is preceded by:
dividing data in the main equipment and the standby equipment into a plurality of first data groups and a plurality of second data groups respectively; the data volume of different first data groups is the same, and the data volume of different second data groups is the same.
Preferably, the first data group includes a first MAC address, a first vlan port and a first port, and the second data group includes a second MAC address, a second vlan port and a second port.
The check calculation in step S1 is implemented by algorithms such as parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, MD5 check, and the like.
Referring to fig. 2, the present invention also discloses a data synchronization system based on the main/standby device, including:
the device comprises a check value acquisition unit, a check calculation unit and a check calculation unit, wherein the check value acquisition unit is used for carrying out check calculation on a first data group and a second data group corresponding to the main equipment and the standby equipment to obtain a first check value and a second check value;
a check value judgment unit for judging whether the first check value and the second check value are the same;
and the data updating module is used for updating the second data group in the standby equipment to the first data group in the main equipment when the first check value is different from the second check value.
The main device can calculate all (or part) data according to a certain check algorithm so as to obtain a first check value with a certain length, the main device only sends the value to the standby device, the standby device compares a second check value obtained by the same check algorithm after receiving the second check value, if the data are the same, the data are determined to be consistent, and if the data are not the same, the data are determined to be inconsistent, and the complete data need to be retransmitted for comparison and updating.
The present invention is further illustrated by the following specific examples.
Referring to fig. 1 and fig. 3a to 3c, a data synchronization method based on a master device and a slave device in an embodiment of the present invention includes the following steps:
1. firstly, data in the main equipment and the standby equipment are divided into a plurality of first data groups and a plurality of second data groups respectively.
The first data group comprises a first MAC address, a first vlan port and a first port, the second data group comprises a second MAC address, a second vlan port and a second port, the data volume of different first data groups is the same, and the data volume of different second data groups is the same.
For example, in this embodiment, each of the first data group and the second data group includes 4 groups of MAC addresses, vlan ports, and port data, in other embodiments, the first data group and the second data group may further include other parameters of the main/standby device, and the data amount is not limited to 4 groups.
2. And carrying out check calculation on the corresponding first data group and second data group in the main equipment and the standby equipment to obtain a first check value and a second check value.
The check calculation may be implemented by algorithms such as parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, MD5 check, and the like, which are algorithms commonly used in the prior art and are not described herein again.
Referring to fig. 3a, in this embodiment, a cyclic redundancy check algorithm is taken as an example for explanation, three groups of first check values are obtained after check calculation of three first data groups in the master device, which are 123456, 345622, and 675433, respectively, and three groups of second check values are obtained after check calculation of three second data groups in the slave device, which are 123456, 456230, and 675433, respectively.
3. And judging whether the first check value and the second check value are the same.
After judgment, the first and third first check values are the same as the first and third second check values, and the second first check value is different from the second check value.
4. And if the data is the same, maintaining the second data group in the standby equipment unchanged.
In this embodiment, if the first and third first check values are the same as the first and third second check values, it is determined that the data in the first and third first data sets are the same as the data in the first and third second data sets; if the second first check value is different from the second check value, it is determined that the data in the second first data group is different from the data in the second data group, where the second first data group is data that failed in transmission check, as shown in fig. 3 b.
And then all data in the second first data group in the main equipment are synchronized in the standby equipment, and the second data group in the standby equipment is replaced, so that the consistency of the data in the main equipment and the data in the standby equipment can be realized.
As shown in fig. 3c, it is found through comparison that only one MAC address (5.5.5) in the first data group is different from one MAC address (1.2.3) in the second data group, and the MAC address (1.2.3) in the second data group is updated to the MAC address (5.5.5) in the first data group, so that all data synchronization between the master device and the slave device can be completed.
According to the technical scheme, the invention has the following advantages:
the invention only needs to synchronize the data with different check values between the main device and the standby device, thereby greatly improving the performance of data check, accelerating the switching efficiency of the main device and the standby device and reducing the load of a CPU.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the modules may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.

Claims (10)

1. A data synchronization method based on a main device and a standby device is characterized by comprising the following steps:
s1, carrying out check calculation on the corresponding first data group and second data group in the main equipment and the standby equipment to obtain a first check value and a second check value;
s2, judging whether the first check value and the second check value are the same;
and S3, if the data are different, updating the second data group in the standby equipment to the first data group in the main equipment, and if the data are the same, keeping the second data group in the standby equipment unchanged.
2. The method according to claim 1, wherein step S1 is preceded by the step of:
and dividing the data in the main equipment and the standby equipment into a plurality of first data groups and a plurality of second data groups respectively.
3. The data synchronization method according to claim 2, wherein the data volumes of different first data groups are the same, and the data volumes of different second data groups are the same.
4. The method according to claim 1, wherein the first data group includes a first MAC address, a first vlan port and a first port, and the second data group includes a second MAC address, a second vlan port and a second port.
5. The method for data synchronization between a host and a slave device according to claim 1, wherein the check calculation in step S1 is implemented by parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, and MD5 check.
6. A data synchronization system based on a main device and a standby device, the system comprising:
the device comprises a check value acquisition unit, a check calculation unit and a check calculation unit, wherein the check value acquisition unit is used for carrying out check calculation on a first data group and a second data group corresponding to the main equipment and the standby equipment to obtain a first check value and a second check value;
a check value judgment unit for judging whether the first check value and the second check value are the same;
and the data updating module is used for updating the second data group in the standby equipment to the first data group in the main equipment when the first check value is different from the second check value.
7. The primary-standby device-based data synchronization system according to claim 6, further comprising:
and the data processing unit is used for dividing the data in the main equipment and the standby equipment into a plurality of first data groups and a plurality of second data groups respectively.
8. The primary-standby device-based data synchronization system according to claim 7, wherein the data volumes of different first data groups are the same, and the data volumes of different second data groups are the same.
9. The system according to claim 1, wherein the first data group includes a first MAC address, a first vlan port and a first port, and the second data group includes a second MAC address, a second vlan port and a second port.
10. The data synchronization system according to claim 1, wherein the check value obtaining unit obtains the first check value and the second check value through parity check, cyclic redundancy check, LRC check, gray code check, checksum, xor check, and MD5 check.
CN201911205067.8A 2019-11-29 2019-11-29 Data synchronization method and system based on main and standby equipment Withdrawn CN110958171A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911205067.8A CN110958171A (en) 2019-11-29 2019-11-29 Data synchronization method and system based on main and standby equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911205067.8A CN110958171A (en) 2019-11-29 2019-11-29 Data synchronization method and system based on main and standby equipment

Publications (1)

Publication Number Publication Date
CN110958171A true CN110958171A (en) 2020-04-03

Family

ID=69979123

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911205067.8A Withdrawn CN110958171A (en) 2019-11-29 2019-11-29 Data synchronization method and system based on main and standby equipment

Country Status (1)

Country Link
CN (1) CN110958171A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1756108A (en) * 2004-09-29 2006-04-05 华为技术有限公司 Master/backup system data synchronizing method
CN101561795A (en) * 2009-05-20 2009-10-21 中兴通讯股份有限公司 Method and device for synchronizing data in distribution-type system
CN105279128A (en) * 2014-06-22 2016-01-27 航天恒星科技有限公司 Method and device for synchronizing parallel data
CN106293996A (en) * 2015-05-20 2017-01-04 腾讯科技(深圳)有限公司 Method of data synchronization, main equipment, alternate device and system
CN110413441A (en) * 2019-06-18 2019-11-05 平安科技(深圳)有限公司 Active and standby storage volume synchrodata method of calibration, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1756108A (en) * 2004-09-29 2006-04-05 华为技术有限公司 Master/backup system data synchronizing method
CN101561795A (en) * 2009-05-20 2009-10-21 中兴通讯股份有限公司 Method and device for synchronizing data in distribution-type system
CN105279128A (en) * 2014-06-22 2016-01-27 航天恒星科技有限公司 Method and device for synchronizing parallel data
CN106293996A (en) * 2015-05-20 2017-01-04 腾讯科技(深圳)有限公司 Method of data synchronization, main equipment, alternate device and system
CN110413441A (en) * 2019-06-18 2019-11-05 平安科技(深圳)有限公司 Active and standby storage volume synchrodata method of calibration, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107332876B (en) Method and device for synchronizing block chain state
EP3208714B1 (en) Data reconstruction method, apparatus and system in distributed storage system
CN104199957B (en) A kind of implementation method of Redis general-purpose proxies
CN113537508A (en) Federal calculation processing method and device, electronic equipment and storage medium
CN111294390B (en) Block data rapid synchronization method, device, equipment and storage medium
CN111723073B (en) Data storage processing method, device, processing system and storage medium
CN102946410A (en) Method and device for network synchronization
EP3700150A1 (en) Method and relevant device for processing data of flexible ethernet
CN104219298A (en) Cluster system and data backup method thereof
CN111966631A (en) Mirror image file generation method, system, equipment and medium capable of being rapidly distributed
CN108600294B (en) Cloud terminal screen sharing system and method
CN106412123B (en) Method and system for distributed processing of terminal equipment information by cloud access controller
CN104503868B (en) Method of data synchronization, device and system
CN104270287A (en) Message disorder detecting method and device
US8886913B2 (en) Apparatus and method for identifier management
CN108200221B (en) Method and device for synchronizing conversion rules in network address conversion environment
CN111064778B (en) Data processing method and system based on STP
CN107977310B (en) Traversal test command generation method and device
CN105704207A (en) Method for generating unique identifier, terminal and network side
CN113259177A (en) Reconstruction method and device of virtual network slice
CN113727429A (en) Cross-network-group clock synchronization method and device, storage medium and terminal
CN110958171A (en) Data synchronization method and system based on main and standby equipment
CN113541987A (en) Method and device for updating configuration data
CN116303343A (en) Data slicing method, device, electronic equipment and storage medium
CN113468140B (en) Data migration processing method, electronic device and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 215000 unit 13 / 16, 4th floor, building B, No.5 Xinghan street, Suzhou Industrial Park, Jiangsu Province

Applicant after: Suzhou Shengke Communication Co.,Ltd.

Address before: 215000 unit 13 / 16, 4th floor, building B, No.5 Xinghan street, Suzhou Industrial Park, Jiangsu Province

Applicant before: CENTEC NETWORKS (SU ZHOU) Co.,Ltd.

WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20200403