A method and system for synchronizing service data in a registry center

By synchronizing service instances across regions and utilizing metadata to achieve one-way synchronization, the cumbersome service registration process across registration centers is solved, simplifying the operation process and reducing maintenance costs.

CN116074335BActive Publication Date: 2025-10-28BIGO TECH PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310109608.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2025-10-28
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

Service registration across different registry centers is cumbersome and complex, and has high maintenance costs.

Method used

By synchronizing service instances across regions through data synchronization nodes and utilizing metadata to achieve one-way synchronization of services, the cross-region registration process is simplified.

Benefits of technology

This avoids the cumbersome process of registering independently for different regions, reduces service maintenance costs, and optimizes service application performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074335B_ABST
    Figure CN116074335B_ABST
Patent Text Reader

Abstract

This application discloses a service data synchronization method and system for a registration center. The technical solution provided in this application involves a service provider registering a service instance to a first registration center in a first region and recording the first metadata of the service instance, which includes the region identifier of the first registration center. A second registration center in a second region retrieves the service instance from the first registration center through its own data synchronization node, registers the service instance to the corresponding second registration center, and records the second metadata of the service instance, which includes a data synchronization identifier and the region identifier of the first registration center. By employing the above technical means, the cumbersome operation of independently registering services across multiple regions can be avoided, simplifying cross-regional service registration. Furthermore, utilizing data synchronization nodes for service synchronization can further reduce service maintenance costs and optimize service application effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network service technology, and in particular to a service data synchronization method and system for a registration center. Background Technology

[0002] Currently, in the service architecture, service providers register with a registry center, and service callers retrieve an instance list from the registry center to make service calls. To meet the business needs of globalized service applications, a distributed approach with multiple registry centers is typically used to achieve globalization and cross-regional deployment. Service providers register with the registry center of the corresponding region as needed, allowing server callers to make service calls within that region.

[0003] In related technologies, service registration schemes require service providers to register independently with the registry center of the region where the service caller resides, in order to avoid communication delays caused by service callers calling services across regions. However, the operation of service registration across registry centers is relatively cumbersome, and the service registration and maintenance costs are also relatively high. Summary of the Invention

[0004] This application provides a service data synchronization method and system for a registration center, which can simplify cross-center service registration operations and solve the technical problem of cumbersome and complex cross-center service registration processes.

[0005] In a first aspect, embodiments of this application provide a service data synchronization method for a registry center, comprising:

[0006] The service provider registers the service instance with the first registration center of the first region and records the first metadata of the service instance, which includes the region identifier of the first registration center;

[0007] The second registration center of the second region pulls service instances from the first registration center through its own data synchronization node, registers the service instances to the corresponding second registration center, and records the second metadata of the service instances. The second metadata includes the data synchronization identifier and the region identifier of the first registration center.

[0008] If the service provider fails to register the service instance with the first registry center, a second registry center is selected from the preset alternative directory as an alternative registry center. The service instance is registered with the alternative registry center, and the first metadata is recorded in the alternative registry center. The second registry center and the first registry center that are not selected as alternative registry centers pull the service instance from the alternative registry center through their own data synchronization nodes, register the service instance with the corresponding second registry center and the first registry center, and record the second metadata in the corresponding second registry center and the first registry center. There are at least two second registry centers.

[0009] In a second aspect, embodiments of this application provide a service data synchronization system for a registration center, including a service provider, a first registration center, and a second registration center;

[0010] The service provider is configured to register service instances with the first registry center and record the first metadata of the service instances, which includes the region identifier of the first registry center;

[0011] The second registry center is configured to pull service instances from the first registry center through its own data synchronization node, register the service instances to the corresponding second registry center, and record the second metadata of the service instances. The second metadata includes the data synchronization identifier and the region identifier of the first registry center.

[0012] The service provider is also configured to select a second registration center from a preset alternative directory as an alternative registration center if the service provider fails to register the service instance to the first registration center, register the service instance to the alternative registration center, and record the first metadata to the alternative registration center. The remaining second registration centers and the first registration center are configured to pull the service instance from the alternative registration center through their own data synchronization nodes, register the service instance to the corresponding second registration center and the first registration center, and record the second metadata to the corresponding second registration center and the first registration center.

