CN117834430A - Nacos cluster deployment method and device and electronic equipment - Google Patents

Nacos cluster deployment method and device and electronic equipment Download PDF

Info

Publication number
CN117834430A
CN117834430A CN202311702106.1A CN202311702106A CN117834430A CN 117834430 A CN117834430 A CN 117834430A CN 202311702106 A CN202311702106 A CN 202311702106A CN 117834430 A CN117834430 A CN 117834430A
Authority
CN
China
Prior art keywords
nacos
cluster
node
nodes
configuration file
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
CN202311702106.1A
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.)
Postal Savings Bank of China Ltd
Original Assignee
Postal Savings Bank of China 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 Postal Savings Bank of China Ltd filed Critical Postal Savings Bank of China Ltd
Priority to CN202311702106.1A priority Critical patent/CN117834430A/en
Publication of CN117834430A publication Critical patent/CN117834430A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a deployment method and device of Nacos clusters and electronic equipment, wherein the method comprises the following steps: deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment; monitoring whether Nacos cluster nodes change; under the condition that Nacos cluster nodes change, updating a node configuration file of the Nacos cluster; and carrying out health check on the Nacos cluster nodes according to the updated node configuration file. According to the Nacos cluster deployment method, the Nacos clusters are deployed through the container, the Nacos performance is improved through the capacity of the Kubernetes clusters in scheduling, operation and maintenance, expansion and other aspects, and the problems in operation and maintenance, expansion and other aspects caused by manually specifying node information in the cluster configuration file are avoided. The node change condition of the Nacos cluster is monitored in real time, and the node configuration file of the Nacos cluster is updated in real time, so that the problem of node ready waiting in the traditional Nacos cluster stateful deployment mode is solved, and the flexibility of the container cluster deployment service is reserved.

Description

