Dual-active maintenance method based on Zookeeper remote machine room cluster system

By splitting off the large clusters in different places into multiple small clusters in different places, and only registering service instances in the same computer room in Zookeeper, and preferring communication between the same computer room is preferred, the problem of the large cluster registration center in different computer room matching service instances is solved, and the system performance is improved and response time.

CN119449792APending Publication Date: 2025-02-14SHENZHEN LANYOU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310968570.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The registration centers of large clusters in different locations have a high probability of matching business service instances in different computer rooms, resulting in increased network overhead and response time for cross-computer room communication.

Method used

By splitting large clusters in remote locations into multiple small clusters in remote locations, each computer room serves as a cluster, and the service instances are only registered with Zookeeper in the same computer room. Services running in a certain computer room are preferred for communication with service instances in the same computer room. Only when the target service instances in the same computer room are unavailable will the target service instances across computer rooms be selected.

Benefits of technology

This reduces the average response time of the system, improves the overall performance of the system, and solves the problem of the large cluster registration center matching different computer room service instances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449792A_ABST
    Figure CN119449792A_ABST
Patent Text Reader

Abstract

The invention provides an active-active maintenance method based on a Zookeeper remote machine room cluster system. A large cluster crossing machine rooms in different places is divided into a plurality of small clusters in different places, and each machine room is equivalent to an independent and active cluster. Each business service instance is only registered to the Zookeeper of the same machine room, the service running in a certain machine room simultaneously monitors other registered associated business services of the Zookeeper of a plurality of machine rooms, the service instance of the same machine room is preferentially selected during communication and exchange of business message data, and only when the target service instance of the same machine room is not available, the service instance of the same machine room is not available. And selecting cross-machine-room target service instance connection. While the stability of a remote cluster system is met, the problem that business service instances of different machine rooms are matched with a large probability when a registration center of a single remote large cluster is used is solved, and the response performance of the whole system is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distributed system services, and in particular to a method for active-active maintenance of a Zookeeper remote computer room cluster system. Background Art

[0002] In the Internet of Vehicles and traditional Internet backend services, the open source component Zookeeper is widely used in distributed systems. Each instance of each service registers its own IP address and port in Zookeeper. Other services that want to access the service listen to Zookeeper to find out which instances of the service are currently running, and then select one of the instances to communicate with it and exchange messages to process data. In this way, even if a service instance crashes due to an exception, other services can still find another instance through Zookeeper to communicate and continue to process business, thereby improving the reliability and robustness of the entire system.

[0003] It can be seen that the key is that Zookeeper, as the registration center, must have high reliability. Zookeeper is used for distributed middleware, and its software quality has been tested by market practice. Zookeeper itself also ensures high availability through multi-node clusters. However, if all nodes of the Zookeeper cluster are deployed in the same computer room, there will be no resistance to physical disasters that may occur occasionally in the computer room. Therefore, the industry has expanded to the deployment and application of clusters in remote computer rooms. Whether it is business services or Zookeeper registration centers, the resistance to remote disaster recovery can be improved by adding remote clusters.

[0004] However, remote clusters bring greater complexity and challenges to distributed systems. For example, service communications between remote data centers will definitely increase network overhead and increase business processing response time. Summary of the invention

[0005] In view of this, the purpose of the implementation of the present invention is to provide multiple small clusters of remote computer rooms, arrange the communication between business services in the nodes of the same computer room as much as possible, and select the target service instance across computer rooms for connection when the target service instances in the same computer room are not available, thereby reducing the average response time of the system and improving the overall performance of the system.

[0006] A first aspect of the present invention provides a method for active-active maintenance of a Zookeeper remote computer room cluster system, wherein the system includes a remote first computer room and a remote second computer room; the method includes:

[0007] Start the first service located in the first computer room and the third service located in the second computer room respectively, and register the first service with the Zookeeper component of the first computer room, and register the third service with the Zookeeper component of the second computer room; the first service and the third service belong to the same type of services and implement the same business functions;