[0013] In a third aspect, embodiments of this application provide a storage medium containing computer-executable instructions configured, when executed by a computer processor, to perform the service data synchronization method of the registry center as described in the first aspect.

[0014] In a fourth aspect, embodiments of this application provide a computer program product containing instructions that, when executed on a computer or processor, cause the computer or processor to perform the service data synchronization method for the registry center as described in the first aspect.

[0015] In this embodiment, the service provider registers service instances with the first registration center of the first region and records the first metadata of the service instances, which includes the region identifier of the first registration center. The second registration center of the second region retrieves the service instances from the first registration center through its own data synchronization node, registers the service instances with the corresponding second registration center, and records the second metadata of the service instances, which includes the data synchronization identifier and the region identifier of the first registration center. If the service provider fails to register the service instances with the first registration center, it selects a second registration center from a preset alternative directory as an alternative registration center, registers the service instances with the alternative registration center, and records the first metadata in the alternative registration center. The second registration center and the first registration center that are not selected as alternative registration centers retrieve the service instances from the alternative registration centers through their own data synchronization nodes, register the service instances with the corresponding second registration center and the first registration center, and record the second metadata in the corresponding second registration center and the first registration center. There are at least two second registration centers. By employing the aforementioned technical means, service instances can be registered synchronously across regions through data synchronization nodes, and one-way service synchronization can be achieved using metadata. This avoids the cumbersome operation of registering services independently in multiple regions, simplifies the cross-regional service registration process, and further reduces service maintenance costs and optimizes service application performance by using data synchronization nodes for service synchronization. Attached Figure Description

[0016] Figure 1 This is a flowchart of a service data synchronization method for a registry center provided in an embodiment of this application;

[0017] Figure 2 This is a registration diagram of a temporary instance in an embodiment of this application;

[0018] Figure 3 This is a schematic diagram of the transfer registration of a temporary instance in the embodiments of this application;

[0019] Figure 4 This is a schematic diagram of the state after the temporary instance is transferred and registered in the embodiments of this application;

[0020] Figure 5 This is a schematic diagram illustrating the registration of persistent instances in an embodiment of this application;

[0021] Figure 6 This is a schematic diagram illustrating the transfer registration and deregistration of persistent instances in the embodiments of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0023] This application provides a service data synchronization method for a registration center, which aims to synchronize service instances across regions through data synchronization nodes and use metadata to achieve one-way synchronization of services. This avoids the cumbersome operation of registering services independently in multiple regions and simplifies the cross-regional service registration operation.

[0024] Traditional service registration schemes typically require service providers to register independently with the registry center of the region where the service caller resides. If the service needs to be used in multiple regions, the service provider must register with multiple registry centers, and the service caller must subscribe to services in multiple registry centers to avoid communication delays caused by cross-regional service calls. This service registration process is clearly cumbersome and inconvenient. Therefore, this application provides an embodiment that avoids communication delays caused by cross-regional service calls, thus solving the technical problem of the cumbersome and complex cross-center service registration process.

[0025] Example:

[0026] Figure 1 A flowchart of a service data synchronization method for a registry center provided in this application embodiment is given. The service data synchronization method for a registry center provided in this embodiment can be executed by a service data synchronization system of the registry center. The service data synchronization system of the registry center can be implemented by software and / or hardware and is composed of multiple physical entities.

[0027] The following description uses the service data synchronization system of the registry center as the main entity for implementing the service data synchronization method of the registry center. (Refer to...) Figure 1 The specific methods for synchronizing service data in this registry center include:

[0028] S110. The service provider registers the service instance with the first registration center of the first region and records the first metadata of the service instance, which includes the region identifier of the first registration center.

[0029] S120. The second registration center of the second region pulls service instances from the first registration center through its own data synchronization node, registers the service instances to the corresponding second registration center, and records the second metadata of the service instances. The second metadata includes the data synchronization identifier and the region identifier of the first registration center.

[0030] S130. If the service provider fails to register the service instance to the first registry center, select a second registry center from the preset alternative directory as an alternative registry center, register the service instance to the alternative registry center, and record the first metadata to the alternative registry center. The second registry center and the first registry center that are not selected as alternative registry centers pull the service instance from the alternative registry center through their own data synchronization nodes, register the service instance to the corresponding second registry center and the first registry center, and record the second metadata to the corresponding second registry center and the first registry center. There are at least two second registry centers.

