Multi-terminal communication system, database synchronization method thereof and electronic equipment

By configuring the data source end in a multi-end communication system, obtaining database change instructions and determining the target receiver end based on preset policies, the ID conflicts and data inconsistencies caused by frequent operations of database synchronization in the rail transit comprehensive monitoring system are solved, and stable and real-time database synchronization is achieved.

CN120296087APending Publication Date: 2025-07-11BEIJING URBAN CONSTR INTELLIGENT CONTROL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510235939.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the comprehensive rail transit monitoring system, database synchronization faces the problems of automatic database generation ID conflicts and data inconsistencies caused by frequent operations during peak periods, which affects the stable operation of the system.

Method used

By configuring the data source in a multi-end communication system, obtaining database change instructions and determining the target receiver according to the preset synchronization strategy, unified management of database synchronization is realized to avoid synchronization errors caused by frequent operations.

Benefits of technology

It realizes the stability and real-time nature of database synchronization, reduces synchronization delay, and ensures the normal operation and user experience of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120296087A_ABST
    Figure CN120296087A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-terminal communication system, a database synchronization method thereof and electronic equipment, and relates to the technical field of synchronization. Each end in the multi-end communication system is configured with a database, any end in the multi-end communication system is marked as a home terminal, and the method comprises the following steps: acquiring a first database change instruction of the home terminal; whether the first database change instruction is an instruction generated by an application service or not is judged, whether the home terminal is a data source terminal or not is judged according to a judgment result, and the data source terminal is a terminal initiating database synchronization in a preset multi-terminal communication system; when the local end is a data source end, a database of the local end is changed according to the first database change instruction, a second database change instruction is generated according to the first database change instruction, and a target receiving end is determined according to a preset synchronization strategy; and sending the second database change instruction to the target receiving end, so that the target receiving end changes a database of the target receiving end according to the second database change instruction to realize database synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of synchronization technology, and particularly to a multi-terminal communication system, a database synchronization method thereof, and an electronic device. Background Art

[0002] In an information system, database synchronization software plays a key role in data disaster recovery. For an integrated monitoring system of rail transit, since its control center and each station are equipped with independent database clusters, when the network connection between the control center and the station is interrupted, the basic functions of both sides can still operate normally. If data interaction and synchronization operations between multiple clusters cannot be processed, it will affect the stable operation of the system. Therefore, more stringent requirements are imposed on the real-time performance and accuracy of data synchronization. However, in situations such as peak hours of subway operation, the station and the control center will frequently operate on the database, resulting in huge challenges for database synchronization. Once the situation of simultaneous data updates at both ends occurs, problems such as ID conflicts automatically generated by the database and data inconsistency will be caused. Summary of the Invention

[0003] The present invention aims to at least solve one of the technical problems in the related art to some extent. For this reason, the first object of the present invention is to propose a database synchronization method for a multi-terminal communication system to avoid database synchronization errors.

[0004] The second object of the present invention is to propose an electronic device.

[0005] The third object of the present invention is to propose a multi-terminal communication system.

[0006] To achieve the above object, an embodiment of the first aspect of the present invention proposes a database synchronization method for a multi-terminal communication system. Each end in the multi-terminal communication system is configured with a database. For any end in the multi-terminal communication system, which is denoted as the local end, the method includes: obtaining a first database change instruction of the local end; determining whether the first database change instruction is an instruction generated by an application service, and determining whether the local end is a data source end according to the determination result, where the data source end is the end that initiates database synchronization in the preset multi-terminal communication system; when the local end is the data source end, changing the database of the local end according to the first database change instruction, generating a second database change instruction according to the first database change instruction, and determining a target receiving end according to a preset synchronization policy; sending the second database change instruction to the target receiving end, so that the target receiving end changes the database of the target receiving end according to the second database change instruction to achieve database synchronization.

[0007] In addition, the database synchronization method of the multi-terminal communication system according to the embodiments of the present invention may further have the following additional technical features:

[0008] In an embodiment of the present invention, determining whether the first database change instruction is an instruction generated by an application service, and determining whether the local end is a data source end according to the determination result includes: when the first database change instruction includes first preset information, determining that the local end is the data source end; when the first database change instruction includes second preset information, determining whether the local end is the data source end according to the preset synchronization policy; wherein, the first preset information is information indicating that the first database change instruction is not an instruction generated by an application service, and the second preset information is information indicating that the first database change instruction is an instruction generated by an application service.

[0009] In an embodiment of the present invention, when the local end is not the data source end, the method further includes: generating a third database change instruction according to the first database change instruction, determining a data source end according to the preset synchronization policy, and sending the third database change instruction to the data source end, so that the data source end changes the database of the data source end according to the third database change instruction, generating a fourth database change instruction according to the third database change instruction, and sending the fourth database change instruction to the target receiving end to achieve database synchronization, wherein the target receiving end includes the local end.

[0010] In an embodiment of the present invention, before sending the third database change instruction to the data source end, the method further includes: obtaining the survival state of the main server of the data source end, and sending the third database change instruction to the data source end when the survival state is alive, wherein the main server is the server in the server of the data source end that communicates with the local end.