[0008] Start the second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business needs of the second service, it needs to collaborate with the first or third service, and based on the monitoring of the second service, discover the first instance list of the first service registered in the first computer room, and the third instance list of the third service registered in the second computer room; the second service is used to collaborate with the first service or the third service to complete the business function;

[0009] The second service starts to select and communicate with the first service located in the same first computer room, and sends the relevant business data to the first service in the first instance list;

[0010] In response to the second service monitoring that the first service is offline, the connection with the first service is disconnected. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to implement a backup connection.

[0011] Preferably, registering the first service with the Zookeeper component of the first computer room and registering the third service with the Zookeeper component of the second computer room includes:

[0012] The first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively. A node will be established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively to represent the first service and the third service; the service attribute data includes the service IP and port.

[0013] Preferably, a TCP connection is pre-established between the second service and the first service, and between the second service and the third service;

[0014] The first instance list of the first service registered in the first computer room and monitored based on the second service includes:

[0015] If the second service finds that the first instance list in the same computer room is not empty, the connection with the first service is available, and when processing the business, the data request packet is sent to the first service.

[0016] Preferably, in response to the second service monitoring that the first service is offline, disconnecting from the first service includes:

[0017] If the first service is offline, the Zookeeper component of the first computer room removes the first service and notifies the second service that monitors the first service;

[0018] The second service senses that the first service is offline and disconnects from the first service.

[0019] Preferably, the second service requests the third service, sends the data request packet to the third instance list, and implements the standby connection. After that, the method further includes:

[0020] If the first service of the first computer room returns to normal, re-register the first service to the Zookeeper component of the first computer room;

[0021] The Zookeeper component of the first computer room notifies the second service, and the second service re-establishes the connection with the first service; during the next business data processing, the second service is restored to request the first service, and the data request packet is sent to the first instance list.

[0022] In addition, a second aspect of the present invention provides a service active-active maintenance device, which is applied to a remote computer room cluster system based on Zookeeper, wherein the system includes a remote first computer room and a remote second computer room, and the device includes a registration module, a monitoring module, a communication module, and a service connection module; wherein:

[0023] A registration module, used to respectively start a first service located in a first computer room and a third service located in a second computer room, and register the first service with the Zookeeper component of the first computer room, and register the third service with the Zookeeper component of the second computer room; the first service and the third service belong to the same type of services and implement the same business functions;

[0024] A monitoring module, used to start a second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business requirements of the second service, it needs to collaborate with the first or third service, and based on the monitoring of the second service, a first instance list of the first service registered in the first computer room and a third instance list of the third service registered in the second computer room are discovered; the second service is used to collaborate with the first service or the third service to complete the business function;

[0025] A communication module, configured to start selecting, according to the second service, to perform business communication with the first service located in the same first computer room, and send relevant business data to the first service in the first instance list;

[0026] The service connection module is used to disconnect from the first service in response to the second service monitoring that the first service is offline. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to achieve a backup connection.

[0027] Preferably, in the registration module, the first service is registered with the Zookeeper component of the first computer room, and the third service is registered with the Zookeeper component of the second computer room, including: the first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively, and a node is established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room to represent the first service and the third service respectively; the service attribute data includes service IP and port.

[0028] Preferably, the device also includes a recovery module, which is used to re-register the first service to the Zookeeper component of the first computer room when the first service of the first computer room returns to normal; notify the second service through the Zookeeper component of the first computer room, and the second service re-establishes the connection with the first service; when the next business data is processed, resume requesting the first service and send the data request packet to the first instance list.

[0029] In addition, the third aspect of the present invention provides an electronic device, which includes: one or more processors, and a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes method steps for executing the above-mentioned Zookeeper-based active-active maintenance of a remote computer room cluster system.

[0030] In addition, the fourth aspect of the present invention provides a storage medium storing a computer program; the program is loaded and executed by a processor to implement the method steps for active-active maintenance of a Zookeeper remote computer room cluster system as described above.