[0031] The service data synchronization system of the registration center in this embodiment of the application simplifies cross-regional service registration by having the service provider register the service instance with the corresponding registration center during service data synchronization and using the registration center's data synchronization nodes to synchronize service registration data with registration centers in other regions. The service provider does not need to initiate service registration processes independently with multiple regional registration centers; a single service registration operation is sufficient to synchronize the service instance to other regions, achieving efficient and convenient cross-regional service registration.

[0032] Specifically, the registry center is a crucial component of the service architecture. Taking a microservice architecture as an example, the registry center acts as a central coordinator of information resources. Common functions of a registry center include service discovery, service configuration, and service health checks. The service discovery functions provided by the registry center include service registration, service deregistration, service subscription, and service unsubscription. During service registration, the registry center can store relevant information about the service provider and the service caller. During service subscription, the service caller can subscribe to the service provider's information, and when the service provider's information changes, such as adding or removing instances, the corresponding service callers will receive a notification. Registries typically correspond to different regional settings (such as country, continent, etc.) and consist of multiple registration nodes, processed in a cluster (such as a Nacos cluster) to handle relevant business.

[0033] For a given service provider, when it needs to register a service instance, the process begins by defining the region where the service provider is deployed as the first region. Then, the service registration operation is performed using the registration center in the first region, which is defined as the first registration center. The registration centers in the second region (and all other regions) are designated as the second registration centers. This ensures that the service provider and the registration center belong to the same region, avoiding excessive cross-region communication latency and improving service registration efficiency.

[0034] The service provider selects a first registry center and sends a service registration request to register the service instance there. After registration, the service instance's metadata is recorded in the first registry center and defined as the first metadata. The first metadata includes the region identifier of the first registry center, indicating the service instance's original registration location. The service instance adds the region identifier to its metadata based on its original registration location, making it easier to determine the service instance's original registration location from the metadata.

[0035] Furthermore, for second registration centers in other regions, the service instances of the first registration center are pulled and registered to their own nodes through their own data synchronization nodes, thereby achieving synchronous deployment of service instances. Service callers in different regions can call the service instance from the registration center in their respective regions. This application embodiment sets up data synchronization nodes for each registration center to facilitate the synchronous registration of service instances. Moreover, for each synchronized service instance, the second registration center records metadata, defined as second metadata. The second metadata includes the region identifier of the first registration center and a data synchronization identifier, indicating that the service instance in the current second registration center was synchronized from the first registration center.

[0036] Furthermore, if a service provider encounters a problem registering a service instance in the first registry center and finds it suspended, it will transfer the registration process to a second registry center from its backup directory. Simultaneously, it will record the first metadata in the backup registry center, indicating that the original registration location of the service instance was the first registry center. Subsequently, similarly, the second registry center in the second region will retrieve the service instance from the backup registry center through the data synchronization node for registration and record the second metadata, indicating that the service instance was synchronized. After the first registry center resumes operation, it will retrieve the service instance from the backup registry center through the data synchronization node for registration and record the second metadata, indicating that the service instance was synchronized.

[0037] It should be noted that, by recording the first and second metadata in this embodiment, each registry center can easily determine the original registration location of the service instance and whether it is synchronized data. Subsequently, during service deregistration, the metadata can be used to identify the registry center that initiated the deregistration, as well as other registry centers that synchronized deregistration events, ensuring one-way synchronization of service data and preventing mutual synchronization and overwriting of service data between registry centers. If a service instance is deregistered at its original location, this deregistration status should ideally be synchronized from the registry center at the original location to other registry centers. However, if the registry center at the original location synchronizes the service instance status of other registry centers through a data service synchronization node, the deregistered service instance will still be recorded as running, potentially leading to incorrect service instance invocation.

[0038] In one embodiment, multiple registry centers include those generated using different programming languages ​​and technology stacks. Taking open-source Eureka, Nacos, and Consul registry centers as examples, for Eureka and Nacos registry centers, during the process of synchronizing service instances from the Eureka registry center to the Nacos registry center for registration, corresponding conversions in programming languages ​​and data representation formats are performed. This allows the Nacos registry center to use its own build configuration method for synchronizing service instance registration. Ultimately, this enables service callers to invoke services from any registry center.