[0011] In an embodiment of the present invention, changing the database of the local end according to the first database change instruction includes: obtaining the current state of the remote dictionary server of the local end, and changing the database of the local end when the current state is alive.

[0012] In an embodiment of the present invention, when the first database change instruction includes the first preset information, before changing the local database according to the first database change instruction, the method further includes: determining whether there is an abnormal synchronization state between the local end and the data source end, where the data source end is the end in the multi-terminal communication system that generates the data operation information in the first database change instruction according to the application service configured thereon; when there is no such abnormal synchronization state, determining whether the database connection state between the local end and the data source end is normal, so as to change the local database when the database connection state is normal.

[0013] In an embodiment of the present invention, the number of target receiving ends is at least two. When the first database change instruction includes the first preset information, sending the second database change instruction to the target receiving ends includes: determining the data source end among the target receiving ends according to the preset synchronization policy, and sending the second database change instruction to the data source end; sending the second database change instruction to other target receiving ends except the data source end.

[0014] In an embodiment of the present invention, when the local end fails to send the second database change instruction to the target receiving end, the method further includes: storing the failure information in the remote dictionary server of the local end.

[0015] To achieve the above object, an embodiment of the second aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and running on the processor. When the computer program is executed by the processor, the database synchronization method of the above multi-terminal communication system is implemented.

[0016] To achieve the above object, an embodiment of the third aspect of the present invention provides a multi-terminal communication system, and each end in the multi-terminal communication system includes the above electronic device.

[0017] A multi - terminal communication system, a database synchronization method, and an electronic device according to an embodiment of the present invention. Obtain a first database change instruction of the local end; determine whether the first database change instruction is an instruction generated by an application service, and determine whether the local end is a data source end according to the determination result, where the data source end is the end that initiates database synchronization in a preset multi - terminal communication system; when the local end is the data source end, change the database of the local end according to the first database change instruction, generate a second database change instruction according to the first database change instruction, and determine a target receiving end according to a preset synchronization policy; send the second database change instruction to the target receiving end so that the target receiving end changes the database of the target receiving end according to the second database change instruction to achieve database synchronization. That is to say, by executing database synchronization in a multi - terminal communication system through a pre - configured data source end, unified management of database synchronization can be achieved, thereby avoiding database synchronization errors when the database is frequently operated.

[0018] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flowchart of a database synchronization method for a multi - terminal communication system according to an embodiment of the present invention;

[0020] Figure 2 is a flowchart of a database synchronization method for a multi - terminal communication system in an example of the present invention;

[0021] Figure 3 is a flowchart of a database synchronization method for a multi - terminal communication system in another example of the present invention;

[0022] Figure 4 is a flowchart of a database synchronization method for a multi - terminal communication system in yet another example of the present invention;

[0023] Figure 5 is a flowchart of a database synchronization method for a multi - terminal communication system in yet another example of the present invention;

[0024] Figure 6 is a block diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0025] The following describes a multi - terminal communication system, a database synchronization method, and an electronic device according to an embodiment of the present invention with reference to the accompanying drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout. The embodiments described with reference to the accompanying drawings are exemplary and should not be construed as limiting the present invention.

[0026] Figure 1It is a flowchart of the database synchronization method of the multi - terminal communication system according to an embodiment of the present invention.

[0027] In an embodiment of the present invention, each end in the multi - terminal communication system is configured with a database, and for any end in the multi - terminal communication system, it is denoted as the local end.

[0028] As Figure 1 shown, the database synchronization method of the multi - terminal communication system includes:

[0029] S11, obtain the first database change instruction of the local end.

[0030] Since the local end is any end in the multi - terminal communication system, that is to say, for any end in the multi - terminal communication system, a first database change instruction may be generated on it, and after generating this first database change instruction, it needs to obtain this instruction.

[0031] S12, determine whether the first database change instruction is an instruction generated by an application service, and determine whether the local end is a data source end according to the judgment result.

[0032] Among them, the data source end is the end that initiates database synchronization in the preset multi - terminal communication system.

[0033] Specifically, in the multi - terminal communication system, a data source end is pre - configured, and this data source end is the end that initiates database synchronization in this multi - terminal communication system. That is, in this multi - terminal communication system, no matter which end generates the first database change instruction, the database synchronization is uniformly performed by this data source end, that is, the database in all the ends to be synchronized is uniformly changed by this data source end according to this first database change instruction.

[0034] Therefore, for each end in this multi - terminal communication system, when the first database change instruction is generated on it, it is necessary to first determine whether it itself is the pre - configured data source end.

[0035] In order to determine whether it itself is the pre - configured data source end, the generation method of the above - mentioned first database change instruction can be obtained. If the first database change instruction is not an instruction generated by an application service, it means that the user is not operating on the local end. At this time, it can be confirmed that the local end is the data source end.

[0036] S13, when the local end is the data source end, change the database of the local end according to the first database change instruction, generate a second database change instruction according to the first database change instruction, and determine the target receiving end according to the preset synchronization policy.

