CN109005203B - Data synchronization method and device, storage medium, processor and terminal - Google Patents

Data synchronization method and device, storage medium, processor and terminal Download PDF

Info

Publication number
CN109005203B
CN109005203B CN201710419192.3A CN201710419192A CN109005203B CN 109005203 B CN109005203 B CN 109005203B CN 201710419192 A CN201710419192 A CN 201710419192A CN 109005203 B CN109005203 B CN 109005203B
Authority
CN
China
Prior art keywords
terminal
configuration information
synchronization
broadcast message
information
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.)
Active
Application number
CN201710419192.3A
Other languages
Chinese (zh)
Other versions
CN109005203A (en
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.)
Wuxi Yazuo Online Technology Co ltd
Original Assignee
Wuxi Yazuo Online Technology 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 Wuxi Yazuo Online Technology Co ltd filed Critical Wuxi Yazuo Online Technology Co ltd
Priority to CN201710419192.3A priority Critical patent/CN109005203B/en
Publication of CN109005203A publication Critical patent/CN109005203A/en
Application granted granted Critical
Publication of CN109005203B publication Critical patent/CN109005203B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/12Hotels or restaurants
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07GREGISTERING THE RECEIPT OF CASH, VALUABLES, OR TOKENS
    • G07G1/00Cash registers
    • G07G1/12Cash registers electronically operated
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/084Configuration by using pre-existing information, e.g. using templates or copying from other elements
    • H04L41/0846Configuration by using pre-existing information, e.g. using templates or copying from other elements based on copy from other elements

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Resources & Organizations (AREA)
  • Economics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)
  • Hardware Redundancy (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a data synchronization method and device, a storage medium, a processor and a terminal. Wherein, the method comprises the following steps: the method comprises the steps that a first terminal detects whether a network link between the first terminal and at least one second terminal breaks down or not, wherein the first terminal and the second terminal are accessed to the same application platform; when a first terminal detects a fault, the first terminal sends a first broadcast message to at least one second terminal, wherein the first broadcast message carries synchronization information; the invention solves the technical problem that the synchronization scheme stored in the related technology is transitionally dependent on the stability of the Internet or the local area network.

Description

Data synchronization method and device, storage medium, processor and terminal
Technical Field
The present invention relates to the field of data synchronization, and in particular, to a data synchronization method and apparatus, a storage medium, a processor, and a terminal.
Background
Currently, a catering software management system based on an SAAS structure in the catering industry mainly has 2 modes for business data processing: a. pure cloud storage; b. cloud storage + store local storage. The pure cloud storage mode can cause the local system of the store to be unavailable when the internet of the store is unstable, and the normal production business of catering merchants is seriously influenced. The cloud storage and store local storage mode can avoid the complete dependence of catering merchants on the Internet, the data consistency is ensured through the synchronous and asynchronous processing logic, but the stability of the local area network is still relied on, and the synchronization cannot be carried out in time when severe network environments such as broadcasting storm, packet loss and signal interference occur in the local area network.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a data synchronization method and device, a storage medium, a processor and a terminal, which are used for at least solving the technical problem that a synchronization scheme stored in the related technology is transitionally dependent on the stability of the Internet or a local area network.
According to an aspect of an embodiment of the present invention, there is provided a data synchronization method, including: the method comprises the steps that a first terminal detects whether a network link between the first terminal and at least one second terminal breaks down or not, wherein the first terminal and the second terminal are accessed to the same application platform; when the first terminal detects a fault, the first terminal sends a first broadcast message to at least one second terminal, wherein the first broadcast message carries synchronization information.
Optionally, the first broadcast message is a message obtained by encapsulating the synchronization information by using a UDP protocol; the network link is a link using the transmission control protocol TCP.
Optionally, before the first terminal sends the first broadcast message to the at least one second terminal, the method further includes: a first terminal receives a second broadcast message of at least one second terminal, wherein the second broadcast message carries request information for requesting an access address of the first terminal; the first terminal sends an access address to at least one second terminal.
Optionally, the first terminal is a master terminal, and the second terminal is a slave terminal; when the first terminal fails, the method further comprises:
a designated terminal in the at least one second terminal receives the setting instruction; setting the designated terminal as a main terminal according to the setting instruction; or, at least one second terminal negotiates with each other, and the main terminal is determined from the at least one second terminal according to a preset rule.
Optionally, the detecting, by the first terminal, whether a link between the first terminal and the at least one second terminal fails includes: the first terminal detects whether the first terminal has a fault; the first terminal detects that the network environment where the network link is located has a fault.
Optionally, when the failure of the network link is recovered to be normal, the method further includes: a first terminal requests first configuration information currently stored by network side equipment from the network side equipment; a first terminal receives first configuration information; the first terminal compares whether the first configuration information is consistent with second configuration information stored locally; and when the comparison result indicates that the configuration information is inconsistent, the first terminal updates the second configuration information according to the first configuration information.
Optionally, the comparing, by the first terminal, whether the first configuration information is consistent with the second configuration information stored locally includes: the first terminal extracts a first mark and a second mark from the first configuration information and the second configuration information respectively, and the first terminal compares whether the first mark and the second mark are the same, wherein when the first mark and the second mark are the same, the first configuration information and the second configuration information are determined to be consistent; and when the first configuration information and the second configuration information are different, determining that the first configuration information and the second configuration information are inconsistent.
According to another aspect of the embodiments of the present invention, there is provided a data synchronization method, including: when a network link between a first terminal and a second terminal fails, the second terminal receives a first broadcast message sent by the first terminal, the first terminal and the second terminal are accessed to the same application platform, and the first broadcast message carries synchronous information; and the second terminal carries out synchronization according to the synchronization information.
According to still another aspect of an embodiment of the present invention, there is provided a data synchronization apparatus including: the system comprises a synchronization module, a first application platform and a second application platform, wherein the synchronization module is used for detecting whether a network link between a first terminal and at least one second terminal fails, and the first terminal and the second terminal are accessed to the same application platform; the broadcast module is configured to send a first broadcast message to at least one second terminal when the first terminal detects a failure, where the first broadcast message carries synchronization information.
According to still another aspect of an embodiment of the present invention, there is provided a storage medium including a stored program, wherein the program performs any one of the above data synchronization methods.
According to a further aspect of the embodiments of the present invention, there is provided a processor, configured to execute a program, wherein the program executes to perform any one of the above data synchronization methods.
According to still another aspect of an embodiment of the present invention, there is provided a terminal including: the processor is used for detecting whether a network link between a first terminal and at least one second terminal fails, wherein the first terminal and the second terminal are accessed to the same application platform; the communication device is used for sending a first broadcast message to at least one second terminal when the first terminal detects a fault, wherein the first broadcast message carries synchronization information.
In the embodiment of the invention, a mode that the first terminal detects whether a network link between the first terminal and at least one second terminal has a fault is adopted, and when the first terminal detects the fault, the first terminal sends the first broadcast message to the at least one second terminal, so that the aims of cloud storage and store local storage are fulfilled, the technical effect of ensuring data consistency and accuracy is achieved, and the technical problem that a synchronization scheme stored in the related technology excessively depends on the stability of the internet or a local area network is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention and do not constitute a limitation of the invention. In the drawings:
FIG. 1 is a flow diagram of a method of data synchronization according to the prior art;
FIG. 2 is a flow chart illustrating an alternative method of data synchronization according to an embodiment of the present invention;
FIG. 3 is a block diagram of an alternative data synchronization system according to an embodiment of the present application;
FIG. 4 is a block diagram of a data synchronization apparatus according to an embodiment of the present application; and
fig. 5 is a block diagram of another computer terminal according to an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided a data synchronization method embodiment, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a method for data synchronization according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S102, a first terminal detects whether a network link between the first terminal and at least one second terminal has a fault, wherein the first terminal and the second terminal are accessed to the same application platform;
in the step S102, when a communication failure of a network link between the network links exists between the first terminal and the at least one second terminal, it is determined that the network link between the first terminal and the at least one second terminal has a failure; the first terminal and the second terminal are accessed to the same store system platform; specifically, when logging in from a store system, accessing a first terminal and at least one second terminal according to an access address of the first terminal, and detecting whether a fault occurs between the first terminal and the at least one second terminal; the following implementations may be presented: if the network condition connection fails (e.g., the network signal becomes weak or disappears, etc.) or the terminal fails, it can be confirmed that the network link between the two is failed.
In an optional embodiment, the detecting, by the first terminal, whether a link between the first terminal and the at least one second terminal is failed includes: the first terminal detects whether the first terminal has a fault; a first terminal detects that a network environment where a network link is located has a fault;
through the steps, the purpose that whether the network link between the first terminal and the at least one second terminal is in failure or not can be achieved.
Step S104, when the first terminal detects a fault, the first terminal sends a first broadcast message to at least one second terminal, wherein the first broadcast message carries synchronous information;
in step S104, the synchronization information refers to synchronization information between the configuration information of the first terminal and the configuration information of the second terminal, and specifically, when the configuration information is changed, the first terminal synchronizes the changed configuration information to at least one second terminal;
in an optional embodiment, before the first terminal sends the first broadcast message to the at least one second terminal, the method further includes: a first terminal receives a second broadcast message of at least one second terminal, wherein the second broadcast message carries request information for requesting an access address of the first terminal; the first terminal sends an access address to at least one second terminal.
Through the steps, the purpose that the first terminal sends the synchronous information to the at least one second terminal in a broadcasting mode can be achieved, and therefore dependence on the internet and a local area network is eliminated.
Through the above steps S102 and S104, a manner that the first terminal detects whether a network link between the first terminal and the at least one second terminal has a fault is adopted, and when the first terminal detects the fault, the first terminal sends the first broadcast message to the at least one second terminal.
Optionally, the first broadcast message is a message obtained by encapsulating the synchronization information by using a UDP protocol; the network link is a link using transmission control protocol TCP. That is, the synchronization information may be broadcast using UDP.
Optionally, the first terminal is a master terminal, and the second terminal is a slave terminal; when the first terminal fails, the master terminal may be determined by, but is not limited to: a designated terminal in the at least one second terminal receives the setting instruction; setting the designated terminal as a main terminal according to the setting instruction; or, at least one second terminal negotiates, and a main terminal is determined from the at least one second terminal according to a preset rule;
in the above step, the setting instruction includes setting an IP address of the main terminal and an IP address of the second terminal; the preset rule may be a preset priority, or may also be according to registration time of the first terminal and the second terminal in the application platform, and for the latter, the following implementation manner may be presented: the registration time of the a terminal of the second terminals is 2015-1-1, the registration time of the B terminal of the second terminals is 2015-5-1, and the a terminal is determined as the master terminal because the registration time of the a terminal is earlier than the registration time of the B terminal.
Specifically, at least one slave terminal is set as a master terminal according to a setting instruction or a preset rule; after the setting is completed, the main terminal sends change information to inform at least one second terminal, and meanwhile, the configuration information of the main terminal in the network side equipment is changed.
Optionally, when the failure of the network link is recovered to be normal, the first terminal requests, to the network-side device, first configuration information currently stored by the network-side device; a first terminal receives first configuration information; the first terminal compares whether the first configuration information is consistent with second configuration information stored locally; when the comparison result indicates inconsistency, the first terminal updates the second configuration information according to the first configuration information;
specifically, when the failure of the network link is recovered to be normal, the cloud terminal synchronously acquires the latest configuration information configured by the master terminal, compares the latest configuration information with the locally stored configuration information, and modifies the locally stored configuration information when the latest configuration information is inconsistent with the locally stored configuration information.
Alternatively, whether the first configuration information and the locally stored second configuration information are consistent may be compared in various ways, for example, but not limited to: the first terminal extracts a first mark and a second mark from the first configuration information and the second configuration information respectively, and the first terminal compares whether the first mark and the second mark are the same, wherein when the first mark and the second mark are the same, the first configuration information and the second configuration information are determined to be consistent; if the first configuration information and the second configuration information are different, determining that the first configuration information and the second configuration information are inconsistent;
specifically, the first flag and the second flag refer to version numbers of configuration information, and in the above steps, when all terminals are started, it is necessary to synchronize the configuration information of the network side device and return the local information to the network side device, which may be expressed as the following implementation manners: if the version number of the configuration information in the first mark is 1.0 and the version number of the configuration information in the second mark is 1.0, the first configuration information is consistent with the second configuration information; and if the version number of the configuration information in the first mark is 2.0 and the version number of the configuration information in the second mark is 3.0, the first configuration information is inconsistent with the second configuration information.
An application scenario of the embodiment of the present application is described below with reference to a specific application scenario, as shown in fig. 2:
step S202, when the system logs in from the store, the main terminal is accessed according to the stored main terminal address, wherein when the local storage is not available or the access is failed, the main terminal address is inquired through UDP broadcast in the local area network; after receiving the inquiry information, the master terminal sends feedback information informing the master terminal and the information of the IP address to the slave terminal;
step S204, when the main terminal is in fault, the merchant sets other terminals on the terminal as the main terminal, wherein after the setting is finished, the main terminal sends a broadcast notice to inform that the main terminal in the local area network is changed, and simultaneously, a cloud interface is called to modify the setting of the cloud main terminal;
step S206, the slave terminal receives the information and then modifies the configuration information of the local master terminal, wherein, after the setting is finished, the data updating is carried out on the master terminal equipment, and after the updating, the master terminal sends a broadcast to inform that the master terminal in the local area network is changed; modifying the local main terminal configuration information after receiving the information from the terminal;
step S208, after the main terminal network is abnormally reconnected, the cloud synchronously acquires the latest main terminal configuration information and compares the latest main terminal configuration information with the local configuration information, wherein the configuration information of the local main terminal is modified when the two are inconsistent;
step S210, when all terminal devices are started, cloud main terminal configuration information needs to be synchronized and local information needs to be returned to a cloud, wherein when the cloud main terminal is set to be changed, whether synchronization is successful needs to be judged through a change mark;
through the steps S202 to S210, a manner that the first terminal detects whether a network link between the first terminal and the at least one second terminal has a fault is adopted, and when the first terminal detects the fault, the first terminal sends the first broadcast message to the at least one second terminal.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
Example 3
According to an embodiment of the present invention, there is further provided a system for data synchronization, as shown in fig. 3, including:
the terminal device 301 is used for logging in a store system; the terminal devices include but are not limited to: tablet computers, mobile phones, computers, and the like.
A master terminal 303, configured to synchronize configuration information with the terminal device 301; the terminal devices include but are not limited to: POS machine, etc.
A slave terminal 305 for synchronizing configuration information with the master terminal 303; the terminal devices include but are not limited to: POS machine, etc.
A printer 307 for printing data output by the main terminal 303;
the cloud server 309 is configured to store synchronization information of the master terminal 303 and the slave terminal 307 on the network side, monitor states of the master terminal 303 and the slave terminal 305, and issue response data to the master terminal and the slave terminal, for example, in the catering field, when the master terminal and the slave terminal are POS machines, the cloud server may issue billing data.
Example 4
According to an embodiment of the present invention, there is also provided a data synchronization apparatus, as shown in fig. 4, including:
a detecting module 401, configured to detect whether a network link between a first terminal and at least one second terminal fails, where the first terminal and the second terminal access a same application platform;
the broadcast module 403 is configured to send a first broadcast message to at least one second terminal when the first terminal detects a failure, where the first broadcast message carries synchronization information.
It should be noted that the above modules correspond to steps S102 to S104 in embodiment 1, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of the first embodiment. It should be noted that the modules described above as part of the apparatus may be run in the computer terminal provided in the first embodiment.
In an alternative embodiment, the above modules may be represented as the following hardware implementation: the modules are positioned in the same processor; alternatively, the modules may be located in different processors in any combination.
Example 5
The embodiment of the application further provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the data synchronization method provided in embodiment 1.
The storage medium described above stores a program that performs the following functions: the method comprises the steps that a first terminal detects whether a network link between the first terminal and at least one second terminal breaks down, wherein the first terminal and the second terminal are accessed to the same application platform; when the first terminal detects a fault, the first terminal sends a first broadcast message to at least one second terminal, wherein the first broadcast message carries synchronization information.
Optionally, the first broadcast message is a message obtained by encapsulating the synchronization information by using a UDP protocol; the network link is a link using the transmission control protocol TCP.
Optionally, the first terminal is a master terminal, and the second terminal is a slave terminal; when the first terminal fails, the method further comprises: a designated terminal in the at least one second terminal receives the setting instruction; setting the appointed terminal as a main terminal according to the setting instruction; or, at least one second terminal negotiates, and a main terminal is determined from the at least one second terminal according to a preset rule;
in the above step, the setting instruction includes setting an IP address of the main terminal and an IP address of the second terminal; the preset rule may be a preset priority, or may also be according to registration time of the first terminal and the second terminal in the application platform, and for the latter, the following implementation manner may be presented: the registration time of the terminal A in the second terminal is 2015-1-1, the registration time of the terminal B in the second terminal is 2015-5-1, and when the main terminal is set, the main terminal is determined according to the sequence of the registration time, and then the main terminal is the terminal A.
Optionally, when the failure of the network link is recovered to be normal, the first terminal requests, to the network-side device, first configuration information currently stored by the network-side device; a first terminal receives first configuration information; the first terminal compares whether the first configuration information is consistent with second configuration information stored locally; when the comparison result indicates that the first configuration information and the second configuration information are inconsistent, the first terminal updates the second configuration information according to the first configuration information;
specifically, when the fault of the network link is recovered to be normal, the cloud terminal synchronously acquires the latest configuration information configured by the main terminal, compares the latest configuration information with the localization information, and modifies the local information when the latest configuration information is inconsistent with the localization information.
Alternatively, whether the first configuration information and the locally stored second configuration information are consistent may be compared in various ways, for example, but not limited to: the first terminal extracts a first mark and a second mark from the first configuration information and the second configuration information respectively, and the first terminal compares whether the first mark and the second mark are the same, wherein when the first mark and the second mark are the same, the first configuration information and the second configuration information are determined to be consistent; when the first configuration information and the second configuration information are different, determining that the first configuration information and the second configuration information are inconsistent;
specifically, the first flag and the second flag refer to version numbers of configuration information, and in the above steps, when all terminals are started, it is necessary to synchronize the configuration information of the network side device and return the local information to the network side device, which may be expressed as the following implementation manners: if the version number of the configuration information in the first mark is 1.0 and the version number of the configuration information in the second mark is 1.0, the first configuration information is consistent with the second configuration information; and if the version number of the configuration information in the first mark is 2.0 and the version number of the configuration information in the second mark is 3.0, the first configuration information is inconsistent with the second configuration information.
Example 6
The embodiment of the application also provides a processor. Optionally, in this embodiment, the processor may be configured to store a program code executed by the data synchronization method provided in embodiment 1.
The processor is configured to execute the following programs to implement the following functions: the method comprises the steps that a first terminal detects whether a network link between the first terminal and at least one second terminal breaks down or not, wherein the first terminal and the second terminal are accessed to the same application platform; when the first terminal detects a fault, the first terminal sends a first broadcast message to at least one second terminal, wherein the first broadcast message carries synchronization information.
Optionally, the first broadcast message is a message obtained by encapsulating the synchronization information by using a UDP protocol; the network link is a link using the transmission control protocol TCP.
Optionally, the first terminal is a master terminal, and the second terminal is a slave terminal; the first terminal comprises the following components when the first terminal fails: a designated terminal in the at least one second terminal receives the setting instruction; setting the designated terminal as a main terminal according to the setting instruction; or, at least one second terminal negotiates, and a main terminal is determined from the at least one second terminal according to a preset rule;
in the above steps, the setting instruction includes setting an IP address of the main terminal and an IP address of the second terminal; the preset rule may be a preset priority, or may be according to registration time of the first terminal and the second terminal in the application platform, and for the latter, the following implementation manner may be shown: the registration time of the terminal A in the second terminal is 2015-1-1, the registration time of the terminal B in the second terminal is 2015-5-1, and when the main terminal is set, the main terminal is determined according to the sequence of the registration time, and then the main terminal is the terminal A.
Optionally, when the failure of the network link is recovered to be normal, the first terminal requests, to the network-side device, first configuration information currently stored by the network-side device; a first terminal receives first configuration information; the first terminal compares whether the first configuration information is consistent with second configuration information stored locally; when the comparison result indicates that the first configuration information and the second configuration information are inconsistent, the first terminal updates the second configuration information according to the first configuration information;
specifically, when the network link is recovered to be normal, the cloud terminal synchronously acquires the latest configuration information configured by the main terminal, compares the latest configuration information with the localization information, and modifies the local information when the latest configuration information is inconsistent with the localization information.
Alternatively, whether the first configuration information and the locally stored second configuration information are consistent may be compared in various ways, for example, by but not limited to: the first terminal extracts a first mark and a second mark from the first configuration information and the second configuration information respectively, and the first terminal compares whether the first mark and the second mark are the same, wherein when the first mark and the second mark are the same, the first configuration information and the second configuration information are determined to be consistent; if the first configuration information and the second configuration information are different, determining that the first configuration information and the second configuration information are inconsistent;
specifically, the first flag and the second flag are version numbers of configuration information, and in the above step, when all terminals are started, it is necessary to synchronize the configuration information of the network side device and return local information to the network side device, which may be implemented as follows: if the version number of the configuration information in the first mark is 1.0 and the version number of the configuration information in the second mark is 1.0, the first configuration information is consistent with the second configuration information; and if the version number of the configuration information in the first mark is 2.0 and the version number of the configuration information in the second mark is 3.0, the first configuration information is inconsistent with the second configuration information.
Example 7
According to still another aspect of the embodiments of the present invention, there is provided a terminal, as shown in fig. 5, including:
a processor 501, configured to detect whether a network link between a first terminal and at least one second terminal fails, where the first terminal and the second terminal access a same application platform;
a communication device 503, configured to send a first broadcast message to at least one second terminal when the first terminal detects a failure, where the first broadcast message carries synchronization information.
It should be noted here that the above devices correspond to steps S102 to S104 in embodiment 1, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of the above embodiment.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described in detail in a certain embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and amendments can be made without departing from the principle of the present invention, and these modifications and amendments should also be considered as the protection scope of the present invention.

Claims (12)

1. A method of data synchronization, comprising:
a first terminal detects whether a network link between the first terminal and at least one second terminal fails, wherein the first terminal and the second terminal are accessed to the same application platform, the first terminal is a master terminal, and the second terminal is a slave terminal;
when the first terminal detects a fault, the first terminal sends a first broadcast message to the at least one second terminal, wherein the first broadcast message carries synchronization information, and the synchronization information includes configuration information of the first terminal.
2. The method of claim 1, wherein the first broadcast message is a message obtained by encapsulating the synchronization information using a UDP protocol; the network link is a link adopting a Transmission Control Protocol (TCP).
3. The method of claim 1, wherein before the first terminal sends the first broadcast message to the at least one second terminal, the method further comprises:
the first terminal receives a second broadcast message of the at least one second terminal, wherein the second broadcast message carries request information for requesting an access address of the first terminal;
and the first terminal sends the access address to the at least one second terminal.
4. The method of claim 1, wherein upon failure of the first terminal, the method further comprises:
a designated terminal in the at least one second terminal receives a setting instruction; setting the designated terminal as the main terminal according to the setting instruction; alternatively, the first and second electrodes may be,
and negotiating among the at least one second terminal, and determining the main terminal from the at least one second terminal according to a preset rule.
5. The method of claim 1, wherein the first terminal detecting whether a link between the first terminal and at least one second terminal is failed comprises:
the first terminal detects whether the first terminal breaks down; and the first terminal detects whether the network environment where the network link is located has a fault.
6. The method according to any of claims 1 to 5, wherein upon recovery of the failure of the network link, the method further comprises:
the first terminal requests first configuration information currently stored by network side equipment from the network side equipment;
the first terminal receives the first configuration information;
the first terminal compares whether the first configuration information is consistent with second configuration information stored locally;
and when the comparison result indicates inconsistency, the first terminal updates the second configuration information according to the first configuration information.
7. The method of claim 6, wherein the first terminal comparing the first configuration information with the locally stored second configuration information for consistency comprises:
the first terminal extracts a first tag and a second tag from the first configuration information and the second configuration information, respectively, and
the first terminal compares whether the first mark and the second mark are the same, wherein when the first mark and the second mark are the same, the first terminal determines that the first configuration information and the second configuration information are consistent; when not, determining that the first configuration information and the second configuration information are inconsistent.
8. A method of data synchronization, comprising:
when a network link between a first terminal and a second terminal fails, the second terminal receives a first broadcast message sent by the first terminal, the first terminal and the second terminal are accessed to the same application platform, the first broadcast message carries synchronization information, the first terminal is a master terminal, the second terminal is a slave terminal, and the synchronization information comprises configuration information of the first terminal;
and the second terminal carries out synchronization according to the synchronization information.
9. A data synchronization apparatus, comprising:
the system comprises a synchronization module, a first network interface module and a second network interface module, wherein the synchronization module is used for detecting whether a network link between a first terminal and at least one second terminal fails, the first terminal and the second terminal are accessed to the same application platform, the first terminal is a master terminal, and the second terminal is a slave terminal;
a broadcast module, configured to send a first broadcast message to the at least one second terminal when the first terminal detects a failure, where the first broadcast message carries synchronization information, and the synchronization information includes configuration information of the first terminal.
10. A storage medium characterized in that the storage medium includes a stored program, wherein the program executes the data synchronization method of any one of claims 1 to 7 or the data synchronization method of claim 8.
11. A processor, characterized in that the processor is configured to run a program, wherein the program is configured to perform the data synchronization method of any one of claims 1 to 7 or the data synchronization method of claim 8 when running.
12. A terminal, comprising:
the system comprises a processor, a first processing unit and a second processing unit, wherein the processor is used for detecting whether a network link between a first terminal and at least one second terminal fails, the first terminal and the second terminal are accessed to the same application platform, the first terminal is a master terminal, and the second terminal is a slave terminal;
a communication device, configured to send a first broadcast message to the at least one second terminal when the first terminal detects a failure, where the first broadcast message carries synchronization information, and the synchronization information includes configuration information of the first terminal.
CN201710419192.3A 2017-06-06 2017-06-06 Data synchronization method and device, storage medium, processor and terminal Active CN109005203B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710419192.3A CN109005203B (en) 2017-06-06 2017-06-06 Data synchronization method and device, storage medium, processor and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710419192.3A CN109005203B (en) 2017-06-06 2017-06-06 Data synchronization method and device, storage medium, processor and terminal

Publications (2)

Publication Number Publication Date
CN109005203A CN109005203A (en) 2018-12-14
CN109005203B true CN109005203B (en) 2022-11-11

Family

ID=64572668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710419192.3A Active CN109005203B (en) 2017-06-06 2017-06-06 Data synchronization method and device, storage medium, processor and terminal

Country Status (1)

Country Link
CN (1) CN109005203B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110188001B (en) * 2019-05-27 2022-06-03 维沃移动通信有限公司 Application program starting method, application program prompting method and terminal
CN111653052B (en) * 2020-04-26 2022-06-21 北京三快在线科技有限公司 Cash register system and cash register switching method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1705939A1 (en) * 2005-03-24 2006-09-27 Siemens Aktiengesellschaft Fast synchronised handover method and system
CN100446592C (en) * 2005-06-13 2008-12-24 大唐移动通信设备有限公司 Cluster communication method for mobile network terminal
CN103036716B (en) * 2012-12-12 2018-06-22 中兴通讯股份有限公司 Link switch-over method and system
CN103200016A (en) * 2013-03-28 2013-07-10 天脉聚源(北京)传媒科技有限公司 Method and system for information interaction
CN105791064A (en) * 2016-03-31 2016-07-20 青岛海信宽带多媒体技术有限公司 Cooperation processing method for messages in local area network, and device
CN106341279B (en) * 2016-10-31 2019-08-16 普联技术有限公司 The synchronous method and device of configuration information

Also Published As

Publication number Publication date
CN109005203A (en) 2018-12-14

Similar Documents

Publication Publication Date Title
US9596134B2 (en) Synchronization of configuration file of virtual application distribution chassis
CN107040594A (en) The method and device of license block chain node access based on PBFT
CN112000355B (en) Method and device for firmware upgrading and household appliance
CN104301142A (en) Backup method and device for configuration files
CN105574109A (en) Database synchronizing method and equipment and system
CN104184756A (en) Data synchronization method, device and system
CN103281356B (en) File distribution method and system
CN107888434B (en) Network equipment configuration synchronization method and device
CN109005203B (en) Data synchronization method and device, storage medium, processor and terminal
WO2016026313A1 (en) Method, device and system for implementing information self-registration, and computer storage medium
JP2017536624A (en) Snapshot processing methods and associated devices
CN106941418B (en) SSL VPN configuration information synchronization method and device
CN110958287B (en) Operation object data synchronization method, device and system
CN105205100A (en) Data synchronization method based on MTP between terminals and terminals
CN111083049A (en) User table item recovery method and device, electronic equipment and storage medium
CN111078463B (en) Data backup method, device and system
US11128622B2 (en) Method for processing data request and system therefor, access device, and storage device
CN112636987A (en) Block chain cross-chain gateway determination method, system and terminal equipment
CN104426644A (en) Equipment time synchronization method and device
CN110768811B (en) Method, device and system for updating YANG model file library
CN105763582A (en) Method, device and system for switching service registration equipment
CN104468767A (en) Method and system for detecting cloud storage data collision
CN104092560A (en) Method and system for realizing clustering by connecting switch with controller, switch, and controller
CN113722126A (en) Request processing method and device
CN113949631A (en) Client disaster tolerance processing method and system and electronic equipment

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
GR01 Patent grant
GR01 Patent grant