[0039] The following describes the service data synchronization method of the registry center according to embodiments of this application, using temporary instances and persistent instances as examples. Temporary instances only exist temporarily in the registry center and will be removed by the registry center when the service goes offline or becomes unavailable. Temporary instances maintain a heartbeat with the registry center; if the registry center does not receive a heartbeat from the client for a period of time, it will mark the instance as unhealthy and then remove it after that period. Persistent instances exist permanently in the registry center before being deleted, and may not even be aware of the registry center's existence. They will not actively report heartbeats to the registry center, requiring the registry center to actively probe for their continued existence.

[0040] Specifically, when the service instance is a temporary instance, the service provider registers the service instance by sending heartbeat data to the first registry center. If the registration fails after a set number of consecutive heartbeat data transmissions, an alternate registry center is selected to register the service instance. The service data synchronization process for temporary instances is as follows: Figure 2As shown, when all system components are running normally, an instance 'a' of service A, with metadata 'a-sg', is deployed on the SG region. Therefore, it is registered with the SG region's registry center. The data synchronization node cluster in the EU region pulls the service instance from the SG region's registry center and registers it with the EU region's registry center, modifying the metadata to 'a-sg' to indicate that it is a synchronized instance. The AM region performs service registration and synchronization in the same way.

[0041] After the service provider registers the service instance with the first registration center in the first region, the service provider periodically sends heartbeat data to the first registration center to report the service status; if the first registration center does not receive heartbeat data from the service provider within a set period, it deregisters the service instance.