[0037] Among them, since database synchronization needs to be implemented, after the local end changes its own database according to the first database change instruction, it is also necessary to generate a second database change instruction according to the first database change instruction, that is, it is necessary to determine how the target receiving end needs to change the database to achieve database synchronization according to the database change situation of the local end, and then generate a second database change instruction that instructs the target receiving end to change the database and how to change the database according to the change content. For example, on the basis of the first database change instruction, a second database change instruction can be generated by adding information that can indicate that the receiving end of the instruction is the target receiving end; for another example, assuming that the first database change instruction contains information indicating whether the instruction is generated for the application service, the second database change instruction may not contain this information, so that the receiving end can determine that it is the target receiving end to be synchronized according to this information; for another example, the format of the instruction sent to the target receiving end to be synchronized can be set to be inconsistent with the format of the instruction obtained by the synchronization end that sends the instruction. After the local end determines how to make changes according to the first database change instruction, it can generate a second database change instruction according to the database operation to be performed and the format of the second database change instruction.

[0038] S14. Send the second database change instruction to the target receiving end so that the target receiving end changes the database of the target receiving end according to the second database change instruction to achieve database synchronization.

[0039] Specifically, when it is determined that the local end is the data source end, that is, the local end initiates database synchronization. At this time, the local end can first change its own database according to the first database change instruction, generate a second database change instruction according to the first database change instruction, and query the preset synchronization policy to determine the target receiving end. This target receiving end is the receiving end to be synchronized corresponding to the local end.

[0040] As an example, assume that the above multi-end communication system is a system including a data center and multiple stations, and one of the first preset stations is set as the local end, and this local end is the data source end, and the data center and other stations are set as target receiving ends. After the local end generates the first database change instruction, the local end changes the database of Station 1 according to the first database change instruction, generates a second database change instruction according to the first database change instruction, and sends the second database change instruction to the above data center and other stations except the above first preset station.

[0041] Thus, when a first database change instruction is generated on any end in the multi-end communication system, it is first determined whether this end is the data source end configured in advance to initiate database synchronization, that is, only the data source end performs database synchronization. That is to say, by performing database synchronization in the multi-end communication system through the pre-configured data source end, unified management of database synchronization can be achieved, thereby avoiding database synchronization errors when frequently operating on the database.

[0042] In some embodiments of the present invention, determining whether the first database change instruction is an instruction generated by an application service and determining whether this end is the data source end according to the determination result includes: when the first database change instruction contains first preset information, determining that this end is the data source end; when the first database change instruction contains second preset information, determining whether this end is the data source end according to a preset synchronization policy; wherein, the first preset information is information indicating that the first database change instruction is not an instruction generated by an application service, and the second preset information is information indicating that the first database change instruction is an instruction generated by an application service.

[0043] Specifically, in the preset synchronization policy, the identity information of each end in the multi-end communication system is stored, that is, it is possible to determine whether any end in the multi-end communication system is the data source end by querying the preset synchronization policy.

[0044] However, since querying the preset synchronization policy also requires an additional step of accessing the module storing the preset synchronization policy, the time required to query the preset synchronization policy is relatively long. In situations such as peak hours of subway operation, it will cause a large delay in database synchronization.

[0045] Therefore, information indicating the identity of this end is preset in the first database change instruction, that is, when generating the first database change instruction, information indicating the identity of this end is also synchronously generated in the instruction, and only when it is impossible to confirm whether this end is the data source end based on the first database change instruction, will it be determined whether this end is the data source end according to the preset synchronization policy.

[0046] Specifically, in order to determine whether this end is the data source end according to the first database change instruction, it is necessary to set that when generating the first database change instruction, the first preset information or the second preset information is also included in the instruction.

[0047] The above-mentioned first preset information is information indicating that the first database change instruction is not an instruction generated by an application service, and the second preset information is information indicating that the first database change instruction is an instruction generated by an application service.

[0048] If the first database change instruction contains the first preset information, confirm that the local end is the data source end. If the first database change instruction contains the second preset information, it means that it is impossible to determine whether the local end is the data source end based on the first database change instruction. At this time, it is necessary to determine whether the local end is the data source end according to the preset synchronization policy.

[0049] That is to say, when generating the first database change instruction, it is also necessary to include the information of the instruction generator in the instruction.

[0050] Among them, when the above first database change instruction contains the second preset information, that is, in the first database change instruction, it contains information such as "generated by application service operation", it means that the first database change instruction is generated by the application service configured on the local end. Since the application service is user-oriented, it means that the user performs data operations on the local end to generate the first database change instruction.

[0051] At this time, since it is impossible to determine the identity of the local end based on the first database change instruction, it is necessary to query the preset synchronization policy. When the local end is the data source end in the preset synchronization policy, determine that the local end is the data source end. When the local end is not the data source end in the preset synchronization policy, determine that the local end is not the data source end.

[0052] When the above first database change instruction contains the first preset information, that is, in the first database change instruction, it contains information such as "not generated by application service operation", it means that the first database change instruction is not generated by the application service configured on the local end, but is generated by software such as data synchronization software configured on the local end according to instructions sent by other ends.

[0053] At this time, since the target receiving end will not generate new instructions that need to be sent to other ends based on the received instructions, only the data source end will generate new instructions that need to be sent to other ends. Therefore, when the first database change instruction contains the first preset information, it can be directly confirmed that the local end is the data source end.