[0031] In the scheme of the present invention, a first service located in a first computer room and a third service located in a second computer room are started respectively, and the first service is registered with the Zookeeper component of the first computer room, and the third service is registered with the Zookeeper component of the second computer room; the second service located in the first computer room is started, and the second service is registered with the Zookeeper component of the first computer room; based on the second service, a first instance list of the first service registered in the first computer room and a third instance list of the third service registered in the second computer room are monitored and discovered; in response to the second service monitoring that the first service is offline, the connection with the first service is disconnected, and when the next business data is processed, the second service requests the third service and sends the data request packet to the third instance list to realize a backup connection. Compared with the existing technology, a large cluster across remote computer rooms is split into several small clusters in different locations. Each computer room is equivalent to a cluster, and the service instance is only registered with the Zookeeper in the same computer room. The service running in a certain computer room will monitor the registered services of Zookeeper in multiple computer rooms at the same time, and give priority to the service instance in the same computer room when communicating and exchanging business message data. Only when the target service instance in the same computer room is unavailable, the target service instance across computer rooms will be selected for connection, which solves the problem that the registration center of the large cluster in different locations has a high probability of matching business service instances in different computer rooms. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 This is a schematic diagram of a prior art remote cluster structure according to an embodiment of the present invention;

[0034] Figure 2 It is a schematic diagram of a splitting solution for multiple clusters in different locations disclosed in an embodiment of the present invention;

[0035] Figure 3 It is a flow chart of a method for active-active maintenance of a Zookeeper remote computer room cluster system disclosed in an embodiment of the present invention;

[0036] Figure 4 It is a schematic diagram of a detailed explanation of the registration discovery communication sequence of multiple clusters in different locations disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0038] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0039] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0040] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0041] It should be noted that the “plurality” mentioned in this article refers to two or more.

[0042] Glossary of terms for this embodiment:

[0043] Zookeeper: ZooKeeper is a distributed, open source distributed application coordination service. It is an open source implementation of Google's Chubby and an important component of Hadoop and Hbase. It is a software that provides consistency services for distributed applications. The functions it provides include: configuration maintenance, domain name services, distributed synchronization, group services, etc.

[0044] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0045] The main problem with large clusters in different regions is that each service instance cannot identify the physical region where it is located. Any algorithm that discovers services through the Zookeeper registry will inevitably bridge services in different regional data centers during normal operation, wasting unnecessary network communication and performance.

[0046] Some conventional Internet products may not need to consider the expansion of remote clusters. However, due to the pursuit of timeliness and security, the Internet of Vehicles has a greater urgency for remote multi-clustering. A simple method commonly used now is to deploy different nodes of the business service and registration center clusters in computer rooms in different cities to form a large cluster. The registration and discovery of business services are achieved through this registration center. When one city fails due to force majeure, the nodes in the computer rooms of other cities can continue to provide services.

[0047] like Figure 1 The figure shows a schematic diagram of the existing remote cluster structure. It is assumed that the service nodes are mainly deployed in computer rooms in two cities or regions, which are temporarily named X and Y. The registration center Zookeeper cluster also deploys some nodes in computer rooms X and Y. In addition, the registration center may also deploy some nodes in computer room Z in the third region, mainly to meet the requirement that the number of Zookeeper nodes is an odd number for easy election, but this is not the focus of this solution.

[0048] like Figure 1 As shown in the figure, suppose there are three business services ABC, and several instances are deployed in two computer rooms XY respectively, and they are uniformly registered to a Zookeeper cluster center. Therefore, when the system is running, if service A and service B need to communicate with each other to complete special business needs, then through the discovery mechanism of the registration center, it is possible to match the communication between A1 and B1 in the same computer room, and it is also possible to match the communication between A1 and B4 in different computer rooms. And because there is no self-identification mark when B1 and B4 are registered, the concept of the matched remote computer room is equal to that of the same computer room (it is actually related to the number of nodes in each computer room. Since the number of nodes in the example is the same, the probability is equal). When there is an instance of the target service in the same computer room and it is running normally, it is still selected to communicate with the instance across computer rooms, which is an obvious matching defect.

