Data Synchronization Method, Apparatus, Storage Medium, and Electronic Device
By introducing election management nodes, data nodes and connection proxy nodes in multi-cluster scenarios, the multi-service registration of the service provider and the synchronization of service information between clusters is solved, and the problem of low load balancing efficiency is improved, and data synchronization efficiency and system performance are improved.
Patent Information
- Application Number
- CN202210745080.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-28
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-06-28
AI Technical Summary
In multi-cluster and multi-cluster scenarios, load balancing efficiency is low, resulting in low data synchronization between different server clusters.
By setting up election management nodes, data nodes and connection proxy nodes in each server cluster, multi-service registration of service providers, service information storage and service information synchronization between different clusters, ensuring that service consumers can obtain the required target service information.
It improves the efficiency of data synchronization between different server clusters, reduces unnecessary memory usage and system resource overhead, and improves the overall performance of the system.
Smart Images

Figure CN115134373B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cloud computing, and in particular to a data synchronization method, device, storage medium and electronic device. Background Art
[0002] In the current multi-cluster and multi-computer room scenarios, load balancing in related technologies often requires service consumers to subscribe to multiple clusters at the same time, and implement park priority load through the park ID configured by the consumer. Taking the dubbo framework as an example, the dubbo consumer can subscribe to multiple registration centers at the same time, but needs to configure the park ID of each registration center at the same time. The consumer preferentially loads its request to the provider on the registration center in the same park as itself, but for a single consumer, its park ID is fixed, which means that only when the registration center of the current computer room is completely down and disconnected will it reload the traffic to the provider of other computer rooms. Therefore, most of the time, the provider data subscribed from other computer rooms is useless, but it occupies a large amount of memory of the consumer, and maintaining a large number of connections and heartbeats also requires a large amount of additional io overhead; and the consumer subscribes from another computer room registration center, and the registration center of another computer room must maintain an additional long connection with it, maintain heartbeats, and push provider data, which also adds additional system resource overhead to the registration center, further resulting in low data synchronization efficiency between different server clusters.
[0003] Currently, no effective solution has been proposed to address the problem of low data synchronization efficiency between different server clusters in related technologies. Summary of the invention
[0004] The main purpose of the present application is to provide a data synchronization method, device, storage medium and electronic device to solve the problem of low data synchronization efficiency between different server clusters in the related art.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a data synchronization method is provided. The method is applied to multiple server clusters for registration services, wherein each server cluster includes at least: an election management node, at least one data node, and at least one connection proxy node, and the method also includes: registering multiple services provided by a service provider through a connection proxy node, wherein the multiple services include at least: an interface service; storing service information corresponding to each service in a data node; in different server clusters, synchronizing multiple service information in the data node through an election management node, so that the service consumer obtains the required target service information.
[0006] Further, the multiple services provided by the service provider registered through the connection proxy node include: receiving a service registration request sent by the service provider, where the service registration request is a request for registering multiple services; and in response to the service registration request, registering the multiple services provided by the service provider in the server cluster.
[0007] Further, storing the service information corresponding to each service in the data node includes: calculating the service information corresponding to each service according to the hash algorithm to obtain the service information corresponding to each service; and storing each service information in the data node.
[0008] Further, before synchronizing the multiple service information in the data node through the elected management node in different server clusters, the method further includes: in the current server cluster, receiving a service subscription request sent by the service consumer for subscribing to a target service; and in response to the service subscription request, matching the target service information corresponding to the target service with the multiple service information in the data node to obtain a matching result.
[0009] Further, synchronizing the multiple service information in the data node through the elected management node so that the service consumer can obtain the required target service information includes: if the matching result indicates that the service information in the current server cluster matches the target service information, using the service information in the current server cluster as the target service information required by the service consumer; if the matching result indicates that the multiple service information in the current server cluster does not match the target service information, synchronizing the service subscription request to other server clusters except the current server cluster in the multiple server clusters through the elected management node so that the service consumer can obtain the required target service information.
[0010] Further, synchronizing the service subscription request to other server clusters except the current server cluster in the multiple server clusters through the elected management node so that the service consumer can obtain the required target service information includes: determining the corresponding target data node in other server clusters according to the service subscription request; matching the service information in the target data node with the target service information to obtain a target matching result; and if the target matching result indicates that the service information in other server clusters matches the target service information, using the service information in other server clusters as the target service information required by the service consumer.
[0011] To achieve the above object, according to another aspect of the present application, a data synchronization device is provided. The device is applied to multiple server clusters for registration services. Among them, each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The device further includes: a registration unit, configured to register multiple services provided by a service provider through a connection proxy node, where the multiple services at least include: interface services; a storage unit, configured to store service information corresponding to each service into the data node; a synchronization unit, configured to synchronize multiple service information in the data node through the election management node in different server clusters, so that a service consumer can obtain the required target service information.
[0012] Further, the registration unit includes: a receiving module, configured to receive a service registration request sent by the service provider, where the service registration request is a request for registering multiple services; a response module, configured to respond to the service registration request and register multiple services provided by the service provider in the server cluster.
[0013] Further, the storage unit includes: a calculation module, configured to calculate service parameters of each service according to a hash algorithm to obtain service information corresponding to each service; a storage module, configured to store each service information into the data node.
[0014] Further, the device further includes: a receiving unit, configured to receive a service subscription request for subscribing to a target service sent by the service consumer in the current server cluster before synchronizing multiple service information in the data node through the election management node in different server clusters; a response unit, configured to respond to the service subscription request and match the target service information corresponding to the target service with multiple service information in the data node to obtain a matching result.
[0015] Further, the synchronization unit includes: a determination module, configured to use the service information in the current server cluster as the target service information required by the service consumer if the matching result indicates that the service information in the current server cluster matches the target service information; a synchronization module, configured to synchronize the service subscription request to other server clusters except the current server cluster among multiple server clusters through the election management node if the matching result indicates that the multiple service information in the current server cluster does not match the target service information, so that the service consumer can obtain the required target service information.
[0016] Further, the synchronization module includes: a first determination sub-module, configured to determine a corresponding target data node in other server clusters according to a service subscription request; a matching sub-module, configured to match the service information in the target data node with the target service information to obtain a target matching result; a second determination sub-module, configured to, if the target matching result indicates that the service information in other server clusters matches the target service information, use the service information in other server clusters as the target service information required by the service consumer.
[0017] By means of the present application, the following steps are adopted: The method is applied to multiple server clusters for registering services, where each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The method further includes: registering multiple services provided by a service provider through a connection proxy node, where the multiple services at least include: interface services; storing the service information corresponding to each service in a data node; in different server clusters, synchronizing the multiple service information in the data nodes through an election management node so that a service consumer can obtain the required target service information, thereby solving the problem of low data synchronization efficiency between different server clusters in the related art. By synchronizing the service information in different server clusters through an election management node, the effect of improving the data synchronization efficiency between different server clusters is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0019] Figure 1 is a flowchart of a data synchronization method according to an embodiment of the present application;
[0020] Figure 2 is an operation example diagram of a data synchronization method according to an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a data synchronization device according to an embodiment of the present application;
[0022] Figure 4 is a schematic diagram of a network architecture of a data synchronization electronic device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0024] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so as to implement the embodiments of this application described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0027] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a data synchronization method provided according to an embodiment of this application. As Figure 1 shown, the method includes the following steps:
[0028] Step S101, a data synchronization method, characterized in that it is applied to multiple server clusters for registration services. Among them, each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The method further includes: registering multiple services provided by a service provider through a connection proxy node, where the multiple services at least include: interface services.
[0029] For example, as Figure 2 shown, it includes two server clusters (which can also be a registration center cluster) for registration services, that is Figure 2 cluster 1 and cluster 2 in
[0030] After setting up multiple server clusters, it is necessary to register multiple clusters provided by the service provider in the server clusters. Optionally, in the data synchronization method provided in the embodiments of the present application, registering multiple services provided by the service provider through a connection proxy node includes: receiving a service registration request sent by the service provider, where the service registration request is a request for registering multiple services; and in response to the service registration request, registering multiple services provided by the service provider in the server cluster.
[0031] For example, as Figure 2 shown, when the service provider performs service registration in the server cluster, it randomly selects a connection proxy node to initiate a service registration request. The connection proxy node receives and responds to the service registration request, and registers multiple services provided by the service provider. Through flexible registration of multiple services provided by the service provider in the present application, the subsequent data synchronization efficiency between different server clusters is improved.
[0032] Step S102, store the service information corresponding to each service in a data node.
[0033] Specifically, perform a hash calculation on multiple services registered by the connection proxy node in each server cluster, and save the calculation result to the corresponding data node in the server cluster.
[0034] Optionally, in the data synchronization method provided in the embodiments of the present application, storing the service information corresponding to each service in a data node includes: calculating the service parameters of each service according to a hash algorithm to obtain the service information corresponding to each service; and storing each service information in a data node.
[0035] For example, as Figure 2 shown, the connection proxy node performs a (hash) calculation on the service parameters of multiple services for which registration is initiated to obtain the service information corresponding to each service, and stores it in a hashed manner on the corresponding data node in the same cluster. Among them, the service parameters can be service names, method names, list parameters, etc. By retrieving the service information in multiple data nodes of the server cluster in the present application, the service information corresponding to each service can be quickly found, further improving the data synchronization efficiency between different server clusters.
[0036] Step S103, in different server clusters, synchronize multiple service information in the data nodes through an elected management node, so that the service consumer can obtain the required target service information.
[0037] Specifically, as Figure 2As shown in the figure, the service consumer sends a subscription request for the target service to Cluster 1. If the service information corresponding to the target service does not exist in Cluster 1, the election management node is used to continue querying the service information corresponding to the target service in Cluster 2, so that the service consumer can obtain the required target service information.
[0038] To improve the data query efficiency between different clusters, optionally, in the data synchronization method provided in the embodiments of the present application, before synchronizing multiple service information in the data nodes by the election management node in different server clusters, the method further includes: receiving, in the current server cluster, a service subscription request sent by the service consumer for subscribing to a target service; in response to the service subscription request, matching the target service information corresponding to the target service with multiple service information in the data node to obtain a matching result.
[0039] For example, as Figure 2 shown in the figure, when the service consumer subscribes to a service, it randomly selects a connection proxy node in Cluster 1 to initiate a subscription service request for the target service. The connection proxy node receives and responds to the service subscription request. The connection proxy node calculates the hash of the service information that the service consumer needs to subscribe to and matches it with the corresponding data node in the cluster to obtain a matching result. By calculating the hash of the target service that the service consumer needs to subscribe to and matching the calculation result with the corresponding data node in the cluster, the retrieval efficiency of the target service information corresponding to the target service is improved, and the data synchronization efficiency is further improved.
[0040] Optionally, in the data synchronization method provided in the embodiments of the present application, synchronizing multiple service information in the data nodes by the election management node so that the service consumer can obtain the required target service information includes: if the matching result indicates that the service information in the current server cluster matches the target service information, using the service information in the current server cluster as the target service information required by the service consumer; if the matching result indicates that multiple service information in the current server cluster does not match the target service information, synchronizing the service subscription request to other server clusters except the current server cluster among multiple server clusters through the election management node, so that the service consumer can obtain the required target service information.
[0041] Specifically, as Figure 2 shown in the figure, if the matching result indicates that the target service required by the service consumer does not exist in the service information stored in the data node of the current server cluster, the service subscription request is synchronized and sensed to other clusters through the election management node of the current cluster, further improving the data synchronization efficiency between different server clusters.
[0042] Optionally, in the data synchronization method provided in the embodiments of the present application, the service subscription request is synchronized to other server clusters except the current server cluster among multiple server clusters through the election management node, so that the service consumer can obtain the required target service information, including: determining the corresponding target data node in other server clusters according to the service subscription request; matching the service information in the target data node with the target service information to obtain a target matching result; if the target matching result indicates that the service information in other server clusters matches the target service information, then using the service information in other server clusters as the target service information required by the service consumer.
[0043] Specifically, the connection proxy node is used to perform a hash calculation on the required service information again to find the corresponding target data node of the target service in other clusters (corresponding to the target data node in the present application). If the service information in the target data node matches the target service information corresponding to the service consumer, then the service information in the target data node is used as the target service information required by the service consumer, further improving the data synchronization efficiency between different server clusters.
[0044] In summary, the data synchronization method provided in the embodiments of the present application is applied to multiple server clusters for registering services. Each server cluster includes at least: an election management node, at least one data node, and at least one connection proxy node. The method further includes: registering multiple services provided by the service provider through the connection proxy node, where the multiple services at least include: interface services; storing the service information corresponding to each service in the data node; in different server clusters, synchronizing the multiple service information in the data node through the election management node so that the service consumer can obtain the required target service information, solving the problem of low data synchronization efficiency between different server clusters in the related art. By synchronizing the service information in different server clusters through the election management node, the effect of improving the data synchronization efficiency between different server clusters is achieved.
[0045] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0046] The embodiments of the present application also provide a data synchronization device. It should be noted that the data synchronization device in the embodiments of the present application can be used to execute the data synchronization method provided in the embodiments of the present application. The following introduces the data synchronization device provided in the embodiments of the present application.
[0047] Figure 3It is a schematic diagram of the data synchronization device according to the embodiments of the present application. As Figure 3 shown, the device is applied to multiple server clusters of the registration service. Among them, each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The device further includes: a registration unit 301, a storage unit 302, and a synchronization unit 303.
[0048] Specifically, the registration unit 301 is used to register multiple services provided by the service provider through the connection proxy node. Among them, the multiple services at least include: interface services;
[0049] The storage unit 302 is used to store the service information corresponding to each service into the data node;
[0050] The synchronization unit 303 is used to synchronize multiple service information in the data node through the election management node in different server clusters, so that the service consumer can obtain the required target service information.
[0051] In summary, for the data synchronization device provided by the embodiments of the present application, the registration unit 301 registers multiple services provided by the service provider through the connection proxy node. Among them, the multiple services at least include: interface services; the storage unit 302 stores the service information corresponding to each service into the data node; the synchronization unit 303 synchronizes multiple service information in the data node through the election management node in different server clusters, so that the service consumer can obtain the required target service information, which solves the problem of low data synchronization efficiency between different server clusters in the related art. By synchronizing the service information in different server clusters through the election management node, the effect of improving the data synchronization efficiency between different server clusters is achieved.
[0052] Optionally, in the data synchronization device provided by the embodiments of the present application, the registration unit 301 includes: a receiving module, which is used to receive the service registration request sent by the service provider. Among them, the service registration request is a request for registering multiple services; a response module, which is used to respond to the service registration request and register multiple services provided by the service provider in the server cluster.
[0053] Optionally, in the data synchronization device provided by the embodiments of the present application, the storage unit 302 includes: a calculation module, which is used to calculate the service parameters of each service according to the hash algorithm to obtain the service information corresponding to each service; a storage module, which is used to store each service information into the data node.
[0054] Optionally, in the data synchronization device provided in the embodiments of the present application, the device further includes: a receiving unit, configured to receive a service subscription request for subscribing to a target service sent by a service consumer in the current server cluster before synchronizing multiple service information in data nodes through an elected management node in different server clusters; a response unit, configured to respond to the service subscription request, and match the target service information corresponding to the target service with multiple service information in the data nodes to obtain a matching result.
[0055] Optionally, in the data synchronization device provided in the embodiments of the present application, the synchronization unit 303 includes: a determination module, configured to use the service information in the current server cluster as the target service information required by the service consumer if the matching result indicates that the service information in the current server cluster matches the target service information; a synchronization module, configured to synchronize the service subscription request to other server clusters except the current server cluster among multiple server clusters through an elected management node if the matching result indicates that multiple service information in the current server cluster does not match the target service information, so that the service consumer can obtain the required target service information.
[0056] Optionally, in the data synchronization device provided in the embodiments of the present application, the synchronization module includes: a first determination sub-module, configured to determine a corresponding target data node in other server clusters according to the service subscription request; a matching sub-module, configured to match the service information in the target data node with the target service information to obtain a target matching result; a second determination sub-module, configured to use the service information in other server clusters as the target service information required by the service consumer if the target matching result indicates that the service information in other server clusters matches the target service information.
[0057] The data synchronization device includes a processor and a memory. The above registration unit 301, storage unit 302, synchronization unit 303, etc. are all stored in the memory as program units, and the processor executes the above program units stored in the memory to implement corresponding functions.
[0058] The processor contains a kernel, and the kernel retrieves the corresponding program unit from the memory. One or more kernels can be set, and data synchronization is performed by adjusting kernel parameters.
[0059] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one storage chip.
[0060] The embodiments of the present invention provide a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, a data synchronization method is implemented.
[0061] An embodiment of the present invention provides a processor for running a program, wherein when the program runs, a data synchronization method is executed.
[0062] As Figure 4 shown, an embodiment of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: The method is applied to multiple server clusters for registering services, wherein each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The method further includes: registering multiple services provided by a service provider through a connection proxy node, wherein the multiple services at least include: interface services; storing service information corresponding to each service in a data node; in different server clusters, synchronizing multiple service information in the data node through an election management node so that a service consumer can obtain the required target service information.
[0063] When the processor executes the program, the following steps are further implemented: receiving a service registration request sent by a service provider, wherein the service registration request is a request for registering multiple services; in response to the service registration request, registering multiple services provided by the service provider in the server cluster.
[0064] When the processor executes the program, the following steps are further implemented: calculating service information corresponding to each service according to a hash algorithm; storing each service information in a data node.
[0065] When the processor executes the program, the following steps are further implemented: before synchronizing multiple service information in the data node through an election management node in different server clusters, receiving a service subscription request sent by a service consumer for subscribing to a target service in the current server cluster; in response to the service subscription request, matching the target service information corresponding to the target service with multiple service information in the data node to obtain a matching result.
[0066] When the processor executes the program, the following steps are further implemented: if the matching result indicates that the service information in the current server cluster matches the target service information, using the service information in the current server cluster as the target service information required by the service consumer; if the matching result indicates that the multiple service information in the current server cluster does not match the target service information, synchronizing the service subscription request to other server clusters except the current server cluster in multiple server clusters through an election management node so that the service consumer can obtain the required target service information.
[0067] When the processor executes the program, the following steps are also implemented: determining the corresponding target data node in other server clusters according to the service subscription request; matching the service information in the target data node with the target service information to obtain a target matching result; if the target matching result indicates that the service information in other server clusters matches the target service information, using the service information in other server clusters as the target service information required by the service consumer.
[0068] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0069] This application also provides a computer program product, which, when executed on a data processing device, is adapted to execute a program initialized with the following method steps: registering multiple services provided by a service provider through a connection proxy node, where the multiple services at least include: interface services; storing the service information corresponding to each service in a data node; in different server clusters, synchronizing the multiple service information in the data node through an elected management node so that the service consumer can obtain the required target service information.
[0070] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: receiving a service registration request sent by a service provider, where the service registration request is a request to register multiple services; in response to the service registration request, registering the multiple services provided by the service provider in the server cluster.
[0071] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: calculating the service information corresponding to each service according to the hash algorithm; storing each service information in a data node.
[0072] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: before synchronizing the multiple service information in the data node through an elected management node in different server clusters, receiving a service subscription request for subscribing to a target service sent by a service consumer in the current server cluster; in response to the service subscription request, matching the target service information corresponding to the target service with the multiple service information in the data node to obtain a matching result.
[0073] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: If the matching result indicates that the service information in the current server cluster matches the target service information, then use the service information in the current server cluster as the target service information required by the service consumer; If the matching result indicates that multiple service information in the current server cluster does not match the target service information, then synchronize the service subscription request to other server clusters except the current server cluster among multiple server clusters through the election management node, so that the service consumer can obtain the required target service information.
[0074] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: Determine the corresponding target data node in other server clusters according to the service subscription request; Match the service information in the target data node with the target service information to obtain a target matching result; If the target matching result indicates that the service information in other server clusters matches the target service information, then use the service information in other server clusters as the target service information required by the service consumer.
[0075] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0076] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0077] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions in the process Figure 1 one process or multiple processes and / or blocksFigure 1 The functions specified in one or more boxes.
[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementing the steps of the functions specified in one Figure 1 process or more processes and / or boxes Figure 1 or more boxes.
[0079] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0080] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.
[0081] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0082] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, commodity or device comprising the element.
[0083] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0084] The above are only the embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A data synchronization method, characterized in that, it is applied to multiple server clusters for registration services, where each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node, and the method further includes: registering multiple services provided by a service provider through the connection proxy node, where the multiple services at least include: interface services; storing the service information corresponding to each service into the data node; in different server clusters, synchronizing the multiple service information in the data node through the election management node so that a service consumer can obtain the required target service information. Among them, before synchronizing the multiple service information in the data node through the election management node in different server clusters, in the current server cluster, receiving a service subscription request sent by the service consumer for subscribing to a target service; in response to the service subscription request, and matching the target service information corresponding to the target service with the multiple service information in the data node to obtain a matching result; if the matching result indicates that the service information in the current server cluster matches the target service information, then using the service information in the current server cluster as the target service information required by the service consumer; if the matching result indicates that the multiple service information in the current server cluster does not match the target service information, then synchronizing the service subscription request to other server clusters except the current server cluster among the multiple server clusters through the election management node so that the service consumer can obtain the required target service information; storing the service information corresponding to each service into the data node includes: calculating the service parameters of each service according to a hash algorithm to obtain the service information corresponding to each service; storing each service information into the data node; performing a hash calculation on the target service information subscribed by the service consumer through the connection proxy node, and matching the calculation result with the service information in the data node to obtain the matching result.
2. The method according to claim 1, characterized in that, registering multiple services provided by a service provider through the connection proxy node includes: receiving a service registration request sent by the service provider, where the service registration request is a request for registering the multiple services; in response to the service registration request, and registering multiple services provided by the service provider in the server cluster.
3. The method according to claim 1, characterized in that, synchronizing the service subscription request to other server clusters except the current server cluster among the multiple server clusters through the election management node so that the service consumer can obtain the required target service information includes: determining the corresponding target data node in the other server clusters according to the service subscription request; Match the service information in the target data node with the target service information to obtain a target matching result; If the target matching result indicates that the service information in the other server cluster matches the target service information, then use the service information in the other server cluster as the target service information required by the service consumer.
4. A data synchronization device Characterized in that It is applied to multiple server clusters that register services. Among them, each server cluster at least includes: an election management node, at least one data node, and at least one connection proxy node. The device further includes: A registration unit, configured to register multiple services provided by a service provider through the connection proxy node, where the multiple services at least include: interface services; A storage unit, configured to store the service information corresponding to each service into the data node; where storing the service information corresponding to each service into the data node includes: calculating the service parameters of each service according to a hash algorithm to obtain the service information corresponding to each service; storing each service information into the data node. A synchronization unit, configured to synchronize multiple service information in the data node through the election management node in different server clusters, so that the service consumer can obtain the required target service information; A receiving unit, configured to, in different server clusters, before synchronizing multiple service information in the data node through the election management node, receive a service subscription request for subscribing to a target service sent by the service consumer in the current server cluster; A response unit, configured to respond to the service subscription request, and match the target service information corresponding to the target service with multiple service information in the data node to obtain a matching result; The synchronization unit includes: a determination module, configured to, if the matching result indicates that the service information in the current server cluster matches the target service information, then use the service information in the current server cluster as the target service information required by the service consumer; a synchronization module, configured to, if the matching result indicates that the multiple service information in the current server cluster does not match the target service information, then synchronize the service subscription request to other server clusters except the current server cluster among multiple server clusters through the election management node, so that the service consumer can obtain the required target service information, where a hash calculation is performed on the target service information subscribed by the service consumer through the connection proxy node, and the calculation result is matched with the service information in the data node to obtain the matching result.
5. The device according to claim 4 Characterized in that The registration unit includes: A receiving module, configured to receive a service registration request sent by the service provider, where the service registration request is a request for registering the multiple services; A response module, configured to respond to the service registration request and register multiple services provided by the service provider in the server cluster.
6. A computer-readable storage medium Characterized in that The storage medium stores a program, wherein the program executes the method according to any one of claims 1 to 3.
7. An electronic device, characterized in that it includes one or more processors and a memory, and the memory is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Method, device and system for processing streaming services
CN102137140A
Method of calling server and proxy server
CN109618005A
Cross-cluster service calling method and system
CN114040020A