[0054] Thus, it is possible to improve the speed of database synchronization and ensure the stability of database synchronization. In some embodiments of the present invention, when the local end is not the data source end, the method further includes: generating a third database change instruction according to the first database change instruction, determining the data source end according to the preset synchronization policy, and sending the third database change instruction to the data source end, so that the data source end changes the database of the data source end according to the third database change instruction, generating a fourth database change instruction according to the third database change instruction, and sending the fourth database change instruction to the target receiving end to achieve database synchronization, where the target receiving end includes the local end.

[0055] Specifically, if it is determined that the local end is not the data source end, it indicates that the user has generated a first database change instruction through the application service configured on the local end, and the local end is not the pre-configured end for initiating database synchronization, but the target receiving end to be synchronized. At this time, the local end will not change its local database due to the data operations performed by the user on the local end. Instead, it will generate a third database change instruction based on the first database change instruction, determine the data source end according to the preset synchronization policy, and send the third database change instruction to the data source end.

[0056] After receiving the third database change instruction, the data source end will change its local database according to the third database change instruction, generate a fourth database change instruction based on the third database change instruction, and send the fourth database change instruction to all target receiving ends including the local end. At this time, all target receiving ends including the local end will change their local databases according to the fourth database change instruction.

[0057] As an example, assume a multi-end communication system that includes a center and three preset stations, namely Station 1, Station 2, and Station 3, and the preset synchronization policy is pre-configured in the system. At this time, assume that the user has performed data operations on the database at Station 1. The application service facing the user configured on Station 1 will generate data operation information according to the data operations performed by the user, and generate a first database change instruction based on the data operation information.

[0058] After generating the first database change instruction, Station 1 needs to first determine whether it is the data source end itself. When Station 1 determines that it is not the data source end, Station 1 queries the preset synchronization policy to determine the data source end. Assume the data source end is Station 2.

[0059] After determining that the data source end is Station 2, Station 1 will generate a third database change instruction based on the first database change instruction and send the third database change instruction to Station 2.

[0060] After receiving the third database change instruction, since Station 2 is the data source end, Station 2 will change its local database according to the third database change instruction, generate a fourth database change instruction based on the third database change instruction, and send the fourth database change instruction to Station 1, Station 3, and the center. Moreover, since Station 2 is not the data source end, it can also be set that after generating the fourth database change instruction, Station 2 first changes the database of the data source end (i.e., Station 1) according to the fourth database change instruction, and then operates on other target databases, so as to achieve fast synchronization of the matters at the end operated by the user.

[0061] That is to say, when the local end is not the data source end, even if the user performs data operations on the local end, the local end will not change the local database according to the user's data operation information. Instead, a first database change instruction is generated according to the user's data operation information, and a third database change instruction is generated according to the first database change instruction, and the third database change instruction is sent to the data source end, so that all target receiving ends including the local end perform database synchronization under the control of the data source end.

[0062] Thus, it can be realized that all database changes of all ends including the local end that generates the first database change instruction in the multi-end communication system are uniformly controlled and executed by the data source end, thereby further avoiding database synchronization errors when the database is frequently operated.

[0063] In some embodiments of the present invention, before sending the third database change instruction to the data source end, the method further includes: obtaining the survival state of the main server of the data source end, and sending the third database change instruction to the data source end when the survival state is alive, where the main server is the server that communicates with the local end among the servers of the data source end.

[0064] In some embodiments of the present invention, changing the local database according to the first database change instruction includes: obtaining the current state of the remote dictionary server of the local end, and changing the local database when the current state is alive.

[0065] Specifically, after the first database change instruction is generated at the local end, if the local end is the data source end, the local end needs to change the database configured by itself according to the first database change instruction.

[0066] Before the change, the local end first obtains the current state of the remote dictionary server configured by itself, and only when the remote dictionary server configured by the local end is valid, changes the database configured by the local end according to the first database change instruction. Thus, the effectiveness and reliability of database changes can be ensured.

[0067] In some embodiments of the present invention, when the first database change instruction contains first preset information, before changing the local database according to the first database change instruction, the method further includes: judging whether there is an abnormal synchronization state between the local end and the data source end, where the data source end is the end that generates the data operation information in the first database change instruction according to the application service configured thereon; when there is no abnormal synchronization state, judging whether the database connection state between the local end and the data source end is normal, and changing the local database when the database connection state is normal.

[0068] Specifically, when the first database change instruction contains the first preset information, it indicates that the local end is the data source end, and this first database change instruction is an instruction generated based on the change instruction sent by other ends to the local end. Obviously, the end that sends the change instruction to the local end is the above-mentioned data source end.

[0069] At this time, the local end needs to first determine whether there is an abnormal synchronization state between itself and the data source end. This abnormal synchronization state refers to an abnormal synchronization state between the local end and the data source end. For example, if there has been an abnormal synchronization event between the local end and the data source end in history, and until the local end receives the change instruction sent by the data source end, this abnormal synchronization event has not been properly handled by the maintenance personnel, then it can be confirmed that there is an abnormal synchronization state between the local end and the data source end.

