CN118018560A - Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium - Google Patents

Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium Download PDF

Info

Publication number
CN118018560A
CN118018560A CN202410251630.XA CN202410251630A CN118018560A CN 118018560 A CN118018560 A CN 118018560A CN 202410251630 A CN202410251630 A CN 202410251630A CN 118018560 A CN118018560 A CN 118018560A
Authority
CN
China
Prior art keywords
nacos
cluster
cloud
cloud server
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410251630.XA
Other languages
Chinese (zh)
Inventor
王钊金
熊俊龙
叶明亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Hard Link Network Technology Co ltd
Original Assignee
Shanghai Hard Link Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Hard Link Network Technology Co ltd filed Critical Shanghai Hard Link Network Technology Co ltd
Priority to CN202410251630.XA priority Critical patent/CN118018560A/en
Publication of CN118018560A publication Critical patent/CN118018560A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of multi-cloud environment synchronization, in particular to a Nacos configuration management-based multi-cloud synchronization method, a Nacos configuration management-based multi-cloud environment synchronization system, nacos configuration management-based multi-cloud synchronization equipment and medium, wherein the method specifically comprises the following steps: acquiring a plurality of cloud servers, and respectively arranging Nacos clusters on each cloud server; each cloud server is connected with at least one client respectively; each Nacos cluster is connected with the same Nacos database at the same time, and the local cache time interval of each Nacos cluster is set to be a preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or each Nacos cluster is connected through a dedicated line, and any Nacos cluster is connected with the Nacos database, and the dedicated line is a dedicated network channel between cloud servers. The invention can realize disaster recovery capability of multiple clouds and multiple machine rooms based on Nacos self-clustering principle, does not need a third party component, has clear and simple architecture, is easy to realize and is flexible to use.