[0049] This embodiment aims to solve the problem that the registration center of a large cluster in different locations has a high probability of matching business service instances in different computer rooms. When the target service instance in the same computer room is available, it will be connected first. Only when the target service instance in the same computer room is unavailable, the target service instance across computer rooms will be selected for connection. This can significantly improve the response and performance of the overall system.

[0050] like Figure 2FIG. 1 is a schematic diagram of a splitting scheme for multiple clusters in different locations in this embodiment. In this scheme, a large cluster across different computer rooms is split into several small clusters in different locations, and each computer room is equivalent to a cluster. Figure 2 As shown in the figure, several business service instances are deployed in Data Center X, and there is also an independent Zookeeper registration center cluster, as well as in Data Center Y. In addition, the Zookeeper node in Data Center Z, which was originally used as a supplement, is no longer necessary.

[0051] like Figure 3 The figure shows a flow chart of a method for active-active maintenance of a remote computer room cluster system based on Zookeeper according to an embodiment of the present invention. The remote computer room cluster system includes a remote first computer room and a remote second computer room; the method includes:

[0052] S301, respectively starting a first service located in a first computer room and a third service located in a second computer room, and registering the first service with the Zookeeper component of the first computer room, and registering the third service with the Zookeeper component of the second computer room; the first service and the third service are of the same type and implement the same business functions;

[0053] Preferably, in step S301, registering the first service with the Zookeeper component of the first computer room and registering the third service with the Zookeeper component of the second computer room includes:

[0054] The first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively. A node will be established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively to represent the first service and the third service; the service attribute data includes the service IP and port.

[0055] Specifically, in this embodiment, Figure 4 The figure shows a detailed schematic diagram of the registration discovery communication sequence of multi-clusters in different locations of this embodiment. Service A1 represents the first service; service B1 represents the second service; service A4 represents the third service; service B4 represents the fourth service; computer room X represents the first computer room; computer room Y represents the second computer room.

[0056] Assume that service B1 located in the first computer room needs to request service A1 to complete the business needs. For the convenience of description only, Figure 4 Only one instance of each service in each computer room cluster is shown.

[0057] Among them, service A1 and service A4 belong to the same type of service A and implement the same business functions; service B1 is used to collaborate with service A1 or service A4 to complete the business functions. For example, the whole vehicle service of the Internet of Vehicles is used to process all the whole vehicle data uploaded by the TCU at regular intervals. However, due to the complexity of the whole vehicle data processing logic, the functions of specifically detecting alarms or counting trips are separated out as independent microservices. Under this model, the whole vehicle service is related to the Class B service, and the alarm or trip service is equivalent to the Class A service; the Class B service depends on the functions of the Class A service, and the Class B service is the upstream service of the Class A service. There are multiple instances of Class A services and Class B services in both computer rooms, respectively. Figure 4 (Right now Figure 2 ) as an example, A1-A3, B1-B3 are in X (the first computer room), and A4-A6, B4-B6 are in Y (the second computer room). In actual situations, the business system determines how many microservices there are, and the business scale and regional estimated allocation determine the number of instances of each microservice actually started in different computer rooms.

[0058] like Figure 4 As shown, service A1 (i.e., the first service) is started in computer room X (i.e., the first computer room) and registers itself with the Zookeeper of computer room X; service A4 (i.e., the third service) is started in computer room Y (i.e., the second computer room) and also registers with the Zookeeper of computer room Y.

[0059] Registration and monitoring are the two main functions provided by the Zookeeper component. A TCP long connection is maintained between the business service and Zookeeper.

[0060] Registration means that the business service sends its own IP, port and other data to Zookeeper through an API, and a node is created inside Zookeeper to represent the business service. When registering, the business service can specify that its node be registered under a certain path.