[0070] Moreover, a memory that can store the abnormal synchronization state can also be set at the local end. For example, a remote dictionary server can be directly used. At this time, if there has been an abnormal synchronization event between the local end and the data source end in history, an abnormal synchronization state can be generated according to this abnormal synchronization event, and this abnormal synchronization state can be stored in the remote dictionary server, and the abnormal synchronization state can be removed from the remote dictionary server after this abnormal synchronization is processed. When the local end receives the change instruction sent by the data source end, query the remote dictionary server to determine whether there is an abnormal synchronization state between the local end and the data source end.

[0071] The above-mentioned data source end refers to the end that generates the data operation information in the first database change instruction in a multi-end communication system.

[0072] Next, a relationship between the data source end and the data source end will be described with an example.

[0073] Suppose a multi-end communication system that includes a center and a station, and the station is the data source end, and the local end is the data source end. At this time, if a user performs a data operation at the center, the application service at the center obtains the database name, database table name, and SQL statement indicating what specific operation to perform based on the user's data operation. Then, a change instruction sent to the local end is generated by combining the database name, database table name, SQL statement, and the fact that it is an operation of the application service. At this time, the data operation information includes the above SQL statement.

[0074] After receiving this change instruction, the local end generates a first database change instruction according to this change instruction. This first database change instruction includes the database name, database table name, SQL statement, and the fact that it is not an operation of the application service.

[0075] At this time, although the first database change information is generated locally, the SQL statements in the first database change information are generated by the application service at the center, that is, the data source end is the center.

[0076] Therefore, in this example, the data source end is the station, and the data source is the center.

[0077] That is to say, when the local end receives the change instruction sent by the data source end, the local end first determines whether the synchronization status with the data source end is normal. If it is normal, then it further determines whether the connection between the local end and the data source end is normal. If it is also normal, it determines that the change instruction sent by the data source end to the local end is trustworthy, and then changes the local database according to the change instruction.

[0078] In some embodiments of the present invention, the number of target receiving ends is at least two. When the first database change instruction contains the first preset information, sending the second database change instruction to the target receiving ends includes: determining the data source end among the target receiving ends according to the preset synchronization policy, and sending the second database change instruction to the data source end; sending the second database change instruction to other target receiving ends except the data source end.

[0079] Specifically, when the first database change instruction generated by the local end contains the first preset information, it indicates that the local end is the data source end and the user performs data operations on other ends.

[0080] At this time, after the local end receives the change instruction sent by the data source end where the user performs data operations, it generates the first database change instruction according to the change instruction, changes the local database according to the first database change instruction, and after changing the local database, generates the second database change instruction according to the first database change instruction.

[0081] After generating the second database change instruction, the local end first sends the second database change instruction to the data source end so that the data source end can change its own database according to the second database change instruction.

[0082] After sending the second database change instruction to the data source end, the local end then sends the second database change instruction to other target receiving ends except the data source end.

[0083] Thus, by first sending the second database change instruction to the data source end, it is possible to avoid database synchronization errors when frequently operating on the database while ensuring the user experience. Specifically, after the user performs data operations at the data source end, the application service at the data source end generates a change instruction and sends the change instruction to this end. After receiving the change instruction, this end generates a second database change instruction according to the change instruction and sends the second database change instruction to each target receiving end. When sending the second database change instruction, the second database change instruction is preferentially sent to the data source end so that the data source end can preferentially change the database at the data source end according to the second database change instruction. Furthermore, the application service at the data source end can provide feedback to the user based on the changed database. Thus, on the premise that the database changes of all ends in the multi-end communication system are uniformly managed by the data source end, feedback information can be given to the user at the fastest speed, thereby ensuring the user experience.

[0084] The following combines Figure 2 to illustrate the relationship between the data source end and the data source side. In Figure 2 this end is the data source side.

[0085] S101, the application service sends data to the data collection module at the data source end, and the data collection module receives the data and submits the data to the data synchronization policy module.

[0086] Among them, the data sent by the application service to the data collection module is the first database change instruction, including the data operation information SQL statement and other necessary information. The other necessary information includes the database name, database table name, and is operated by the application service.

[0087] S102, the data synchronization policy module at the data source end determines that the data source end is the data source side.

[0088] Among them, if it is determined that the data source end is not the data source side, that is, this end is not the data source side, then this end needs to generate a third database change instruction according to the first database change instruction and send the third database change instruction to the data source end. Since the first database change instruction at this time includes the database name, database table name, SQL statement, and is not operated by the application service, the third database change instruction includes the database name, database table name, SQL statement, is not operated by the application service, and the source end address.

[0089] S103, the data synchronization module at the data source end stores the data in the database at the data source end according to the preset synchronization policy and starts a subtask to store the data in the databases of all target receiving ends.

[0090] Among them, when the data source end is the data source, the specific working process of the data source end can be referred to Figure 3 .

[0091] It should be noted that the data synchronization module can also actively detect the synchronization status and actively discover and remind the application service of abnormal situations.

[0092] S201. The application service accesses the data collection module at the data source end, and the data collection module receives the data and transfers it to the data synchronization policy module.

[0093] S202. If the data synchronization policy module determines that the data source end is the data source, the data source end determines the strategy for database synchronization operations.

[0094] S203. The data synchronization policy module returns the detailed information of the synchronization operation policy result to the application service.

[0095] S204. The data synchronization module operates on the database at the data source end.