[0042] Figure 3 This refers to the scenario where the registry center in the SG region is down. After multiple unsuccessful attempts to send heartbeats to the SG region registry center, instance 'a' of service A retrieves the address of the next alternative registry center (e.g., the EU region) from a pre-configured list of registry centers in other regions, following certain rules. It then registers with the EU region and continues sending heartbeats there. In the EU region registry center, instance 'a' of service A has metadata of 'a-sg' (because it's not synchronized data). The AM region cannot synchronize instances from the SG region, but it will synchronize instance 'a' of service A from the EU region, changing its metadata to 'a-sg'. If the EU region registry center also goes down, it continues to select the next registry center in the next region to register with. As long as at least one registry center remains operational, no registration is affected. (See reference...) Figure 4 After the SG region recovers from the failure, it will synchronize instance 'a' of service A back from the EU region, changing its metadata to 'a-sg' to indicate that it is a synchronized instance. Instance 'a' of service A does not need to be re-registered with the SG region's registry center. The SG region's data synchronization node cluster will pull data from other regions and write it to the SG region's registry center. At this point, the SG region's registry center stores 'a-sg' (because it contains synchronized data).

[0043] In addition, the service provider periodically sends heartbeat data to the first registry center to report its service status. If the first registry center does not receive heartbeat data from the service provider within a set period, it deregisters the service instance. Referring to instance a of service A above, if it needs to be deregistered, it simply stops sending its own heartbeats to the registry center. If the service instance is registered with the first registry center, and the first registry center does not receive heartbeat data, it indicates that the service instance is offline. In this case, it deregisters the service instance itself, and the other second registries synchronize this deregistration status through data synchronization nodes, completing the synchronous deregistration of the service instance. The deregistration of other service instances registered with the second registry center is also carried out in accordance with the above deregistration method.

[0044] In this embodiment, the first registration center receives heartbeat data of the corresponding service instance from the service provider through a designated registration node. If a failure is detected in the designated registration node, the service provider reselects a registration node from the first registration center to send the heartbeat data of the service instance. The first registration center receives the heartbeat data of the corresponding service instance from the service provider through multiple backup registration nodes to avoid the situation where a single registration node failure causes the first registration center to fail to receive heartbeat data and mistakenly deregister the service instance, thus achieving disaster recovery.

[0045] Furthermore, after a service instance is registered with the second registry, the data synchronization node also needs to maintain a heartbeat between the service instance and the second registry. This is understandable, as temporary instances will be deregistered when the heartbeat stops; if the second registry does not receive heartbeat data from the data synchronization node, it will deregister the service instance. Therefore, the data synchronization node of the second registry needs to synchronize the status of the service instance from the first registry in real time and send heartbeat data to its own second registry. Optionally, a single data synchronization node can only maintain a limited number of heartbeats; if the number of heartbeats exceeds this limit, sharding is required. Maintaining a heartbeat for a single instance by a single data synchronization node is risky; if this data synchronization node fails, the corresponding service instance will be taken offline in the region. Therefore, multiple backup data synchronization nodes are needed to maintain the heartbeat. When a designated data synchronization node fails, heartbeat data is sent through other data synchronization nodes to achieve disaster recovery. For other service instances registered with the second registry, heartbeat detection is also performed in the same way to obtain real-time service instance status.

[0046] On the other hand, for persistent instances, such as Figure 5 As shown, when all system components are running normally, an instance 'a' of service A, with metadata 'a-sg', is deployed on the SG region. Therefore, it registers with the SG region's registry center through the proxy node cluster in the SG region. The data synchronization node cluster in the EU region pulls the instance from the SG region's registry center and registers it with the EU region's registry center, modifying the metadata to 'a-sg' to indicate that it is a synchronized instance. The same applies to the AM region.

[0047] Furthermore, if the service instance is a persistent instance, the first registry center sends a liveness probe to the service provider to obtain the service status of the service instance; if it is determined that the service provider has failed, the service instance is marked as abnormal.

[0048] Figure 6This refers to a situation where the registry center in the SG region is down. Instance 'a' of service A attempts to register with the SG region's registry center through the proxy node cluster but fails. After multiple unsuccessful retries, the proxy node cluster retrieves the address of the next alternative registry center (e.g., the EU region) from a pre-configured list of registry center addresses in other regions, following certain rules. Then, it transfers the registration to the EU region. In the EU region's registry center, instance 'a' of service A has metadata as 'a-sg' (because it's not synchronized data). The AM region cannot synchronize instances from the SG region, but it will synchronize instance 'a' of service A back from the EU region, changing the metadata to 'a-sg'.

[0049] If the EU region's registration center also goes down, continue to select the next region's registration center to register. As long as one region's registration center is not down, it will not affect any registration.

[0050] In addition, when the service instance is a persistent instance, the service provider queries the registration cluster of the service instance through the first registration center and sends a deregistration request to the registration cluster to deregister the service instance.

[0051] If instance a of service A needs to be taken offline and deregistered, the proxy node cluster of the SG region can be used to find out which registry center the instance was registered with (the registry center identifier of the initial registration is added to the metadata during registration), define that registry center as the registration cluster, and then send a request to take offline and deregister to that registry center.

[0052] Specifically, in the event of a registration cluster failure, a retransmission record is generated. If the service instance is not re-registered and brought back online, a deregistration request is periodically sent to the registration cluster based on the retransmission record. If the service instance is re-registered and brought back online, the retransmission record is deleted.

[0053] If the registry center used for instance registration goes down, a deregistration request cannot be sent to that registry center during deregistration. In this case, the proxy node cluster can temporarily store the relevant information of this deregistration request, such as service name, instance IP port, metadata, and deregistration time, in a highly available database, and temporarily suspend the deregistration operation. Registries in each region, through liveness detection, discover that instance 'a' of service A is unhealthy, and then notify the callers of service A. The proxy node cluster periodically polls the database, finds the registry center where the instance was registered from the recorded metadata, and resends these deregistration requests. If the resend is successful, it means that the corresponding registry center has recovered, and the record can be deleted from the database; if the resend fails, it will continue to retry in the next poll.

[0054] Furthermore, instance 'a' of service A might come online at 08:00, the registry center crash at 08:05, the instance go offline at 08:10, and then come online again at 08:15. Therefore, before the proxy node cluster resends the offline request at 08:10, it needs to query the registration time of instance 'a' of service A (the registration time is added to the metadata during registration) to see if it is after the offline time recorded in the database. If so, there's no need to repeat the offline request; simply delete the record from the database. When the data synchronization node is synchronizing data, if the metadata 'a-sg' of instance 'a' of the same service A encounters this instance coming online at both 08:00 and 08:15, it needs to ensure that the synchronized instance 'a-sg' has updated metadata at 08:15.

[0055] Thus, by synchronizing service data through the aforementioned data synchronization nodes, multi-site active-active service writing can be achieved. Furthermore, assuming service B is deployed in the SG region and needs to call service A, even if the SG region's registry center goes down, after service B retries n times and finds that it cannot obtain the instance list of service A from the SG region's registry center, it can switch to querying the registry center of another region. As long as at least one region's registry center is not down, it will not affect any service discovery, thereby achieving multi-site active-active service reading.

[0056] As described above, the service provider registers the service instance with the first registration center in the first region and records the first metadata of the service instance, which includes the region identifier of the first registration center. The second registration center in the second region pulls the service instance from the first registration center through its own data synchronization node, registers the service instance with the corresponding second registration center, and records the second metadata of the service instance, which includes the data synchronization identifier and the region identifier of the first registration center. If the service provider fails to register the service instance with the first registration center, it selects a second registration center from a preset alternative directory as an alternative registration center, registers the service instance with the alternative registration center, and records the first metadata in the alternative registration center. The second registration center and the first registration center that are not selected as alternative registration centers pull the service instance from the alternative registration center through their own data synchronization nodes, register the service instance with the corresponding second registration center and the first registration center, and record the second metadata in the corresponding second registration center and the first registration center. There are at least two second registration centers. By employing the aforementioned technical means, service instances can be registered synchronously across regions through data synchronization nodes, and one-way service synchronization can be achieved using metadata. This avoids the cumbersome operation of registering services independently in multiple regions, simplifies the cross-regional service registration process, and further reduces service maintenance costs and optimizes service application performance by using data synchronization nodes for service synchronization.

[0057] Based on the above embodiments, this embodiment also provides a service data synchronization device for a registry center. This service data synchronization device for a registry center is applied to the service data synchronization system of the above-mentioned registry center. The service data synchronization of the registry center specifically includes:

[0058] The registration module is used to register service instances with the first registration center of the first region through the service provider and record the first metadata of the service instances, which includes the region identifier of the first registration center.

[0059] The synchronization module is used to pull service instances from the first registration center through the data synchronization node of the second registration center in the second region, register the service instances to the corresponding second registration center, and record the second metadata of the service instances. The second metadata includes the data synchronization identifier and the region identifier of the first registration center.

[0060] The alternative module is used to select a second registry as an alternative registry from a preset alternative directory when the service provider fails to register the service instance to the first registry. The service instance is then registered to the alternative registry, and the first metadata is recorded in the alternative registry. The second registry and the first registry that are not selected as alternative registries pull the service instance from the alternative registry through their own data synchronization nodes, register the service instance to the corresponding second registry and the first registry, and record the second metadata in the corresponding second registry and the first registry. There are at least two second registries.

[0061] As described above, the service provider registers the service instance with the first registration center in the first region and records the first metadata of the service instance, which includes the region identifier of the first registration center. The second registration center in the second region pulls the service instance from the first registration center through its own data synchronization node, registers the service instance with the corresponding second registration center, and records the second metadata of the service instance, which includes the data synchronization identifier and the region identifier of the first registration center. If the service provider fails to register the service instance with the first registration center, it selects a second registration center from a preset alternative directory as an alternative registration center, registers the service instance with the alternative registration center, and records the first metadata in the alternative registration center. The second registration center and the first registration center that are not selected as alternative registration centers pull the service instance from the alternative registration center through their own data synchronization nodes, register the service instance with the corresponding second registration center and the first registration center, and record the second metadata in the corresponding second registration center and the first registration center. There are at least two second registration centers. By employing the aforementioned technical means, service instances can be registered synchronously across regions through data synchronization nodes, and one-way service synchronization can be achieved using metadata. This avoids the cumbersome operation of registering services independently in multiple regions, simplifies the cross-regional service registration process, and further reduces service maintenance costs and optimizes service application performance by using data synchronization nodes for service synchronization.

[0062] The service data synchronization system for the registration center provided in this application embodiment can be configured to execute the service data synchronization method for the registration center provided in the above embodiment, and has corresponding functions and beneficial effects.

[0063] Based on the above embodiments, this application also provides a storage medium containing computer-executable instructions. When executed by a computer processor, these computer-executable instructions are configured to perform a service data synchronization method for a registry center. The storage medium can be any type of memory device or storage device, and this storage device can be the storage device for each module of the aforementioned service data synchronization system. Of course, the computer-executable instructions provided in this application are not limited to the service data synchronization method for a registry center described above; they can also execute related operations within the service data synchronization method for a registry center provided in any embodiment of this application.

[0064] Based on the above embodiments, this application also provides a computer program product. The technical solution of this application, in essence or in other words, 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. The computer program product is stored in one or more storage media and includes several instructions to cause a computer device, mobile terminal, or processor therein to execute all or part of the steps of the service data synchronization method of the registration center described in the various embodiments of this application.

Claims

1. A method for synchronizing service data in a registry center, characterized in that, include: The service provider registers the service instance with the first registration center of the first region and records the first metadata of the service instance, which includes the region identifier of the first registration center; The second registration center of the second region pulls the service instance from the first registration center through its own data synchronization node, registers the service instance to the corresponding second registration center, and records the second metadata of the service instance, which includes a data synchronization identifier and the region identifier of the first registration center. If the service instance fails to register with the first registration center at the service provider end, the second registration center is selected from the preset alternative directory as an alternative registration center, the service instance is registered with the alternative registration center, and the first metadata is recorded in the alternative registration center. The second registry center and the first registry center, which were not selected as the candidate registry centers, pull the service instance from the candidate registry centers through their own data synchronization nodes, register the service instance to the corresponding second registry center and the first registry center, and record the second metadata to the corresponding second registry center and the first registry center. There are at least two second registry centers.

2. The service data synchronization method for the registration center according to claim 1, characterized in that, The service provider registers the service instance with the first registration center of the first region, including: If the service instance is a temporary instance, the service provider registers the service instance by sending heartbeat data to the first registration center. If the service instance is not successfully registered after sending heartbeat data for a set number of consecutive times, the service provider selects the alternative registration center to register the service instance.

3. The service data synchronization method for the registration center according to claim 2, characterized in that, After the service provider registers the service instance with the first registration center of the first region, the process also includes: The service provider periodically sends heartbeat data to the first registration center to report its service status. If the first registration center does not receive heartbeat data from the service provider within a set time period, it will deregister the service instance.

4. The service data synchronization method for the registration center according to claim 3, characterized in that, The first registration center receives heartbeat data of the service instance corresponding to the service provider through a designated registration node. If a failure is detected in the designated registration node, the service provider reselects the registration node of the first registration center to send the heartbeat data of the service instance.

5. The service data synchronization method for the registration center according to claim 1, characterized in that, After the service provider registers the service instance with the first registration center of the first region, the process also includes: If the service instance is a persistent instance, the first registration center sends a liveness detection message to the service provider to obtain the service status of the service instance. If a failure is determined to have occurred at the service provider end, the service instance is marked as being in an abnormal state.

6. The service data synchronization method for the registration center according to claim 1, characterized in that, If the service instance is a persistent instance, the service provider queries the registration cluster of the service instance through the first registration center and sends a deregistration request to the registration cluster to deregister the service instance.

7. The service data synchronization method for a registration center according to claim 6, characterized in that, After initiating a deregistration request to the registration cluster to deregister the service instance, the process also includes: In the event of a failure in the registration cluster, a retransmission record is generated. If the service instance is not re-registered and brought back online, a deregistration request is periodically sent to the registration cluster based on the retransmission record. If the service instance is re-registered and brought back online, the retransmission record is deleted.

8. A service data synchronization system for a registration center, characterized in that, This includes the service provider, the first registration center, and the second registration center; The service provider is configured to register service instances with the first registration center and record the first metadata of the service instances, wherein the first metadata includes the region identifier of the first registration center; The second registration center is configured to pull the service instance from the first registration center through its own data synchronization node, register the service instance to the corresponding second registration center, and record the second metadata of the service instance, which includes a data synchronization identifier and a region identifier of the first registration center; The service provider is further configured to, if the service instance is not successfully registered to the first registration center, select the second registration center from a preset alternative directory as an alternative registration center, register the service instance to the alternative registration center, and record the first metadata to the alternative registration center. The second registry center and the first registry center, which were not selected as the alternative registry centers, are configured to pull the service instance from the alternative registry center through their own data synchronization nodes, register the service instance to the corresponding second registry center and the first registry center, and record the second metadata to the corresponding second registry center and the first registry center, wherein there are at least two second registry centers.

9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are configured to perform the service data synchronization method of the registry center as described in any one of claims 1-7.

10. A computer program product, characterized in that, The computer program product includes instructions that, when executed on a computer or processor, cause the computer or processor to perform the service data synchronization method of the registry center as described in any one of claims 1-7.

Citation Information

Patent Citations

  • A service discovery and client load balancing method based on a service registration center

    CN109257440A

  • Service registration system and method

    CN110365750A