[0061] Listening means that the business service requests Zookeeper through another API to express its interest in the nodes under a certain path. The nodes under the path generally represent other business services that it needs to communicate with. When Zookeeper detects that the nodes under the path have changed, it notifies the service through the callback API to inform that other services are available. This listening-callback process is also called service discovery, which is based on service registration, so the Zookeeper component is also called the registration center.

[0062] S302, start the second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business needs of the second service, it needs to collaborate with the first or third service, based on the second service monitoring and discovering the first instance list of the first service registered in the first computer room, and the third instance list of the third service registered in the second computer room; the second service is used to collaborate with the first service or the third service to complete the business function.

[0063] Preferably, a TCP connection is pre-established between the second service and the first service, and between the second service and the third service;

[0064] Specifically, in this embodiment, Figure 4 As shown in the figure, service B1 is started in computer room X, first registers itself to Zookeeper in computer room X, then listens and finds the instance list of service A registered in computer room X (A1), and the instance list of service A registered in computer room Y (A4). TCP connections are pre-established between B1 and A1, and between B1 and A4.

[0065] Further, in step S302, the monitoring based on the second service and discovering the first instance list of the first service registered in the first computer room includes: if the second service finds that the first instance list in the same computer room is not empty, the connection with the first service is available, and when processing the business, the data request packet is sent to the first service.

[0066] like Figure 4 As shown, in this embodiment, service B1 finds that the service list of A1 in the same computer room is not empty and the connection with A1 is available. When processing the business, it will send the data request packet to A1.

[0067] S303, the second service starts to select and communicate with the first service located in the same first computer room, and sends relevant business data to the first service in the first instance list;

[0068] S304, in response to the second service monitoring that the first service is offline, the connection with the first service is disconnected. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to implement a backup connection.

[0069] In step S304, in response to the second service monitoring that the first service is offline, the connection with the first service is disconnected, including: if the first service is offline, the Zookeeper component of the first computer room removes the first service and notifies the second service that monitors the first service; when the second service senses that the first service is offline, the connection with the first service is disconnected.

[0070] Specifically, in this embodiment, Figure 4 As shown, if A1 in the X computer room has an abnormality or crashes at a certain moment, resulting in offline (disconnected) and no longer being able to provide services, the X computer room registration center will remove A1 and notify the service B1 that previously monitored it (step S302). Then B1 senses that A1 is offline and also disconnects from A1. So when B1 processes business next time, it will send the data request packet to the A4 standby connection in the remote computer room list.

[0071] After step S304, the method further includes: if the first service of the first computer room returns to normal, re-registering the first service to the Zookeeper component of the first computer room; then the Zookeeper component of the first computer room notifies the second service, and the second service re-establishes the connection with the first service; during the next business data processing, resuming the request to the first service, and sending the data request packet to the first instance list.

[0072] Specifically, in this embodiment, after a period of time, the A1 service in the X computer room returns to normal, re-registers with the Zookeeper in the X computer room, and the Zookeeper notifies the B1 service, and the B1 service re-establishes the connection with A1. Therefore, when processing business data subsequently, it resumes requesting A1 and no longer requests A4.

[0073] In this embodiment, the above Figure 4 The example diagram only illustrates the perspective of the upstream service B1 in the first computer room. Based on Zookeeper registration, the service instance A1 in the same computer room is given priority when exchanging business message data. Only when the target service instance in the same computer room is unavailable, the target service instance A4 across computer rooms is selected for connection. This solves the problem that the registration center of a large cluster in different locations has a high probability of matching business service instances in different computer rooms.

[0074] In addition, it can also be explained from the perspective of the upstream service B4 of the second computer room (not shown in the figure). When communicating and exchanging business message data, the service instance A4 in the same computer room is given priority. Only when the target service instances in the same computer room are unavailable, the target service instance A1 across computer rooms is selected for connection. This also solves the problem that the registration center of a large cluster in a different location has a high probability of matching business service instances in different computer rooms.