[0096] S205. The data synchronization measurement module starts asynchronous subtasks to concurrently operate on the databases of each target receiving end.

[0097] When the data source end is not the data source, the specific working process can be referred to Figure 4 , in Figure 4 , S301 and S302 are operations performed at the data source end, and S303 to S307 are operations performed at the data source.

[0098] S301. The application service accesses the data receiving module at the data source end, and the data receiving module receives the data and transfers it to the data synchronization policy module.

[0099] S302. If the data synchronization policy module at the data source end determines that the data source end is not the data source, it forwards the data to the data source for database synchronization operations.

[0100] S303. The data receiving module in the data synchronization software at the data source receives the data.

[0101] S304. The data synchronization policy module at the data source determines that itself is the data source.

[0102] S305. The data synchronization operation module at the data source operates on the database at the data source.

[0103] S306. The data synchronization module at the data source operates on the database at the data source end and returns the operation result layer by layer to the application service at the data source end.

[0104] S307, the data synchronization module at the data source end enables asynchronous subtask concurrent operations on the databases of other target receivers except the data source end.

[0105] S104, the data synchronization module returns the synchronization result information layer by layer to the data synchronization policy module and the data collection module, and finally returns it to the application service.

[0106] In some embodiments of the present invention, when the local end fails to send the second database change instruction to the target receiver, the method further includes: storing the failure information in the local remote dictionary server.

[0107] Specifically, when the local end fails to send the second database change instruction to a certain target receiver, it indicates that there is an abnormal synchronization state between the local end and the target receiver. Therefore, the local end needs to store the failure information as abnormal synchronization state information in the local remote dictionary server.

[0108] The following is described in conjunction with Figure 5 the examples shown.

[0109] S401, start.

[0110] S402, is it a call from the application service?

[0111] Specifically, the software configured at the local end for database synchronization provides an API interface, which can receive data operations performed by the application service and data operations performed by the data source end. When the local end performs an operation on the data, if the user calls the application service to generate the data operation information, step S403 is executed; if not, step S418 is executed.

[0112] S403, the source end application service performs add, delete, and modify database operations.

[0113] Specifically, when the user calls the application service to generate the data operation information, it indicates that the local end is the data source end, and the application service at the data source end generates the data operation information and performs add, delete, and modify database operations.

[0114] S404, is there a synchronization configuration?

[0115] Specifically, when the application service at the local end performs add, delete, and modify database operations, the software configured on the local end will intercept the operation and determine whether there is a synchronization configuration, that is, determine whether there is a preset synchronization policy related to the local end.

[0116] S405, according to the synchronization policy, is it the source?

[0117] Specifically, if there is a preset synchronization policy related to the local end, it is determined whether the local end is the data source end according to the preset synchronization policy. If the local end is the data source end, step S406 is executed; if the local end is not the data source end, step S413 is executed.

[0118] S406, Is the local Redis (Remote Dictionary Server) alive?

[0119] Specifically, after determining that the local end is the data source end, it is first determined whether the Remote Dictionary Server configured by the local end is alive. If it is alive, step S407 is executed; if it is not alive, step S411 is executed.

[0120] S407, Is the local database stored successfully?

[0121] Specifically, if the Remote Dictionary Server configured by the local end is alive, a first database change instruction is generated according to the data operation information, and the database of the local end is changed according to the first database change instruction.

[0122] S408, If it is not an application service access, store the data in the source end database first.

[0123] Specifically, if the local end is the data source end and not the data source side, a second database change instruction is first generated according to the first database change instruction, and the second database change instruction is sent to the data source end so that the data source end changes its own database according to the second database change instruction.

[0124] S409, Asynchronously start a sub-task to store in the target database.

[0125] Specifically, the local end determines the target receiving end according to the preset synchronization policy to send the second database change instruction to the database of the target receiving end (i.e., the above-mentioned target database).

[0126] S410, Is the target database stored successfully?

[0127] S411, Return the operation database exception or success information.

[0128] S412, Write the synchronization exception information into the local Redis.

[0129] Specifically, when the local end fails to send the second database change instruction to the target receiving end, the local end writes the abnormal synchronization status as the synchronization exception information into the Remote Dictionary Server configured by the local end.

[0130] S413, Obtain the data source end main node according to the active heartbeat detection.

[0131] Specifically, when the local end is not the data source end, the local end obtains the survival status of the master node of the data source end through active heartbeat detection.

[0132] S414, Is the source master alive?

[0133] Specifically, after the local end obtains the survival status of the master node of the data source end, it determines whether the master node of the data source end is alive.

[0134] S415, Access the synchronization software of the source end master node.

[0135] Specifically, when the master node of the data source end is alive, the local end sends the third database change instruction to the data source end, thereby realizing access to the synchronization software of the source end master node, and this synchronization software is the above-mentioned data synchronization software configured at the data source end.

[0136] S416, Wait for the synchronization result from the data source end and return (default 60s).

[0137] Specifically, after accessing the synchronization software of the source end master node, wait for the synchronization result returned by the data source end, and the timeout for this step is default 60s.

[0138] S417, Return operation database exception, timeout or success information.

[0139] S418, Receive the synchronization data from the source end.