Nacos cluster deployment method and device and electronic equipment
Technical Field
The present disclosure relates to the field of Nacos clusters, and in particular, to a method and an apparatus for deploying a Nacos cluster, and an electronic device.
Background
At present, cloud technology is mature and widely applied. The new deployment environment provides greater advantages in aspects of resources, deployment, operation and maintenance, and the like, and improves the working efficiency of development and operation and maintenance personnel while greatly reducing the cost.
The traditional Nacos container cluster deployment scheme based on the Kubernetes cluster environment (K8 s for short) realizes the health check of Nacos container clusters by editing and designating all node domain names in a cluster configuration file, configuring a health check strategy, deploying an operation component mirror image.
When the scheme is applied, at least the following technical problems exist:
1) Parameters such as a Pod name, a name space name and the like of the cluster node need to be designated in advance, and when the Pod node is added or deleted, the configuration file cannot detect information such as the cluster node, the Pod parameter and the like in real time, so that Nacos cluster abnormality is caused;
2) The advantage of flexible deployment in the Kubernetes cluster is lost, the fixed Pod name must be deployed and applied under a designated naming space, and the node scale expansion of the Nacos cluster in the later stage is inconvenient, so that the capacity of the Kubernetes cluster is difficult to embody;
3) The 7848 port of the Nacos cluster node is used for detecting the running states of other nodes of the cluster, when all the nodes of the cluster run successfully, the 8848 port of the Nacos cluster node can provide services to the outside, but the nodes Pod in the Nacos cluster are sequentially started, so that before the other nodes of the cluster run successfully, the 8848 port of the first cluster Pod can not pass health check and provide services to the outside, and the problem of node readiness waiting is caused.
Disclosure of Invention
In order to solve the technical problem of at least one aspect, the embodiments of the present application provide a method, an apparatus, and an electronic device for deploying a Nacos cluster, so as to solve the problem that nodes wait in a traditional Nacos cluster deployment manner, and improve flexibility of a container cluster deployment service.
The embodiment of the application adopts the following technical scheme:
in a first aspect, an embodiment of the present application provides a method for deploying a Nacos cluster, where the method includes:
deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
monitoring whether Nacos cluster nodes change;
under the condition that Nacos cluster nodes change, updating a node configuration file of the Nacos cluster;
and carrying out health check on the Nacos cluster nodes according to the updated node configuration file.
Optionally, the monitoring whether the Nacos cluster node changes includes:
and monitoring whether the Nacos cluster nodes are changed or not through a preset monitoring tool, wherein the preset monitoring tool is mounted in the Nacos cluster nodes in a container initializing mode.
Optionally, the monitoring whether the Nacos cluster node changes includes:
monitoring whether the DNS quantity in the headless service of the Nacos cluster is changed;
if the DNS number in the headless service changes, determining that the Nacos cluster node changes;
otherwise, determining that the Nacos cluster node is unchanged.
Optionally, the health check on the Nacos cluster node according to the updated node configuration file includes:
detecting the running states of all nodes in the updated node configuration file by using the detection ports of the Nacos cluster nodes according to the updated node configuration file;
and if all the nodes in the updated node configuration file are started successfully, determining that the Nacos cluster nodes pass the health check.
Optionally, after health checking the Nacos cluster node according to the updated node configuration file, the method further includes:
in the case that the Nacos cluster node passes the health check, services are provided outside through the service port of the Nacos cluster node.
Optionally, in the case that the Nacos cluster node passes the health check, after running the Nacos cluster node, the method further includes:
monitoring the resource use state of Nacos cluster nodes through a preset monitoring tool;
and adjusting JVM parameters of the Nacos cluster nodes according to the resource use states of the Nacos cluster nodes.
Optionally, the adjusting the JVM parameter of the Nacos cluster node according to the resource usage status of the Nacos cluster node includes:
if the resource use state of the Nacos cluster node is memory overflow, expanding JVM parameters of the Nacos cluster node;
if the resource use state of the Nacos cluster node is memory leakage, reducing JVM parameters of the Nacos cluster node.
In a second aspect, an embodiment of the present application further provides a deployment apparatus of a Nacos cluster, where the apparatus includes:
the creation unit is used for deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
the monitoring unit is used for monitoring whether the Nacos cluster nodes change or not;
the updating unit is used for updating the node configuration file of the Nacos cluster under the condition that the nodes of the Nacos cluster are changed;
and the health checking unit is used for carrying out health checking on the Nacos cluster nodes according to the updated node configuration file.
In a third aspect, embodiments of the present application further provide an electronic device, including:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform any of the methods described hereinbefore.
In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium storing one or more programs that, when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform any of the methods described above.
The above-mentioned at least one technical scheme that this application embodiment adopted can reach following beneficial effect: according to the Nacos cluster deployment method, nacos components are deployed in a Kubernetes cluster environment, and Nacos cluster nodes are created; then monitoring whether Nacos cluster nodes change or not; then under the condition that Nacos cluster nodes change, updating the node configuration file of the Nacos cluster; and finally, carrying out health check on the Nacos cluster nodes according to the updated node configuration file. According to the Nacos cluster deployment method, the Nacos clusters are deployed through the container, the Nacos performance is improved through the capacity of the Kubernetes clusters in scheduling, operation and maintenance, expansion and other aspects, and the problems in operation and maintenance, expansion and other aspects caused by manually specifying node information in the cluster configuration file are avoided. The node change condition of the Nacos cluster is monitored in real time, and the node configuration file of the Nacos cluster is updated in real time, so that the problem of node ready waiting in the traditional Nacos cluster stateful deployment mode is solved, and the flexibility of the container cluster deployment service is reserved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a schematic diagram of a Nacos deployment architecture in an embodiment of the present application;
fig. 2 is a flow chart of a deployment method of a Nacos cluster in an embodiment of the present application;
FIG. 3 is a call relationship diagram of Nacos cluster service in an embodiment of the present application;
fig. 4 is a timing chart of a preset monitoring tool implementing node monitoring in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a deployment device of a Nacos cluster in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
For the purposes, technical solutions and advantages of the present application, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
To facilitate understanding of the embodiments of the present application, the main technical terms involved in the embodiments of the present application are first introduced:
1) APP-TOOL: representing the monitoring tool designed in this application.
2) Headset Service: headless services are commonly used for stateful applications that do not require external provisioning of services.
3) InitContainer: an initialization container for starting one or more initialization containers before starting the application container, and completing preset conditions required by the application container. Initializing a container is a task that ends only once and must be completed after successful execution before the system can continue to execute the next container.
4) EmptyDir: the most basic volume type is created when Pod is allocated to Node, the initial content is empty, no directory file corresponding to the host is required to be specified, kubernetes can automatically allocate a directory, and data in EmptyDir can be permanently deleted when Pod is destroyed.
5) Statefulset: service controller type in K8s cluster. The pois created by using Statefulset will remain permanently marked during the life cycle. The method is characterized by having fixed network marks, deployment, expansion, termination, deletion and rolling update in sequence.
For ease of understanding the embodiments of the present application, as shown in fig. 1, a schematic illustration of a Nacos deployment architecture in the embodiments of the present application is provided.
FIG. 1 is a technical design from a container perspective, implemented using container technology, mirrored and orchestrated scripts for online deployment, nacos components and other components, micro-service applications, etc. deployed in a container cloud platform environment. As a service component, the Nacos deployment architecture can be designed into a cluster mode with three nodes or more, so that high availability and high stability of service are ensured.
S1: service access layer: the Nacos component and other components or applications provide service access externally through the service publishing capability and load balancing capability of the Kubernetes cluster. And creating Service resources of Nacos by using a NodePort release mode, and automatically realizing load balancing of all nodes of the Nacos cluster by using the Kubernetes.
S2: micro service layer: nacos, as a micro-service platform component, provides registry or configuration center capabilities for upper layer micro-service applications. Health check of Nacos service is realized based on Healthcheck capability of Kubernetes, and the monitoring TOOL APP-TOOL of the application can be mounted in a Nacos main container in an InitContainer mode to realize monitoring capability.
S3: basic environment layer: the container cloud platform based on the X86 or ARM architecture provides a base for upper micro-service components and micro-service applications and a stable, robust and consistent bottom environment, provides basic capability support of network, storage, calculation and the like for Nacos clusters, and eliminates the problems possibly caused by the difference of the bottom environment.
Further, an embodiment of the present application provides a method for deploying a Nacos cluster, as shown in fig. 2, and provides a flow chart of the method for deploying a Nacos cluster in the embodiment of the present application, where the method at least includes steps S210 to S240 as follows:
step S210, deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment.
When the Nacos cluster is deployed, nacos components are required to be deployed through scripts in a Kubernetes cluster environment, pod copies are started through a Kubernetes scheduling ApiServer, and Nacos cluster nodes are created.
Step S220, monitoring whether the Nacos cluster node changes.
Whether Nacos cluster nodes change or not is monitored in real time, wherein the main monitoring is whether the quantity of Nacos cluster nodes change, for example, whether a new Pod exists or the Pod is deleted, and the situation of the new Pod is mainly the scene of initial deployment of the Nacos cluster nodes.
Step S230, updating the node configuration file of the Nacos cluster under the condition that the Nacos cluster nodes are changed.
When the Nacos cluster node is monitored to change, the node configuration file cluster.conf of the Nacos cluster needs to be updated in real time, and the node configuration file is used for storing information of all created Nacos cluster nodes, for example, when a Pod is newly added, a newly added Pod instance needs to be updated into the node configuration file cluster.conf, and when the Pod is deleted, corresponding node information needs to be deleted from the node configuration file cluster.conf.
The steps can be regarded as that the node configuration file is created by the edge and updated in real time, and the method is obviously different from the traditional Nacos cluster deployment scheme in that all node domain names are edited and specified in the cluster configuration file, and health inspection strategies are configured, so that health inspection of Nacos container clusters is realized.
Step S240, health inspection is carried out on Nacos cluster nodes according to the updated node configuration file.
The Kubernetes performs health inspection on Nacos cluster nodes in the node configuration file according to the health inspection strategy configured in the Nacos script, so that a health inspection deployment scheme of Nacos clusters is realized, and the flexibility of container cluster deployment service is reserved. The health check policy here is mainly a policy for checking whether a node can provide a service to the outside.
And feeding back the health check result to the Kubernetes cluster, and continuously and circularly executing the steps by the Kubernetes cluster according to the copy number configured in the Nacos deployment script until the copy number reaches the required number.
The above-mentioned overall processing logic can be regarded as the process of establishing the node, updating the node configuration file in real time of the edge, edge health check, based on 7848 detection logic of the detection port, the above-mentioned processing logic can decouple the external service link of each Nacos cluster node, namely each time the deployment of a node is finished, the node can provide services to the external, and does not need to wait for the deployment result of other nodes, thus has solved the problem that the node is ready to wait.
According to the Nacos cluster deployment method, the Nacos clusters are deployed through the container, the Nacos performance is improved through the capacity of the Kubernetes clusters in scheduling, operation and maintenance, expansion and other aspects, and the problems in operation and maintenance, expansion and other aspects caused by manually specifying node information in the cluster configuration file are avoided. The node change condition of the Nacos cluster is monitored in real time, and the node configuration file of the Nacos cluster is updated in real time, so that the problem of node ready waiting in the traditional Nacos cluster stateful deployment mode is solved, and the flexibility of the container cluster deployment service is reserved.
In some embodiments of the present application, the monitoring whether the Nacos cluster node changes includes: and monitoring whether the Nacos cluster nodes are changed or not through a preset monitoring tool, wherein the preset monitoring tool is mounted in the Nacos cluster nodes in a container initializing mode.
According to the embodiment of the application, the change of the Nacos cluster node can be monitored through the preset monitoring TOOL APP-TOOL, the preset monitoring TOOL APP-TOOL can be mounted in the Nacos main container in an InittContainer mode, the monitoring capability of the node change is achieved, the platform monitoring service or other third party monitoring components are not relied on, and the implementation and maintenance are easy.
In some embodiments of the present application, the monitoring whether the Nacos cluster node changes includes: monitoring whether the DNS quantity in the headless service of the Nacos cluster is changed; if the DNS number in the headless service changes, determining that the Nacos cluster node changes; otherwise, determining that the Nacos cluster node is unchanged.
In the container cluster environment, each node Pod of the Nacos Service has a unique DNS (Domain Name System ), and when a new node Pod is created, the DNS number in the Headless Service changes accordingly, so that the embodiment of the application can monitor the change of the DNS number in the Headless Service in real time through a preset monitoring tool, thereby realizing dynamic update of the node configuration file.
In some embodiments of the present application, the performing health check on the Nacos cluster node according to the updated node configuration file includes: detecting the running states of all nodes in the updated node configuration file by using the detection ports of the Nacos cluster nodes according to the updated node configuration file; and if all the nodes in the updated node configuration file are started successfully, determining that the Nacos cluster nodes pass the health check.
As described above, the 7848 detection port of the Nacos cluster monitors the running condition of all Pod instances in the node configuration file, and when all Pod instances in the node configuration file are started successfully, the current node passes the health check, and the service port 8848 of the Nacos starts to provide services to the outside. In the conventional deployment scheme, all designated node Pod information is written into the node configuration file in advance, the 7848 detection port of the first node detects the running condition of all Pod instances in the node configuration file, and then the first node cannot pass the health check due to the fact that other subsequent nodes are not started, and further cannot normally provide services to the outside.
In order to facilitate understanding of the embodiments of the present application, as shown in fig. 3, a call relationship diagram of a Nacos cluster service in the embodiments of the present application is provided,
taking a three-node cluster as an example, for the first node of the Nacos cluster, namely Pod1, when Pod1 is created, a monitoring tool detects the change of the DNS number in the Headset Service, updates the node information of Pod1 into a node configuration file, and a 7848 detection port corresponding to Pod1 can detect all other Pod running conditions in the node configuration file, and since no other node exists at this time, pod1 can normally provide services to the outside through health check and through a 8848 port.
When Pod2 is newly added, the monitoring tool will update the information of the newly added Pod2 into the node configuration file, and the corresponding 7848 detection port will also detect the operation condition of all other pods (i.e. Pod 1) in the node configuration file, and since the 8848 port of Pod1 can normally provide service to the outside, pod2 can normally provide service to the outside through health check and also start to provide service to the outside through the 8848 port, i.e. at this time, both the 8848 ports of Pod1 and Pod2 can provide service to the outside.
When Pod3 is newly added, the monitoring tool will update the information of the newly added Pod3 into the node configuration file, and the corresponding 7848 detection port will also detect the operation condition of all other pods (i.e. Pod1 and Pod 2) in the node configuration file, and since the 8848 ports of Pod1 and Pod2 can normally provide services to the outside, pod3 can normally provide services to the outside through health check and also start to provide services to the outside through 8848 ports, i.e. at this time, the 8848 ports of Pod1, pod2 and Pod3 can all provide services to the outside.
It should be noted that, when there are more nodes to be deployed or capacity expansion is required, the implementation is also performed in the above manner.
In some embodiments of the present application, after health checking the Nacos cluster node according to the updated node configuration file, the method further includes: in the case that the Nacos cluster node passes the health check, services are provided outside through the service port of the Nacos cluster node.
As described above, if the current Nacos cluster node passes the health check, the service can be provided to the outside through the 8848 port, and the service can be provided to the outside without waiting for all the designated nodes to pass the health check, thereby solving the problem of node ready waiting.
In some embodiments of the present application, after running the Nacos cluster node if the Nacos cluster node passes the health check, the method further comprises: monitoring the resource use state of Nacos cluster nodes through a preset monitoring tool; and adjusting JVM parameters of the Nacos cluster nodes according to the resource use states of the Nacos cluster nodes.
The preset monitoring TOOL APP-TOOL of the embodiment of the application can also monitor the process resource use condition, and under the deployment scheme of the built-in data source, the embodiment of the application can monitor the resource use condition of the service process in real time, and the memory use condition is self-defined and adjusted according to the monitoring data, so that the application running stability and the cluster resource utilization rate are improved.
In some embodiments of the present application, the adjusting the JVM parameter of the Nacos cluster node according to the resource usage status of the Nacos cluster node includes: if the resource use state of the Nacos cluster node is memory overflow, expanding JVM parameters of the Nacos cluster node; if the resource use state of the Nacos cluster node is memory leakage, reducing JVM parameters of the Nacos cluster node.
After each node of the Nacos cluster is started to perform formal starting operation, the resource use condition of the service process of the node Pod, including the use rate, the disk space and other resource use information, can be monitored through a preset monitoring tool, wherein the resource use condition mainly comprises two types, namely memory overflow and memory leakage. Memory overflow refers to the fact that a program does not have enough memory space for it to use when applying for memory. Memory leak refers to the inability of a program to free the memory space already being applied after applying for memory.
If the memory overflows, the JVM parameters can be automatically modified and expanded, and if the memory leaks, the JVM parameters are automatically reduced, alarm logs are output, and the running stability of the application and the cluster resource utilization rate are improved. In particular, how to adjust JVM parameters, those skilled in the art may flexibly set in connection with actual service scenarios, which are not specifically limited herein.
In order to facilitate understanding of the foregoing embodiments, as shown in fig. 4, a timing diagram of implementing node monitoring by a preset monitoring tool in an embodiment of the present application is provided. Nacos deployment interacts with a Kubernetes API, and a preset monitoring TOOL APP-TOOL is used for monitoring the change of DNS number in Headset Service in real time and updating Nacos cluster configuration files, so that the problem of node ready waiting of Nacos Service in stateful deployment is solved, and Service process resource use conditions in a node Pod are monitored after the node is started successfully. The method comprises the following specific steps:
s1: the Nacos assembly is deployed through a script, a scheduling API Server of the Kubernetes starts up Pod copies, and Nacos cluster nodes are created;
s2: the method comprises the steps that a monitoring TOOL APP-TOOL is preset to monitor the change of Headset Service of Nacos in real time, and when a new Pod is created, the number of DNS in the Headset Service changes;
s3: according to the change monitored in the step S2, updating the new Pod instance into a node configuration file cluster;
s4: the Kubernetes performs Health Check according to a Health Check strategy configured in the Nacos script, and at this time, the 7848 detection port of the Nacos monitors the running conditions of all the examples in the cluster.
S5: according to the monitoring result of the step S4, all the examples in the cluster are started successfully, if the node Pod passes the health check, the service port 8848 of the Nacos starts to provide service to the outside;
s6: according to the health check result of the step S5, feeding back the health check result to the Kubernetes cluster, and continuously executing the step S1 and the following operations by the Kubernetes cluster according to the copy number configured in the Nacos deployment script until the copy number reaches the required number;
s7: after each node of the Nacos cluster is successfully started, a preset monitoring tool starts to monitor the resource use condition of the service process in the node Pod, if memory overflow occurs, JVM parameters are automatically modified and expanded, if memory leakage occurs, the JVM parameters are automatically reduced, alarm logs are output, and the application running stability and the cluster resource utilization rate are improved.
In summary, the design idea of the application is as follows:
the capacity of the Kubernetes cluster to deploy Nacos to cooperate with a code packet independently developed to monitor the Headset Service change of the Nacos component in real time, newly-appearing node Pod information is updated and written into a Nacos cluster configuration file in real time by monitoring the change of DNS number, the problem that health check fails due to the fact that 7848 monitoring ports cannot detect the states of other nodes due to Pod sequential starting in a Nacos stateful deployment mode is solved, and under the deployment scheme of an internal data source, the resource utilization condition of a Service process can be monitored in real time, and the memory utilization condition is regulated in a self-defining mode according to monitoring data.
The deployment method of the Nacos cluster at least has the following technical effects:
1) The aim of monitoring the Headset Service of the Nacos cluster in real time is fulfilled by adding an implementation method into the starting file, and when the cluster generates a new Pod, new cluster node information is written into the cluster configuration file, so that a health check deployment scheme of the Nacos cluster configuration is realized, and the flexibility of container cluster deployment Service is reserved;
2) In the aspect of operation and maintenance, the number expansion of cluster nodes and editing of information such as service names or Pod names are convenient to realize at any time;
3) The method can realize real-time monitoring of the service process, improves the running stability of the application and the utilization rate of cluster resources, and does not need to rely on a third party component.
In this embodiment, as shown in fig. 5, a configuration schematic diagram of a deployment apparatus of a Nacos cluster is provided, where the apparatus 500 includes: a creation unit 510, a monitoring unit 520, an updating unit 530, and a health check unit 540, wherein:
a creating unit 510, configured to deploy a Nacos component in a Kubernetes cluster environment and create a Nacos cluster node;
the monitoring unit 520 is configured to monitor whether the Nacos cluster node changes;
an updating unit 530, configured to update a node configuration file of the Nacos cluster in the case that a node of the Nacos cluster changes;
and the health checking unit 540 is configured to perform health checking on the Nacos cluster node according to the updated node configuration file.
In some embodiments of the present application, the monitoring unit 520 is specifically configured to: and monitoring whether the Nacos cluster nodes are changed or not through a preset monitoring tool, wherein the preset monitoring tool is mounted in the Nacos cluster nodes in a container initializing mode.
In some embodiments of the present application, the monitoring unit 520 is specifically configured to: monitoring whether the DNS quantity in the headless service of the Nacos cluster is changed; if the DNS number in the headless service changes, determining that the Nacos cluster node changes; otherwise, determining that the Nacos cluster node is unchanged.
In some embodiments of the present application, the health check unit 540 is specifically configured to: detecting the running states of all nodes in the updated node configuration file by using the detection ports of the Nacos cluster nodes according to the updated node configuration file; and if all the nodes in the updated node configuration file are started successfully, determining that the Nacos cluster nodes pass the health check.
In some embodiments of the present application, the apparatus further comprises: and the service unit is used for providing service to the outside through a service port of the Nacos cluster node under the condition that the Nacos cluster node passes the health check.
In some embodiments of the present application, the monitoring unit 520 is further configured to: under the condition that the Nacos cluster node passes the health check, after the Nacos cluster node is operated, monitoring the resource use state of the Nacos cluster node through a preset monitoring tool; the apparatus further comprises: and the adjusting unit is used for adjusting JVM parameters of the Nacos cluster nodes according to the resource use states of the Nacos cluster nodes.
In some embodiments of the present application, the adjusting unit is specifically configured to: if the resource use state of the Nacos cluster node is memory overflow, expanding JVM parameters of the Nacos cluster node; if the resource use state of the Nacos cluster node is memory leakage, reducing JVM parameters of the Nacos cluster node.
It can be understood that the above-mentioned deployment device for the Nacos cluster can implement each step of the deployment method for the Nacos cluster provided in the foregoing embodiment, and the relevant explanation about the deployment method for the Nacos cluster is applicable to the deployment device for the Nacos cluster, which is not described herein again.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 6, at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 6, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs, and the deployment device of the Nacos cluster is formed on the logic level. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
monitoring whether Nacos cluster nodes change;
under the condition that Nacos cluster nodes change, updating a node configuration file of the Nacos cluster;
and carrying out health check on the Nacos cluster nodes according to the updated node configuration file.
The method executed by the deployment device of the Nacos cluster disclosed in the embodiment shown in fig. 2 of the present application can be applied to a processor or implemented by the processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software modules in a decoded processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
The electronic device may further execute the method executed by the deployment device of the Nacos cluster in fig. 2, and implement the function of the deployment device of the Nacos cluster in the embodiment shown in fig. 2, which is not described herein again.
The embodiments of the present application also provide a computer readable storage medium storing one or more programs, where the one or more programs include instructions, which when executed by an electronic device that includes a plurality of application programs, enable the electronic device to perform a method performed by a deployment apparatus of a Nacos cluster in the embodiment shown in fig. 2, and specifically is configured to perform:
deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
monitoring whether Nacos cluster nodes change;
under the condition that Nacos cluster nodes change, updating a node configuration file of the Nacos cluster;
and carrying out health check on the Nacos cluster nodes according to the updated node configuration file.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (10)