Description

Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium
Technical Field
The invention relates to the technical field of multi-cloud environment synchronization, in particular to a Nacos configuration management-based multi-cloud synchronization method, a Nacos configuration management-based multi-cloud environment synchronization system, nacos configuration management-based multi-cloud synchronization equipment and medium.
Background
With the deep concept of cloud primordia, micro services are increasingly applied to actual work in large fist stretching of various large enterprises, such as decoupling of computation and storage, stateless and stateful separation, and the like.
Under the condition that cloud primary storm is rolled up, besides focusing on the application itself, configuration management is becoming more and more important, in applications such as electronic commerce, games and social contact, the method of decoupling the application and the configuration is basically adopted after micro-service, the binding of the configuration and the application is reduced, the configuration is processed more statically, and developers are more in development of the application. However, the configuration is the basis of the running of the application, and once the failure occurs, the stability of the running of the application is directly caused, and the service is interrupted for users, so that the user loss, economic loss, reputation damage and the like are caused. Configuration management is therefore particularly important in a cloud-native environment.
However, since the application and configuration are decoupled after micro-servings, the configuration files may be dispersed among different services, which may lead to consistency problems of the configuration. If different service uses different configuration files or the configuration files are updated untimely, inconsistency among the services can be caused, and the stability and performance of the application can be affected. Meanwhile, in a cloud native environment, an application often needs to dynamically adjust configuration according to different environments and requirements, but this is often not timely enough.
Disclosure of Invention
The invention aims to provide a multi-cloud synchronization method, a system, equipment and a medium based on Nacos configuration management, which can realize disaster recovery capability of multiple clouds and multiple machine rooms based on the cluster principle of Nacos, do not need a third party component, have clear and simple architecture, are easy to realize and are flexible to use, so as to solve at least one of the problems in the prior art.
In a first aspect, the present invention provides a method for cloud synchronization based on Nacos configuration management, where the method specifically includes:
Acquiring a plurality of cloud servers, and respectively arranging Nacos clusters on each cloud server;
each cloud server is connected with at least one client respectively;
Each Nacos cluster is connected with the same Nacos database at the same time, and the local cache time interval of each Nacos cluster is set to be a preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or each Nacos cluster is connected through a dedicated line, and any Nacos cluster is connected with the Nacos database, and the dedicated line is a dedicated network channel between cloud servers.
Further, the method further comprises:
Deploying a distributed coordination service tool on each Nacos clusters respectively;
when Nacos clusters start to run, a temporary node sequence number is distributed to the follower node of each Nacos cluster according to the distributed coordination service tool;
determining at least one candidate node according to the election timeout time of each follower node, and determining a leader node from a plurality of candidate nodes according to the temporary node sequence number when the number of the candidate nodes exceeds one;
And detecting the leader node according to a monitoring mechanism of the distributed coordination service tool, and determining a new leader node from the rest of the follower nodes through the distributed coordination service tool when the leader node fails.
Further, after the enabling each Nacos cluster to be connected to the same Nacos database at the same time and setting the local buffer time interval of each Nacos cluster to be a preset time, the method further includes:
When a first cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
and acquiring service configuration information of the current client from the Nacos database through Nacos clusters on a current cloud server connected with the current client.
Further, after each Nacos cluster is connected through a dedicated line and any one Nacos cluster is connected to the Nacos database, the method further includes:
when a second cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
And acquiring service configuration information of the current client from the Nacos cluster on the second cloud server through the Nacos cluster on the current cloud server connected with the current client.
Further, the method further comprises:
Creating the same name space for each client in each Nacos cluster, wherein the name space is used for storing service configuration information of the corresponding client;
Different user rights are allocated to each client according to an OAuth 2.0 frame, so that the Nacos cluster monitors the OAuth 2.0 frame in real time and acquires rights configuration information of each client;
and storing the authority configuration information into the name space.
Further, the method further comprises:
A CI/CD tool is respectively arranged on each cloud server, so that the CI/CD tool is respectively and simultaneously connected with Nacos clusters on the corresponding cloud server and an external code warehouse;
when the updating of the application codes of the code warehouse is detected, the CI/CD tool is enabled to acquire updated application codes from the code warehouse, and a container mirror image is generated according to the updated application codes;
And pushing the container mirror image to a cloud server for deployment operation, generating an update application program, and generating update service configuration information through the Nacos clusters, so that the client side obtains the update application program and the update service configuration information from the cloud server.
Further, the method further comprises:
Monitoring the client according to a performance monitoring tool and an error tracking tool;
And when any one of the performance index value or the error anomaly number of the client exceeds a corresponding preset threshold, acquiring an application code of a previous version from the code warehouse through the CI/CD tool and regenerating an operation container image, or acquiring an application program of the previous version through a local record of the client and acquiring service configuration information of the previous version from the Nacos cluster.
In a second aspect, the present invention provides a cloud synchronization system based on Nacos configuration management, where the system specifically includes:
The first synchronization module is used for acquiring a plurality of cloud servers, and Nacos clusters are respectively arranged on each cloud server;
the second synchronization module is used for enabling each cloud server to be connected with at least one client respectively;
and the third synchronization module is used for enabling each Nacos cluster to be connected with the same Nacos database at the same time, setting the local cache time interval of each Nacos cluster to be preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or enabling each Nacos cluster to be connected through a special line, and enabling any Nacos cluster to be connected with the Nacos database, and the special line is a special network channel among cloud servers.
In a third aspect, the present invention provides a computer device comprising: memory and processor and computer program stored on the memory, which when executed on the processor, implements a Nacos configuration management based multi-cloud synchronization method as in any of the above methods.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a Nacos configuration management based multi-cloud synchronization method as in any one of the above methods.
Compared with the prior art, the invention has at least one of the following technical effects:
1. Based on Nacos self cluster principle, the disaster recovery capability of multiple clouds and multiple machine rooms can be achieved, a third party component is not needed, the framework is clear and simple, the implementation is easy, and the use is flexible.
2. The configuration information is efficiently synchronized in the multi-cloud environment, the fault risk of configuration management caused by single cloud and single machine rooms is avoided, the application access to the configuration service is not affected when Shan Yun single machine rooms are in fault, and the disaster tolerance capability of the configuration management is improved.
3. By means of Nacos high-availability configuration of the cluster, stability of the system is improved, load balancing and dynamic switching are achieved, and reliable connection with a client is ensured.
4. The mode of combining the OAuth 2.0 framework and Nacos clusters is used for realizing rights management and configuration isolation and flexible and accurate rights control.
5. The full-automatic process from code updating to application deployment is realized, and the development and deployment efficiency is improved.
6. The performance index monitoring, error anomaly tracking and automatic rollback mechanism are integrated, so that the self-healing capacity of the system is improved, and preventive maintenance can be performed before performance problems or error anomalies have no obvious influence on users.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a multi-cloud synchronization method based on Nacos configuration management according to an embodiment of the present invention;
Fig. 2 is a schematic architecture diagram of a multi-cloud synchronization method based on Nacos configuration management according to an embodiment of the present invention;
Fig. 3 is a schematic architecture diagram of a multi-cloud synchronization method based on Nacos configuration management according to another embodiment of the present invention;
Fig. 4 is a schematic structural diagram of a multi-cloud synchronization system based on Nacos configuration management according to an embodiment of the present invention;
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
With the deep concept of cloud primordia, micro services are increasingly applied to actual work in large fist stretching of various large enterprises, such as decoupling of computation and storage, stateless and stateful separation, and the like.
Under the condition that cloud primary storm is rolled up, besides focusing on the application itself, configuration management is becoming more and more important, in applications such as electronic commerce, games and social contact, the method of decoupling the application and the configuration is basically adopted after micro-service, the binding of the configuration and the application is reduced, the configuration is processed more statically, and developers are more in development of the application. However, the configuration is the basis of the running of the application, and once the failure occurs, the stability of the running of the application is directly caused, and the service is interrupted for users, so that the user loss, economic loss, reputation damage and the like are caused. Configuration management is therefore particularly important in a cloud-native environment.
However, since the application and configuration are decoupled after micro-servings, the configuration files may be dispersed among different services, which may lead to consistency problems of the configuration. If different service uses different configuration files or the configuration files are updated untimely, inconsistency among the services can be caused, and the stability and performance of the application can be affected. Meanwhile, in a cloud native environment, an application often needs to dynamically adjust configuration according to different environments and requirements, but this is often not timely enough.
Referring to fig. 1, an embodiment of the present invention provides a method for cloud synchronization based on Nacos configuration management, where the method specifically includes:
S101, acquiring a plurality of cloud servers, and respectively arranging Nacos clusters on each cloud server;
S102, enabling each cloud server to be connected with at least one client respectively;
And S103, enabling each Nacos cluster to be connected with the same Nacos database at the same time, setting the local cache time interval of each Nacos cluster to be a preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or enabling each Nacos cluster to be connected through a special line, and enabling any Nacos cluster to be connected with the Nacos database, wherein the special line is a special network channel among cloud servers.
In this embodiment, one Nacos cluster is deployed and configured on each cloud server, so that they can operate independently, and have their own nodes and configurations, and each Nacos cluster contains multiple nodes to improve high availability and load balancing. Client applications, which may be various services, applications or devices, are deployed on each cloud server and ensure that they can connect to the corresponding Nacos clusters, obtain configuration information, service discovery, etc. through the Nacos clusters.
In this embodiment, there are two network architecture modes: first, as shown in fig. 2, the architecture diagram includes a plurality of cloud servers (cloud server 1, cloud server 2.....cloud server n), each cloud server is provided with a Nacos cluster, each Nacos cluster comprises an entrance LB, a leader node, a follower node and a local cache layer, the client and the entrance LB are connected, corresponding service configuration information of Naocs clusters is obtained through the entrance LB, each Nacos cluster stores data to the same Nacos database, in this case, although all Nacos clusters read the same Naocs database, when any cloud server Nacos cluster has a write operation, the leader node will only read data from the Nacos database to the local cache at intervals due to the existence of the local cache layer, and there is a time difference in implementing synchronization of service configuration information of Nacos clusters on multiple cloud servers, so that the local cache time interval needs to be shortened as much as possible to achieve the effect of data synchronization; second, as shown in fig. 3, the architecture diagram includes a plurality of cloud servers (cloud server 1, cloud server 2.....cloud server n), each cloud server is provided with a Nacos cluster, each Nacos cluster includes an ingress LB, a leader node, a follower node, and a local cache layer, clients and ingress LB implement a connection, corresponding service configuration information of Naocs clusters is obtained through an inlet LB, each Nacos cluster is connected through a dedicated line, in this case, any Nacos cluster is only required to be connected with a Nacos database, and at this time, the function of the Nacos database is mainly data persistence, because a real synchronization effect can be achieved through a plurality of Nacos clusters connected through the dedicated line.
In the first network architecture mode, the local buffer time interval needs to be short to achieve the synchronization effect, so that the pressure of the database is increased, but the cost of opening up each Nacos cluster through a dedicated line is saved at the same time, and in the second network architecture mode, although a dedicated network channel needs to be established for Nacos clusters on each cloud server, the resources of the database can be saved, and the Nacos database is mainly used for persistently storing data and is not used as a data interaction point between a plurality of Nacos clusters.
In this embodiment, by deploying one Nacos cluster on each cloud server, high availability of multiple regions and multiple machine rooms can be achieved, stability and reliability of the system are improved, network delay is reduced, and data transmission rate is improved.
In some embodiments, the method further comprises:
Deploying a distributed coordination service tool on each Nacos clusters respectively;
when Nacos clusters start to run, a temporary node sequence number is distributed to the follower node of each Nacos cluster according to the distributed coordination service tool;
determining at least one candidate node according to the election timeout time of each follower node, and determining a leader node from a plurality of candidate nodes according to the temporary node sequence number when the number of the candidate nodes exceeds one;
And detecting the leader node according to a monitoring mechanism of the distributed coordination service tool, and determining a new leader node from the rest of the follower nodes through the distributed coordination service tool when the leader node fails.
In this embodiment, when the leader node fails, the distributed coordination service tool, such as etcd, zooKeeper, consul, monitors the change of the state of the leader node through the monitoring mechanism of the distributed coordination service tool, so that the process can be performed in time when the leader fails, thereby reducing the fault recovery time, and simultaneously avoiding selecting the leader node through the temporary node sequence number under the condition that the election timeout times of a plurality of foullowers are shortest and the same, and improving the stability of the system.
Taking a ZooKeeper as an example, each of the ZooKeeper nodes participating in the Leader election creates a temporary ordered node under a designated ZooKeeper path, generates a node list after all temporary ordered nodes are created, creates a persistence node under the designated ZooKeeper path for storing global configuration information by the successfully selected Leader node, acquires the global configuration information of the persistence node through a getData method of the ZooKeeper, monitors the change of the persistence node through a Watcher method of the ZooKeeper, updates the data of the persistence node when the Leader node needs to update the global configuration information, and when the data of the persistence node changes, watcher of Follower nodes receives a notification to trigger the operation of processing configuration change, so that the mechanism can ensure the consistency of the configuration information in the distributed system among the nodes. Meanwhile, when the leader node fails (namely, a fault and other conditions occur), the follower node can also be informed of the conditions in time, and a new leader node can be reelected.
In some embodiments, after the enabling each Nacos cluster to connect to the same Nacos database at the same time and setting the local cache time interval of each Nacos cluster to a preset time, the method further includes:
When a first cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
and acquiring service configuration information of the current client from the Nacos database through Nacos clusters on a current cloud server connected with the current client.
In this embodiment, in the network architecture manner as shown in fig. 2, when a certain cloud server loses response, a client connected to the cloud server needs to be timely transferred to another cloud server, but since the Nacos cluster generating a new connection relationship with the cloud server does not have corresponding service configuration information, the service configuration information stored in the original Nacos cluster needs to be acquired from the Nacos database. Meanwhile, when the load of the current cloud server is too high, in order to realize load balancing, part of the currently connected clients are also required to be transferred to other cloud servers with more residual resource spaces, so that the possibility of service interruption is reduced, the reliability of the system is improved, meanwhile, the utilization of resources can be optimized, and traffic is prevented from being sent to the crowded or unavailable servers.
In some embodiments, after each Nacos cluster is connected by a dedicated line and any one Nacos cluster is connected to the Nacos database, the method further includes:
when a second cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
And acquiring service configuration information of the current client from the Nacos cluster on the second cloud server through the Nacos cluster on the current cloud server connected with the current client.
In this embodiment, in the network architecture manner as shown in fig. 3, when a certain cloud server loses response, a client connected with the cloud server needs to be timely transferred to another cloud server, because all Nacos clusters are connected through a dedicated line, which is equivalent to that each Nacos cluster forms the same Nacos cluster, the corresponding service configuration information of the client is not required to be read from the Nacos database, and only the service configuration information is required to be directly read from the original Nacos cluster, and through cooperation with the Nacos clusters, no perception can be realized in the switching process, so that the client can continue to operate normally without being affected. Meanwhile, when the load of the current cloud server is too high, in order to realize load balancing, part of the currently connected clients are also required to be transferred to other cloud servers with more residual resource spaces, so that the possibility of service interruption is reduced, the reliability of the system is improved, meanwhile, the utilization of resources can be optimized, and traffic is prevented from being sent to the crowded or unavailable servers.
In some embodiments, the method further comprises:
Creating the same name space for each client in each Nacos cluster, wherein the name space is used for storing service configuration information of the corresponding client;
Different user rights are allocated to each client according to an OAuth 2.0 frame, so that the Nacos cluster monitors the OAuth 2.0 frame in real time and acquires rights configuration information of each client;
and storing the authority configuration information into the name space.
In this embodiment, in Nacos clusters, namespaces are created through the management console or API, and each client is assigned a separate namespace, each namespace having a unique identification, to ensure that when the cloud server connected with the current client loses response or the residual resource space is lower than the preset space and needs to switch over a new cloud server, the new memory space for storing the service configuration information can be rapidly determined in the new Nacos cluster, meanwhile, the service configuration information between each client side is isolated in each Nacos cluster, the configuration information is prevented from being confused, and the safety is improved. And, by integrating OAuth 2.0 framework, according to OAuth 2.0 authorization mechanism, to ensure that each client has a unique identity, different rights are assigned to different clients, flexible and accurate authority control is realized, and in certain application scenes, the client can be assigned with authorities such as an administrator, a common user and the like, and different member user grades can be set.
In some embodiments, the method further comprises:
A CI/CD tool is respectively arranged on each cloud server, so that the CI/CD tool is respectively and simultaneously connected with Nacos clusters on the corresponding cloud server and an external code warehouse;
when the updating of the application codes of the code warehouse is detected, the CI/CD tool is enabled to acquire updated application codes from the code warehouse, and a container mirror image is generated according to the updated application codes;
And pushing the container mirror image to a cloud server for deployment operation, generating an update application program, and generating update service configuration information through the Nacos clusters, so that the client side obtains the update application program and the update service configuration information from the cloud server.
In this embodiment, CI/CD tools are deployed on each cloud server, such as Jenkins, gitLab CI/CD, etc., and configure connections to Nacos clusters and external code repositories, respectively, the CI/CD tools periodically or through Webhook monitor the external code repositories (e.g., gitHub, gitLab, etc.), trigger CI/CD processes when code updates are detected, the CI/CD tools pull the latest application code from the code repository, and perform compiling, testing, etc. operations according to the build script, integrate Docker with the CI/CD tools, generate container images of the applications according to Dockerfile, etc. configuration files, push the generated container images to container image repositories, such as Docker Hub, ali cloud container image services, etc., then pull the container images to the target cloud server, and start the container, and call Nacos configuration management APIs through the CI/CD tools to update service configuration information in the Nacos clusters. When updating the application program, the client monitors the configuration change in real time through Nacos clusters, acquires the latest service configuration information, and ensures the matching with the updated application program. By the embodiment, a full-automatic process from code updating to application deployment is realized, and development and deployment efficiency is improved.
In some embodiments, the method further comprises:
Monitoring the client according to a performance monitoring tool and an error tracking tool;
And when any one of the performance index value or the error anomaly number of the client exceeds a corresponding preset threshold, acquiring an application code of a previous version from the code warehouse through the CI/CD tool and regenerating an operation container image, or acquiring an application program of the previous version through a local record of the client and acquiring service configuration information of the previous version from the Nacos cluster.
In this embodiment, tools such as Prometheus, grafana, datadog are used to monitor the performance index values of the client, including but not limited to CPU utilization, memory utilization, network traffic, response time, etc., tools such as Sentry, new Relic, ELK Stack (ELASTICSEARCH, LOGSTASH, KIBANA) are used to capture errors and anomalies in the running of the client's application, while real-time data stream processing frameworks (e.g., APACHE KAFKA, APACHE FLINK, etc.) may also be used to process the monitored data in real-time and store the monitored data in a suitable storage system. When the client is updated, the performance of the client is not the same as that of the previous version, or the number of error anomalies is higher than that of the previous version, the client can automatically roll back to the previous version to improve the stability and usability of the system, the client can quickly respond and roll back to the previous version when the problem is found through an automatic pipeline of a CI/CD tool, preventive maintenance can be carried out before the performance problem or the error anomalies have no obvious influence on users, and potential performance problems and anomalies can be timely processed.
Referring to fig. 4, an embodiment of the present invention provides a multi-cloud synchronization system 4 based on Nacos configuration management, where the system 4 specifically includes:
The first synchronization module 401 is configured to obtain a plurality of cloud servers, where each cloud server is respectively provided with a Nacos cluster;
a second synchronization module 402, configured to connect each cloud server with at least one client;
And a third synchronization module 403, configured to connect each Nacos cluster to the same Nacos database at the same time, and set a local cache time interval of each Nacos cluster to a preset time, where the preset time is a minimum local cache time interval of each Nacos cluster, or connect each Nacos cluster through a dedicated line, and connect any Nacos cluster to the Nacos database, where the dedicated line is a dedicated network channel between cloud servers.
It can be understood that the content in the embodiment of the multi-cloud synchronization method based on Nacos configuration management as shown in fig. 1 is applicable to the embodiment of the multi-cloud synchronization system based on Nacos configuration management, the functions specifically implemented by the embodiment of the multi-cloud synchronization system based on Nacos configuration management are the same as those of the embodiment of the multi-cloud synchronization method based on Nacos configuration management as shown in fig. 1, and the beneficial effects achieved by the embodiment of the multi-cloud synchronization method based on Nacos configuration management as shown in fig. 1 are the same.
It should be noted that, because the content of information interaction and execution process between the above systems is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the system is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Referring to fig. 5, an embodiment of the present invention further provides a computer device 5, including: memory 502 and processor 501 and a computer program 503 stored on memory 502, which computer program 503, when executed on processor 501, implements a Nacos configuration management based multi-cloud synchronization method as described in any of the above methods.
The computer device 5 may be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device 5 may include, but is not limited to, a processor 501, a memory 502. It will be appreciated by those skilled in the art that fig. 5 is merely an example of the computer device 5 and is not meant to be limiting as the computer device 5 may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The Processor 501 may be a central processing unit (Central Processing Unit, CPU), the Processor 501 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 502 may in some embodiments be an internal storage unit of the computer device 5, such as a hard disk or a memory of the computer device 5. The memory 502 may also be an external storage device of the computer device 5 in other embodiments, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the computer device 5. Further, the memory 502 may also include both internal storage units and external storage devices of the computer device 5. The memory 502 is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs, such as program code for the computer program. The memory 502 may also be used to temporarily store data that has been output or is to be output.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, realizes the multi-cloud synchronization method based on Nacos configuration management according to any one of the above methods.
In this embodiment, the integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the disclosed embodiments of the application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