[0140] Specifically, when the data operation information is not generated by the user calling the application service, it means that the local end is not the data source end, and the local end receives the change instruction sent by the data source end to realize receiving the synchronization data from the data source end.

[0141] S419, Judge the abnormal synchronization status to the source end database in the local Redis.

[0142] Specifically, after receiving the synchronization data sent by the data source end, first judge whether there is an abnormal synchronization status associated with the data source end in the remote dictionary server configured by the local end.

[0143] S420, Is the synchronization normal?

[0144] Specifically, if there is no abnormal synchronization status associated with the data source end, it is judged that the synchronization status between the local end and the data source end is normal.

[0145] S421, Is the connection to the source database normal?

[0146] Specifically, when the synchronization status between the local end and the data source end is normal, it is judged whether the connection between the databases of the local end and the data source end is normal.

[0147] S422, End.

[0148] In summary, for the database synchronization method of the multi-terminal communication system according to the embodiments of the present invention, a first database change instruction of the local end is obtained; it is determined whether the first database change instruction is an instruction generated by an application service, and based on the determination result, it is determined whether the local end is a data source end, where the data source end is the end that initiates database synchronization in a preset multi-terminal communication system; when the local end is the data source end, the database of the local end is changed according to the first database change instruction, a second database change instruction is generated according to the first database change instruction, and a target receiving end is determined according to a preset synchronization policy; the second database change instruction is sent to the target receiving end so that the target receiving end changes the database of the target receiving end according to the second database change instruction to achieve database synchronization. That is to say, by executing database synchronization in the multi-terminal communication system through a pre-configured data source end, unified management of database synchronization can be achieved, thereby avoiding database synchronization errors when the database is frequently operated. Moreover, in the deployment and research and development stages, only the software for database synchronization and the remote dictionary server need to be deployed, reducing the deployment complexity and dependence on hardware resources. At the same time, the status of the database cluster and synchronization software can be monitored in real time, providing more exception information for the upper-layer application service and giving early warnings.

[0149] Furthermore, the present invention proposes an electronic device.

[0150] Figure 6 It is a structural block diagram of the electronic device according to the embodiments of the present invention.

[0151] As Figure 6 shown, the electronic device 500 includes: a processor 501 and a memory 503. Among them, the processor 501 and the memory 503 are connected, such as through a bus 502. Optionally, the electronic device 500 may further include a transceiver 504. It should be noted that in actual applications, the transceiver 504 is not limited to one, and the structure of the thermal management controller 500 does not constitute a limitation to the embodiments of the present invention.

[0152] The processor 501 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in connection with the disclosure of the present invention. The processor 501 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0153] The bus 502 may include a path for transmitting information between the above components. The bus 502 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 502 may be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 5 only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.

[0154] The memory 503 is used to store a computer program corresponding to the database synchronization method of the multi-terminal communication system in the foregoing embodiments of the present invention, and the computer program is controlled and executed by the processor 501. The processor 501 is used to execute the computer program stored in the memory 503 to implement the content shown in the foregoing method embodiments.

[0155] Among them, Figure 6 the illustrated electronic device 500 is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0156] The electronic device according to the embodiment of the present invention obtains a first database change instruction of the local end by implementing the database synchronization method of the above multi-terminal communication system; determines whether the first database change instruction is an instruction generated by an application service, and determines whether the local end is a data source end according to the judgment result, where the data source end is the end that initiates database synchronization in the preset multi-terminal communication system; when the local end is the data source end, changes the database of the local end according to the first database change instruction, generates a second database change instruction according to the first database change instruction, and determines a target receiving end according to a preset synchronization policy; sends the second database change instruction to the target receiving end, so that the target receiving end changes the database of the target receiving end according to the second database change instruction, realizing database synchronization. That is to say, by performing database synchronization in the multi-terminal communication system through a pre-configured data source end, unified management of database synchronization can be achieved, thereby avoiding database synchronization errors when the database is frequently operated. Moreover, in the deployment and R & D stages, only the software for database synchronization and the remote dictionary server need to be deployed, reducing the deployment complexity and dependence on hardware resources. At the same time, the status of the database cluster and the synchronization software can be monitored in real time, providing more exception information for the upper-layer application service and giving early warnings.

[0157] Furthermore, the present invention proposes a multi-terminal communication system.

[0158] In the embodiment of the present invention, each end in the multi-terminal communication system includes the above-mentioned electronic device 500.

[0159] The multi-terminal communication system according to the embodiment of the present invention obtains a first database change instruction of the local end through the above-mentioned electronic device; determines whether the first database change instruction is an instruction generated by an application service, and determines whether the local end is a data source end according to the judgment result, where the data source end is the end that initiates database synchronization in the preset multi-terminal communication system; when the local end is the data source end, changes the database of the local end according to the first database change instruction, generates a second database change instruction according to the first database change instruction, and determines a target receiving end according to a preset synchronization policy; sends the second database change instruction to the target receiving end, so that the target receiving end changes the database of the target receiving end according to the second database change instruction, realizing database synchronization. That is to say, by performing database synchronization in the multi-terminal communication system through a pre-configured data source end, unified management of database synchronization can be achieved, thereby avoiding database synchronization errors when the database is frequently operated. Moreover, in the deployment and R & D stages, only the software for database synchronization and the remote dictionary server need to be deployed, reducing the deployment complexity and dependence on hardware resources. At the same time, the status of the database cluster and the synchronization software can be monitored in real time, providing more exception information for the upper-layer application service and giving early warnings.

[0160] It should be noted that the logic and / or steps represented in the flowchart or described otherwise herein can be considered as a definite sequence list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other systems that can fetch instructions from the instruction execution system, apparatus or device and execute the instructions), or used in combination with these instruction execution systems, apparatuses or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection part with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation or, if necessary, other suitable processing, and then stored in a computer memory.

[0161] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0162] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0163] In the description of this specification, the orientation or positional relationship indicated by the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. is based on the orientation or positional relationship shown in the drawings, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and should not be construed as a limitation on the present invention.

[0164] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically defined.

[0165] In the description of this specification, unless otherwise stated, the terms "mounted", "connected", "coupled", "fixed", etc. should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or integrated; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal communication of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0166] In the present invention, unless otherwise clearly specified and limited, the first feature being "on" or "under" the second feature may be that the first and second features are in direct contact, or the first and second features are indirectly in contact through an intermediate medium. Moreover, the first feature being "above", "over" and "on top of" the second feature may be that the first feature is directly above or obliquely above the second feature, or merely indicates that the first feature has a higher horizontal height than the second feature. The first feature being "under", "beneath" and "underneath" the second feature may be that the first feature is directly below or obliquely below the second feature, or merely indicates that the first feature has a lower horizontal height than the second feature.

[0167] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as a limitation on the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A database synchronization method for a multi-terminal communication system, characterized in that, Each end in the multi - end communication system is configured with a database. For any end in the multi - end communication system, which is denoted as the local end, the method includes: Obtain a first database change instruction of the local end; Determine whether the first database change instruction is an instruction generated by an application service, and based on the determination result, determine whether the local end is a data source end, where the data source end is the end in the preset multi - end communication system that initiates database synchronization; When the local end is the data source end, change the database of the local end according to the first database change instruction, generate a second database change instruction according to the first database change instruction, and determine a target receiving end according to a preset synchronization policy; Send the second database change instruction to the target receiving end, so that the target receiving end changes the database of the target receiving end according to the second database change instruction to achieve database synchronization.

2. The database synchronization method of the multi-terminal communication system according to claim 1, characterized in that The determining whether the first database change instruction is an instruction generated by an application service and based on the determination result determining whether the local end is a data source end includes: When the first database change instruction contains first preset information, determine that the local end is the data source end; When the first database change instruction contains second preset information, determine whether the local end is a data source end according to the preset synchronization policy; Among them, the first preset information is information indicating that the first database change instruction is not generated by an application service, and the second preset information is information indicating that the first database change instruction is generated by an application service.

3. The database synchronization method of the multi-terminal communication system according to claim 2, characterized in that, When the local end is not the data source end, the method further includes: Generate a third database change instruction according to the first database change instruction, determine the data source end according to the preset synchronization policy, and send the third database change instruction to the data source end, so that the data source end changes the database of the data source end according to the third database change instruction, generates a fourth database change instruction according to the third database change instruction, and sends the fourth database change instruction to the target receiving end to achieve database synchronization, where the target receiving end includes the local end.

4. The database synchronization method of the multi-terminal communication system according to claim 3, characterized in that Before sending the third database change instruction to the data source end, the method further includes: Obtain the survival status of the main server of the data source end to send the third database change instruction to the data source end when the survival status is alive, where the main server is the server in the data source end that communicates with the local end.

5. The database synchronization method of the multi-terminal communication system according to claim 1, characterized in that, The changing the database of the local end according to the first database change instruction includes: Obtain the current status of the remote dictionary server of the local end and change the database of the local end when the current status is alive.

6. The database synchronization method of the multi-terminal communication system according to claim 2, characterized in that, When the first database change instruction contains the first preset information, before changing the database of the local end according to the first database change instruction, the method further includes: Determine whether there is an abnormal synchronization state between the local end and the data source end, where the data source end is the end in the multi-end communication system that generates the data operation information in the first database change instruction according to the application service configured thereon; When there is no such abnormal synchronization state, determine whether the database connection state between the local end and the data source end is normal, so as to change the database of the local end when the database connection state is normal.

7. The database synchronization method of the multi-terminal communication system according to claim 2, characterized in that The number of the target receiving ends is at least two. When the first database change instruction contains the first preset information, the sending of the second database change instruction to the target receiving ends includes: Determine the data source end among the target receiving ends according to the preset synchronization policy, and send the second database change instruction to the data source end; Send the second database change instruction to other target receiving ends except the data source end.

8. The database synchronization method of the multi-terminal communication system according to claim 1, characterized in that, When the local end fails to send the second database change instruction to the target receiving end, the method further includes: Store the failure information in the remote dictionary server of the local end.

9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and running on the processor. When the computer program is executed by the processor, it implements the database synchronization method of the multi-end communication system according to any one of claims 1-8.

10. A multi-terminal communication system, characterized in that, Each end in the multi-end communication system includes the electronic device according to claim 9.