1. A method for deploying a Nacos cluster, the method comprising:
deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
monitoring whether Nacos cluster nodes change;
under the condition that Nacos cluster nodes change, updating a node configuration file of the Nacos cluster;
and carrying out health check on the Nacos cluster nodes according to the updated node configuration file.
2. The method of claim 1, wherein monitoring whether a change occurs in a node of a Nacos cluster comprises:
and monitoring whether the Nacos cluster nodes are changed or not through a preset monitoring tool, wherein the preset monitoring tool is mounted in the Nacos cluster nodes in a container initializing mode.
3. The method of claim 1, wherein monitoring whether a change occurs in a node of a Nacos cluster comprises:
monitoring whether the DNS quantity in the headless service of the Nacos cluster is changed;
if the DNS number in the headless service changes, determining that the Nacos cluster node changes;
otherwise, determining that the Nacos cluster node is unchanged.
4. The method for deploying a Nacos cluster according to claim 1, wherein the performing health check on the Nacos cluster node according to the updated node configuration file comprises:
detecting the running states of all nodes in the updated node configuration file by using the detection ports of the Nacos cluster nodes according to the updated node configuration file;
and if all the nodes in the updated node configuration file are started successfully, determining that the Nacos cluster nodes pass the health check.
5. The method of claim 1, wherein after health checking the Nacos cluster nodes according to the updated node configuration file, the method further comprises:
in the case that the Nacos cluster node passes the health check, services are provided outside through the service port of the Nacos cluster node.
6. The method of claim 1, wherein, in the case where the Nacos cluster node passes the health check, after running the Nacos cluster node, the method further comprises:
monitoring the resource use state of Nacos cluster nodes through a preset monitoring tool;
and adjusting JVM parameters of the Nacos cluster nodes according to the resource use states of the Nacos cluster nodes.
7. The method of claim 6, wherein adjusting the JVM parameters of the Nacos cluster node according to the resource usage status of the Nacos cluster node comprises:
if the resource use state of the Nacos cluster node is memory overflow, expanding JVM parameters of the Nacos cluster node;
if the resource use state of the Nacos cluster node is memory leakage, reducing JVM parameters of the Nacos cluster node.
8. A deployment apparatus for a Nacos cluster, the apparatus comprising:
the creation unit is used for deploying Nacos components and creating Nacos cluster nodes in a Kubernetes cluster environment;
the monitoring unit is used for monitoring whether the Nacos cluster nodes change or not;
the updating unit is used for updating the node configuration file of the Nacos cluster under the condition that the nodes of the Nacos cluster are changed;
and the health checking unit is used for carrying out health checking on the Nacos cluster nodes according to the updated node configuration file.
9. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform the method of any of claims 1 to 7.
10. A computer readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform the method of any of claims 1-7.
CN202311702106.1A 2023-12-12 2023-12-12 Nacos cluster deployment method and device and electronic equipment Pending CN117834430A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311702106.1A CN117834430A (en) 2023-12-12 2023-12-12 Nacos cluster deployment method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311702106.1A CN117834430A (en) 2023-12-12 2023-12-12 Nacos cluster deployment method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117834430A true CN117834430A (en) 2024-04-05

Family

ID=90510551

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311702106.1A Pending CN117834430A (en) 2023-12-12 2023-12-12 Nacos cluster deployment method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117834430A (en)

Similar Documents

Publication Publication Date Title
US10237118B2 (en) Efficient application build/deployment for distributed container cloud platform
US9996331B1 (en) Customized application state transition
CN111026414B (en) HDP platform deployment method based on kubernetes
CN108616599B (en) Method and device for registering and updating application service
CN109614167B (en) Method and system for managing plug-ins
CN106294113B (en) creation method and device based on programmable test service
CN106708608B (en) Distributed lock service method, acquisition method and corresponding device
CN114422618B (en) Cloud-protogenesis-based IOT platform protocol adaptation method, device, equipment and medium
CN113190282A (en) Android operating environment construction method and device
CN110716845A (en) Method for reading log information of Android system
CN111694639B (en) Updating method and device of process container address and electronic equipment
CN116049207A (en) Application SQL script processing method and device, processor and electronic equipment
CN112564956A (en) Remote upgrading method, equipment and device for client and storage medium
CN112698979A (en) Method and device for processing zookeeper double nodes, storage medium and processor
CN110958138B (en) Container expansion method and device
CN114676030A (en) System test method, device, proxy server equipment and storage medium
CN116382713A (en) Method, system, device and storage medium for constructing application mirror image
CN111949297A (en) Block chain intelligent contract upgrading method and device and electronic equipment
CN117834430A (en) Nacos cluster deployment method and device and electronic equipment
CN116319806A (en) Service deployment method, device, equipment, storage medium and computer program product
CN111026502B (en) Business debugging architecture creating method and device, electronic equipment and storage medium
CN116048618A (en) Probe processing method, system, electronic device and readable storage medium
CN113467893B (en) Automatic testing method and device for virtual machine, storage medium and processor
CN111198694A (en) Software installation method and device
CN111435320B (en) Data processing method and device

Legal Events

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