Claims (10)

1. A multi-cloud synchronization method based on Nacos configuration management is characterized by comprising the following steps:
Acquiring a plurality of cloud servers, and respectively arranging Nacos clusters on each cloud server;
each cloud server is connected with at least one client respectively;
Each Nacos cluster is connected with the same Nacos database at the same time, and the local cache time interval of each Nacos cluster is set to be a preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or each Nacos cluster is connected through a dedicated line, and any Nacos cluster is connected with the Nacos database, and the dedicated line is a dedicated network channel between cloud servers.
2. The method according to claim 1, wherein the method further comprises:
Deploying a distributed coordination service tool on each Nacos clusters respectively;
when Nacos clusters start to run, a temporary node sequence number is distributed to the follower node of each Nacos cluster according to the distributed coordination service tool;
determining at least one candidate node according to the election timeout time of each follower node, and determining a leader node from a plurality of candidate nodes according to the temporary node sequence number when the number of the candidate nodes exceeds one;
And detecting the leader node according to a monitoring mechanism of the distributed coordination service tool, and determining a new leader node from the rest of the follower nodes through the distributed coordination service tool when the leader node fails.
3. The method of claim 1, wherein after the enabling each Nacos cluster to connect to the same Nacos database at the same time and setting the local cache time interval of each Nacos cluster to a preset time, further comprises:
When a first cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
and acquiring service configuration information of the current client from the Nacos database through Nacos clusters on a current cloud server connected with the current client.
4. The method of claim 1, wherein after connecting each Nacos cluster via a dedicated line and connecting any one Nacos cluster to the Nacos database, further comprising:
when a second cloud server connected with a current client loses response or the residual resource space is lower than a preset space, the current client establishes a connection relationship with any other cloud server which has response and the residual resource space is larger than the preset space;
And acquiring service configuration information of the current client from the Nacos cluster on the second cloud server through the Nacos cluster on the current cloud server connected with the current client.
5. The method according to claim 3 or 4, characterized in that the method further comprises:
Creating the same name space for each client in each Nacos cluster, wherein the name space is used for storing service configuration information of the corresponding client;
Different user rights are allocated to each client according to an OAuth 2.0 frame, so that the Nacos cluster monitors the OAuth 2.0 frame in real time and acquires rights configuration information of each client;
and storing the authority configuration information into the name space.
6. The method according to claim 3 or 4, characterized in that the method further comprises:
A CI/CD tool is respectively arranged on each cloud server, so that the CI/CD tool is respectively and simultaneously connected with Nacos clusters on the corresponding cloud server and an external code warehouse;
when the updating of the application codes of the code warehouse is detected, the CI/CD tool is enabled to acquire updated application codes from the code warehouse, and a container mirror image is generated according to the updated application codes;
And pushing the container mirror image to a cloud server for deployment operation, generating an update application program, and generating update service configuration information through the Nacos clusters, so that the client side obtains the update application program and the update service configuration information from the cloud server.
7. The method of claim 6, wherein the method further comprises:
Monitoring the client according to a performance monitoring tool and an error tracking tool;
And when any one of the performance index value or the error anomaly number of the client exceeds a corresponding preset threshold, acquiring an application code of a previous version from the code warehouse through the CI/CD tool and regenerating an operation container image, or acquiring an application program of the previous version through a local record of the client and acquiring service configuration information of the previous version from the Nacos cluster.
8. A multi-cloud synchronization system based on Nacos configuration management, the system specifically comprising:
The first synchronization module is used for acquiring a plurality of cloud servers, and Nacos clusters are respectively arranged on each cloud server;
the second synchronization module is used for enabling each cloud server to be connected with at least one client respectively;
and the third synchronization module is used for enabling each Nacos cluster to be connected with the same Nacos database at the same time, setting the local cache time interval of each Nacos cluster to be preset time, wherein the preset time is the shortest time interval of the local cache of each Nacos cluster, or enabling each Nacos cluster to be connected through a special line, and enabling any Nacos cluster to be connected with the Nacos database, and the special line is a special network channel among cloud servers.
9. A computer device, comprising: memory and processor and computer program stored on the memory, which when executed on the processor, implements a Nacos configuration management based multi-cloud synchronization method as claimed in any one of claims 1 to 7.
10. A computer readable storage medium, having stored thereon a computer program which, when executed by a processor, implements a Nacos configuration management based multi-cloud synchronization method as claimed in any one of claims 1 to 7.
CN202410251630.XA 2024-03-06 2024-03-06 Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium Pending CN118018560A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410251630.XA CN118018560A (en) 2024-03-06 2024-03-06 Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410251630.XA CN118018560A (en) 2024-03-06 2024-03-06 Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium

Publications (1)

Publication Number Publication Date
CN118018560A true CN118018560A (en) 2024-05-10

Family

ID=90948239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410251630.XA Pending CN118018560A (en) 2024-03-06 2024-03-06 Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN118018560A (en)

Similar Documents

Publication Publication Date Title
US9485163B1 (en) Preventing split-brain scenario in a high-availability cluster
WO2020147331A1 (en) Micro-service monitoring method and system
US9450700B1 (en) Efficient network fleet monitoring
CN107291750B (en) Data migration method and device
EP3210367B1 (en) System and method for disaster recovery of cloud applications
US9348706B2 (en) Maintaining a cluster of virtual machines
US7870248B2 (en) Exploiting service heartbeats to monitor file share
GB2407887A (en) Automatically modifying fail-over configuration of back-up devices
US9146822B2 (en) Cluster configuration systems and methods
US10120779B1 (en) Debugging of hosted computer programs
CN111949444A (en) Data backup and recovery system and method based on distributed service cluster
CN109802986B (en) Equipment management method, system, device and server
US10394670B2 (en) High availability and disaster recovery system architecture
CN111163173B (en) Cluster configuration method and device, server and readable storage medium
CN110247977B (en) Data fusion method and system based on edge calculation
US11397632B2 (en) Safely recovering workloads within a finite timeframe from unhealthy cluster nodes
CN111147567A (en) Service calling method, device, equipment and medium
US20190235882A1 (en) Systems and methods of dynamic port assignment
Tomás et al. Disaster recovery layer for distributed openstack deployments
US20050234919A1 (en) Cluster system and an error recovery method thereof
CN111342986A (en) Distributed node management method and device, distributed system and storage medium
CN107426012B (en) Fault recovery method and device based on super-fusion architecture
US11595471B1 (en) Method and system for electing a master in a cloud based distributed system using a serverless framework
CN118018560A (en) Nacos configuration management-based multi-cloud synchronization method, system, equipment and medium
CN115396296A (en) Service processing method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination