System multi-registration center matching method based on zookeeper
By utilizing ZooKeeper's event listening and parameter matching in the middleware business orchestration system, the problem of how the web subsystem can efficiently match the service subsystem address was solved, achieving accurate resource location and high system availability.
Patent Information
- Application Number
- CN202210326534.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-03-30
AI Technical Summary
In a middleware business orchestration system, how to efficiently match the address of the web subsystem to the service subsystem becomes a problem, especially in the case of multiple registry centers. Traversing all centers will waste resources, while missing a center defeats the purpose of having multiple registry centers.
By scanning the registry center information and saving it to the database when the business system starts, and leveraging ZooKeeper's event listening features, the group and address parameters of the registry center are matched to ensure accurate address matching and reduce resource waste.
It enables precise resource location, reduces the pressure on individual machines, distributes the load, improves the system's resilience, and avoids system unavailability caused by individual machine downtime.
Smart Images

Figure CN114640629B_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to the field of computer information technology, and in particular to a system multi-registry center matching method based on Zookeeper. [Background technology]
[0002] The business orchestration system of the middle office group is designed based on the idea of microservices. After a large system is split into different microservices, the call addresses between services cannot exist independently inside a certain service. The addresses of each service must be decoupled and turned into a registration center. The registration center can be said to be an address book in the microservice architecture, which records the mapping relationship between services and service addresses. In a distributed architecture, services will be registered with the registration center. When a service needs to call other services, it will find the address of the service here and call it.
[0003] In the business orchestration system, the request is received by the web subsystem and then calls the N service subsystems behind it. If the web subsystem and the service subsystem are registered in different registration centers, then which registration center should the web subsystem go to to find the address of the corresponding service subsystem is bound to become a problem. If all registration centers are traversed, it will inevitably waste resources. If one of the registration centers is missed, then the meaning of multiple registration centers is lost. Therefore, how the web subsystem matches the address of the corresponding service subsystem has become an urgent problem to be solved.
[0004] The original model of the middle-office business orchestration system in the existing technology is that there is only one registration center. A web subsystem needs to discover the service subsystem called later. All service addresses are concentrated in one registration center. If this registration center goes down or an exception occurs, the service call will inevitably be affected. [Summary of the invention]
[0005] In order to overcome the above problems, the present invention proposes a system multi-registry center matching method based on Zookeeper that can effectively solve the above problems.
[0006] The present invention provides a technical solution to solve the above technical problem: providing a system multi-registry center matching method based on Zookeeper, comprising the following steps:
[0007] Step S1, the registration center information of all web subsystems and all service subsystems is defined in different business systems according to data formats;
[0008] Step S2: When all business systems are started, they will scan the registration center information in step S1, and save the registration center information to the MySQL database of the middle office business orchestration system through the characteristics of zk event monitoring;
[0009] Step S3, when a service method is selected in the orchestration interface, the address of the registration center that can match the current web subsystem is found;
[0010] Step S4, when matching the registration center, traverse the group parameters and address parameters of the registration center of all web subsystems, and then match them one by one with the group parameters and address parameters of the registration center where the selected service method is located. Only when they are the same, the address of the service service is returned.
[0011] Preferably, in step S4, determining a calling address requires two conditions, namely, an address parameter and a group parameter.
[0012] Preferably, multiple zookeepers are involved.
[0013] Compared with the prior art, the zookeeper-based system multi-registry center matching method of the present invention can accurately locate resources. If all registration centers are traversed once, it is bound to waste resources; reduce the pressure on a single machine, and a single registration center becomes multiple registration centers, sharing the load and workload on a single machine; solve the problem of single machine failure and improve the system's risk resistance; the failure of a machine in multiple registration centers will not cause the system to be completely unavailable in a short period of time.
Brief Description of the Drawings
[0014] Figure 1 The present invention is a flowchart of the steps of the system multi-registry center matching method based on Zookeeper. [Specific implementation method]
[0015] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0016] It should be noted that in the embodiments of the present invention, all directional indications (such as up, down, left, right, front, back, etc.) are limited to relative positions on the specified view, rather than absolute positions.
[0017] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0018] See also Figure 1 The system multi-registry center matching method based on Zookeeper of the present invention comprises the following steps:
[0019] Step S1, the registration center information of all web subsystems and all service subsystems is defined in different business systems according to data formats.
[0020] The data format is as follows:
[0021] dubbo.registries.r1.id=c1
[0022] dubbo.registries.r1.address=zookeeper: / / 172.16.87.35:2181
[0023] dubbo.registries.r1.group=group_r1
[0024] dubbo.registries.zk1.id=registry_1
[0025] dubbo.registries.zk1.address=zookeeper: / / 172.16.87.35:2181
[0026] dubbo.registries.zk1.group=group_r1.
[0027] Step S2: When all business systems are started, they will scan the registration center information described in step S1, and save the registration center information to the MySQL database of the middle-end business orchestration system through the characteristics of zk event monitoring.
[0028] Step S3, when a service method is selected in the orchestration interface, the address of the registration center that can match the current web subsystem is found.
[0029] Step S4: Since two conditions are required to determine a call address, namely the address parameter and the group parameter, when matching the registry, the group parameters and address parameters of all web subsystems' registry are traversed, and then matched one by one with the group parameters and address parameters of the registry where the selected service method is located. Only when they are the same, the address of the service is returned.
[0030] Specifically, for example, web is registered with zk1, zk2 and zk3, service1 is registered with zk2, zk3 and zk4, then the common registration center of web and service1 is zk2 and zk3; service2 is registered with zk2 and zkN, then the common registration center of web and service2 is zk2. Here zk is zookeeper, and this method involves multiple zookeepers, namely zookeeper1, zookeeper2, zookeeper3...zookeeperN.
[0031] Compared with the prior art, the zookeeper-based system multi-registry center matching method of the present invention can accurately locate resources. If all registration centers are traversed once, it is bound to waste resources; reduce the pressure on a single machine, and a single registration center becomes multiple registration centers, sharing the load and workload on a single machine; solve the problem of single machine failure and improve the system's risk resistance; the failure of a machine in multiple registration centers will not cause the system to be completely unavailable in a short period of time.
[0032] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any modifications, equivalent substitutions and improvements made within the concept of the present invention should be included in the patent protection scope of the present invention.
Claims
1. The system multi-registry center matching method based on zookeeper is characterized by: The steps include: Step S1, the registration center information of all web subsystems and all service subsystems is defined in different business systems according to data formats; The data format is as follows: dubbo.registries.r1.id=c1 dubbo.registries.r1.address=zookeeper: / / 172.16.87.35:2181 dubbo.registries.r1.group=group_r1 dubbo.registries.zk1.id=registry_1 dubbo.registries.zk1.address=zookeeper: / / 172.16.87.35:2181 dubbo.registries.zk1.group=group_r1; Step S2: When all business systems are started, they will scan the registration center information in step S1, and save the registration center information to the MySQL database of the middle office business orchestration system through the characteristics of zk event monitoring; Step S3, when a service method is selected in the orchestration interface, the address of the registration center that can match the current web subsystem is found; Step S4, when matching the registration center, traverse the group parameters and address parameters of the registration centers of all web subsystems, and then match them one by one with the group parameters and address parameters of the registration center where the selected service method is located. Only when they are the same, the address of the service service is returned; In step S4, determining a calling address requires two conditions, namely, an address parameter and a group parameter; In the system multi-registration center matching method based on zookeeper, web is registered on zk1, zk2 and zk3, service1 is registered on zk2, zk3 and zk4, then the common registration center of web and service1 is zk2 and zk3; service2 is registered on zk2 and zkN, then the common registration center of web and service2 is zk2; the zk is zookeeper, and the system multi-registration center matching method based on zookeeper involves multiple zookeepers, namely zookeeper1, zookeeper2, zookeeper3...zookeeperN.