[0075] In summary, the main functions of the solution of this embodiment can be summarized as single registration, multiple discovery. On the one hand, the service instance is only registered to the Zookeeper of the same computer room, that is, the service of computer room X is registered to the Zookeeper of computer room X, and the service of computer room Y is registered to the Zookeeper of computer room Y. On the other hand, the service running in a computer room will monitor the registered services of Zookeeper in multiple computer rooms at the same time, and give priority to the service instance in the same computer room when exchanging business message data.

[0076] In addition, the second aspect of the present invention provides a service active-active maintenance device, which is applied to a Zookeeper-based remote computer room cluster system, wherein the system includes a remote first computer room and a remote second computer room, and the device includes a registration module, a monitoring module, a communication module, and a service connection module.

[0077] A registration module, used to respectively start a first service located in a first computer room and a third service located in a second computer room, and register the first service with the Zookeeper component of the first computer room, and register the third service with the Zookeeper component of the second computer room; the first service and the third service belong to the same type of services and implement the same business functions;

[0078] A monitoring module, used to start a second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business requirements of the second service, it needs to collaborate with the first or third service, and based on the monitoring of the second service, a first instance list of the first service registered in the first computer room and a third instance list of the third service registered in the second computer room are discovered; the second service is used to collaborate with the first service or the third service to complete the business function;

[0079] A communication module, configured to start selecting, according to the second service, to perform business communication with the first service located in the same first computer room, and send relevant business data to the first service in the first instance list;

[0080] The service connection module is used to disconnect from the first service in response to the second service monitoring that the first service is offline. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to achieve a backup connection.

[0081] Preferably, in the registration module, the first service is registered with the Zookeeper component of the first computer room, and the third service is registered with the Zookeeper component of the second computer room, including: the first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively, and a node is established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room to represent the first service and the third service respectively; the service attribute data includes service IP and port.

[0082] Preferably, the device also includes a recovery module, which is used to re-register the first service to the Zookeeper component of the first computer room when the first service of the first computer room returns to normal; notify the second service through the Zookeeper component of the first computer room, and the second service re-establishes the connection with the first service; when the next business data is processed, resume requesting the first service and send the data request packet to the first instance list.

[0083] Preferably, a TCP connection is pre-established between the second service and the first service, and between the second service and the third service;

[0084] The monitoring module is also used to send the data request packet to the first service when the second service finds that the first instance list in the same computer room is not empty and the connection with the first service is available, and when processing the business.

[0085] The service connection module is also used to cause the Zookeeper component of the first computer room to remove the first service if the first service is offline, and to notify the second service that monitors the first service; when the second service senses that the first service is offline, it disconnects from the first service.

[0086] In addition, an embodiment of the present application also discloses an electronic device, which includes: one or more processors, and a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes method steps for executing the above-mentioned Zookeeper-based active-active maintenance of a remote computer room cluster system.

[0087] In addition, an embodiment of the present application further provides a storage medium storing a computer program; the program is loaded and executed by a processor to implement the method steps for active-active maintenance of a Zookeeper remote computer room cluster system as described above.

[0088] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0089] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.

[0090] The units described as separate components may or may not be physically separated. As a unit, it can be appreciated by those skilled in the art that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0091] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0092] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a grid device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0093] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for active-active maintenance of a Zookeeper remote computer room cluster system, characterized in that: The system includes a first computer room and a second computer room in different locations; the method includes: Start the first service located in the first computer room and the third service located in the second computer room respectively, and register the first service with the Zookeeper component of the first computer room, and register the third service with the Zookeeper component of the second computer room; the first service and the third service belong to the same type of services and implement the same business functions; Start the second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business needs of the second service, it needs to collaborate with the first or third service, and based on the monitoring of the second service, discover the first instance list of the first service registered in the first computer room, and the third instance list of the third service registered in the second computer room; the second service is used to collaborate with the first service or the third service to complete the business function; According to the second service, the first service located in the same first computer room is selected for business communication, and the relevant business data is sent to the first service in the first instance list; there is no strict requirement for the startup order of the first service, the third service and the second service. Through the coordination of Zookeeper, the first service and the second service in the same first computer room can establish substantial business connection; In response to the second service monitoring that the first service is offline, the connection with the first service is disconnected. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to implement a backup connection.

2. The method for dual-active maintenance of a Zookeeper remote computer room cluster system according to claim 1 is characterized in that: Registering the first service with the Zookeeper component of the first computer room, and registering the third service with the Zookeeper component of the second computer room, including: The first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively. A node will be established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively to represent the first service and the third service; the service attribute data includes the service IP and port.

3. The method for dual-active maintenance of a Zookeeper remote computer room cluster system according to claim 2 is characterized in that: A TCP connection is pre-established between the second service and the first service, and between the second service and the third service; The first instance list of the first service registered in the first computer room is discovered based on the monitoring by the second service, including: If the second service finds that the first instance list in the same computer room is not empty, the connection with the first service is available, and when processing the business, the data request packet is sent to the first service.

4. The method for dual-active maintenance of a Zookeeper remote computer room cluster system according to claim 3 is characterized in that: In response to the second service monitoring that the first service is offline, disconnecting from the first service includes: If the first service is offline, the Zookeeper component of the first computer room removes the first service and notifies the second service that monitors the first service; The second service senses that the first service is offline and disconnects from the first service.

5. The method for dual-active maintenance of a Zookeeper remote computer room cluster system according to claim 4 is characterized in that: The second service requests the third service, sends the data request packet to the third instance list, and implements the standby connection. After that, the method further includes: If the first service of the first computer room returns to normal, re-register the first service to the Zookeeper component of the first computer room; The Zookeeper component of the first computer room notifies the second service, and the second service re-establishes the connection with the first service; during the next business data processing, the second service is restored to request the first service, and the data request packet is sent to the first instance list.

6. A service active-active maintenance device, applied to a Zookeeper-based remote computer room cluster system, the system comprising a remote first computer room and a second computer room, characterized in that: The device includes a registration module, a monitoring module, a communication module and a service connection module; wherein: A registration module, used to respectively start a first service located in a first computer room and a third service located in a second computer room, and register the first service with the Zookeeper component of the first computer room, and register the third service with the Zookeeper component of the second computer room; the first service and the third service belong to the same type of services and implement the same business functions; A monitoring module, used to start a second service located in the first computer room, and register the second service with the Zookeeper component of the first computer room; due to the business requirements of the second service, it needs to collaborate with the first or third service, and based on the monitoring of the second service, a first instance list of the first service registered in the first computer room and a third instance list of the third service registered in the second computer room are discovered; the second service is used to collaborate with the first service or the third service to complete the business function; A communication module, configured to start selecting, according to the second service, to perform business communication with the first service located in the same first computer room, and send relevant business data to the first service in the first instance list; The service connection module is used to disconnect from the first service in response to the second service monitoring that the first service is offline. During the next business data processing, the second service requests the third service and sends the data request packet to the third instance list to achieve a backup connection.

7. The service active-active maintenance device according to claim 6, characterized in that: In the registration module, registering the first service with the Zookeeper component of the first computer room and registering the third service with the Zookeeper component of the second computer room include: The first service and the third service send their own service attribute data to the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively. A node will be established inside the Zookeeper component of the first computer room and the Zookeeper component of the second computer room respectively to represent the first service and the third service; the service attribute data includes the service IP and port.

8. The service active-active maintenance device according to claim 7, characterized in that: The device also includes a recovery module, which is used to re-register the first service in the Zookeeper component of the first computer room when the first service in the first computer room returns to normal; notify the second service through the Zookeeper component of the first computer room, and the second service re-establishes a connection with the first service; and during the next business data processing, resume requesting the first service and send the data request packet to the first instance list.

9. An electronic device, comprising: One or more processors, a memory, the memory being used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes steps for executing the method for active-active maintenance of a Zookeeper remote computer room cluster system based on any one of claims 1-5.

10. A storage medium storing a computer program; the program is loaded and executed by a processor to implement the method steps of dual-active maintenance of a Zookeeper remote computer room cluster system as described in any one of claims 1 to 5.