CN111835685B - Method and server for monitoring running state of Nginx network isolation space - Google Patents

Method and server for monitoring running state of Nginx network isolation space Download PDF

Info

Publication number
CN111835685B
CN111835685B CN201910320302.XA CN201910320302A CN111835685B CN 111835685 B CN111835685 B CN 111835685B CN 201910320302 A CN201910320302 A CN 201910320302A CN 111835685 B CN111835685 B CN 111835685B
Authority
CN
China
Prior art keywords
target
server
isolation space
nginx
network isolation
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.)
Active
Application number
CN201910320302.XA
Other languages
Chinese (zh)
Other versions
CN111835685A (en
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.)
Xiamen Wangsu Co Ltd
Original Assignee
Xiamen Wangsu 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 Xiamen Wangsu Co Ltd filed Critical Xiamen Wangsu Co Ltd
Priority to CN201910320302.XA priority Critical patent/CN111835685B/en
Publication of CN111835685A publication Critical patent/CN111835685A/en
Application granted granted Critical
Publication of CN111835685B publication Critical patent/CN111835685B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • H04L63/0209Architectural arrangements, e.g. perimeter networks or demilitarized zones
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/16Multipoint routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/22Alternate routing

Abstract

The invention discloses a method and a server for monitoring the running state of an Nginx network isolation space, which relate to the technical field of cloud computing, wherein the method comprises the following steps: establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack; creating a corresponding virtual interface for each network isolation space through the Nginx process; monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by a local machine; and determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface. The invention can realize effective monitoring of the running state of each network isolation space in the Nginx process.

Description

Method and server for monitoring running state of Nginx network isolation space
Technical Field
The invention relates to the technical field of cloud computing, in particular to a method and a server for monitoring an operation state of an Nginx network isolation space.
Background
With the rapid development of cloud computing technology, internet service providers can create different network isolation spaces for different users in one server through network isolation technology, and provide network services for different users through different network isolation spaces.
In order to ensure the service quality of the network isolation space, the Linux system provides a method for monitoring the operation state of the network isolation space running in the kernel space, each network isolation space in the method corresponds to a keepalive process and a Nginx process respectively, each Nginx process can provide an interface for the monitoring of the keepalive process, the state of the interface can represent the operation state of the corresponding network isolation space, when the state of the interface is up, the operation state of the network isolation space is available, and when the state of the interface is down, the operation state of the network isolation space is a fault, so that the keepalive process can determine the operation state of the corresponding network isolation space through the states of the interfaces of different Nginx processes. Thus, a large amount of system resources are occupied. In order to solve the above problem, in the prior art, a network isolation space may be created inside a Nginx process based on a user mode protocol stack, and the running state of the Nginx process is determined by monitoring the state of an interface of a single Keepalived process. Therefore, the running state of the Nginx process can only be monitored, and the running state of each network isolation space in the Nginx process cannot be monitored. Therefore, a method for effectively monitoring the operation state of each network isolation space inside the Nginx process, which is applied under the user mode protocol stack, is urgently needed at present.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and a server for monitoring an operating state of an nginnx network isolation space. The technical scheme is as follows:
in a first aspect, a method for monitoring an operation state of an Nginx network isolation space is provided, where the method includes:
establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack;
creating a corresponding virtual interface for each network isolation space through the Nginx process;
monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local computer;
and determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface.
Optionally, the method is applied to the master/slave servers corresponding to each other;
the method for creating a plurality of network isolation spaces in the locally operated Nginx process based on the user mode protocol stack comprises the following steps:
and the master/standby server creates a network isolation space corresponding to each user in a Nginx process operated by the local machine based on a user mode protocol stack according to the preset Nginx configuration files of a plurality of users.
Optionally, after the creating, based on the user mode protocol stack, a plurality of network isolation spaces inside the locally running Nginx process, the method further includes:
the master/standby server configures a virtual IP corresponding to each user for each network isolation space;
and the main server provides Nginx service for each user through each network isolation space created by the main server locally based on the virtual IP corresponding to each user.
Optionally, after determining, based on the state of each virtual interface, the operating state of the network isolation space corresponding to each virtual interface through the keepalive process, the method further includes:
if the running state of the target main isolation space is normal, the main server periodically sends a target VRRP message corresponding to the target main isolation space to the standby server through a keepalive process running by the local machine;
if the running state of the target main isolation space is a fault, the main server stops providing the Nginx service for the target user corresponding to the target main isolation space through the target main isolation space and stops sending the target VRRP message to the standby server;
and if the standby server does not receive the target VRRP message for the preset duration, determining a target standby isolation space which is created by a local machine and corresponds to the target VRRP message, and providing Nginx service for a target user corresponding to the target main isolation space through the target standby isolation space based on the virtual IP corresponding to the target main isolation space.
Optionally, the creating, according to the preset nginnx configuration files of the multiple users, a network isolation space corresponding to each user in a locally-operated nginnx process based on a user mode protocol stack includes:
dividing the plurality of users into a plurality of VRRP groups through a locally operated Nginx process;
for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form;
and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
Optionally, after determining, based on the state of each virtual interface, the operating state of the network isolation space corresponding to each virtual interface through the keepalive process, the method further includes:
if the running states of all network isolation spaces in a target main VRRP group are normal, the main server periodically sends a target VRRP group message corresponding to the target main VRRP group to the standby server through a keepalive process running by a local machine;
if the target main VRRP group has a network isolation space with a fault operation state, the main server stops providing Nginx service for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stops sending the target VRRP group message to the standby server;
and if the standby server does not receive the target VRRP group message for the duration of preset time, determining a locally created target standby VRRP group corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group.
In a second aspect, a server for monitoring an operating status of a Nginx network isolation space is provided, the server being configured to:
establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack;
creating a corresponding virtual interface for each network isolation space through the Nginx process;
monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local computer;
and determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface.
Optionally, the server is a master/slave server corresponding to each other;
the master/backup server is configured to:
according to preset Nginx configuration files of a plurality of users, a network isolation space corresponding to each user is created in a Nginx process running in a machine on the basis of a user mode protocol stack.
Optionally, the master/backup server is further configured to configure a virtual IP corresponding to each user for each network isolation space;
the main server is further configured to:
and providing Nginx service for each user through each locally created network isolation space based on the virtual IP corresponding to each user.
Optionally, the main server is further configured to:
if the running state of the target main isolation space is normal, periodically sending a target VRRP message corresponding to the target main isolation space to the standby server through an keep process running on a local machine;
if the running state of the target main isolation space is a fault, stopping providing Nginx service for a target user corresponding to the target main isolation space through the target main isolation space, and stopping sending the target VRRP message to the standby server;
the standby server is further configured to:
and if the target VRRP message is not received for the duration of preset time, determining a target backup isolation space created by a local machine corresponding to the target VRRP message, and providing Nginx service for a target user corresponding to the target main isolation space through the target backup isolation space based on the virtual IP corresponding to the target main isolation space.
Optionally, the master/slave server is specifically configured to:
dividing the plurality of users into a plurality of VRRP groups through a locally operated Nginx process;
for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form;
and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
Optionally, the main server is further configured to:
if the running states of all network isolation spaces in the target main VRRP group are normal, periodically sending a target VRRP group message corresponding to the target main VRRP group to the standby server through a Keepalived process run by the local machine;
if the target main VRRP group has a network isolation space with a fault operation state, stopping providing Nginx service for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stopping sending the target VRRP group message to the standby server;
the standby server is further configured to:
and if the target VRRP group message is not received for the duration of preset time, determining a locally created target standby VRRP group corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group.
In a third aspect, a server is provided, which includes a processor and a memory, where at least one instruction, at least one program, a set of codes, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement the method for monitoring the operation state of the Nginx network isolation space according to the first aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement the method of monitoring the operational status of a Nginx network isolation space according to the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, a plurality of network isolation spaces are created in the Nginx process operated by a local machine based on a user mode protocol stack; creating a corresponding virtual interface for each network isolation space through the Nginx process; monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local computer; and determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface. Therefore, a virtual interface is created for each network isolation space in the Nginx process, and the running state of each network isolation space is determined by monitoring the state of the virtual interface, so that the running state of each network isolation space in the Nginx process can be effectively monitored under a user mode protocol stack.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for monitoring an operation status of an nginnx network isolation space according to an embodiment of the present invention;
fig. 2 is a schematic view of a scenario for monitoring an operating state of an isolated space of an Nginx network according to an embodiment of the present invention;
fig. 3 is a schematic view of a scenario for monitoring an operating state of an isolated space of an nginnx network according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The embodiment of the invention provides a method for monitoring the running state of a Nginx network isolation space, which can be applied to a server for providing Nginx service in a cloud computing system, wherein the server can be provided with a user mode protocol stack based on DPDK or other technologies, and the server can process received user messages through a Nginx program running on the user mode protocol stack. A keepalive process for detecting the service state of the Nginx may also be run on the server, and specifically, the server may monitor the running state of each network isolation space inside the Nginx process based on the user mode protocol stack through the keepalive process. The server may include a processor, a memory, and a transceiver, where the processor may be configured to perform the method for monitoring the operation status of the Nginx network isolation space in the following process, the memory may be configured to store data required and generated in the following process, and the transceiver may be configured to receive and transmit related data in the following process.
The following will describe in detail a process flow of the method for monitoring the operation status of the nginnx network isolation space shown in fig. 1 with reference to the specific embodiment, which may be as follows:
step 101: a plurality of network isolation spaces are created inside a locally running Nginx process based on a user mode protocol stack.
In implementation, a Nginx program may be installed on a server, and the Nginx program may perform various business processes on a user mode protocol stack of the server, so that the server can serve as a web server, a reverse proxy server or an email proxy server to provide a Nginx service for a user in a cloud computing system. When the Nginx program is started for the first time or restarted due to a fault, the server can run the Nginx process locally, and a plurality of network isolation spaces are created in the Nginx process based on a user mode protocol stack. Here, the specific number of the network isolation spaces may be preset on the server by the administrator, or may be automatically recorded by the server according to the number of the network isolation spaces used by the previous Nginx program run. If the number of the actually required network isolation spaces is larger than the number of the set network isolation spaces, the network isolation spaces can be additionally arranged at any time in the running process of the Nginx program.
Step 102: and creating a corresponding virtual interface for each network isolation space through the Nginx process.
In implementation, after the server creates a plurality of network isolation spaces inside the Nginx process, an independent virtual interface can be created for each network isolation space through the Nginx process, and each virtual interface corresponds to one network isolation space. The virtual interface can be used for at least monitoring the state, the running state of each network isolation space corresponds to the interface state of the virtual interface, and when the running state of the network isolation space is normal, the state of the corresponding virtual interface can be 'up'; when the operation state of the network isolation space is a fault, the state of the corresponding virtual interface may be "down".
Step 103: and monitoring the virtual interface corresponding to each network isolation space through a Keepalived process operated by the local machine.
In implementation, after the server creates the virtual interface through the nginn process, the keepalive process may be started, and the virtual interface corresponding to each network isolation space may be provided to the keepalive process through the nginn process. Then, as shown in fig. 2, the server may monitor the virtual interface corresponding to each network isolation space through a locally run Keepalived process.
Step 104: and determining the running state of the network isolation space corresponding to each virtual interface through a Keeplived process based on the state of each virtual interface.
In implementation, after the server monitors the state of each virtual interface through the keepalive process, the server may determine, through the keepalive process, an operating state of the network isolation space corresponding to each virtual interface based on the monitored state of each virtual interface. Taking a virtual interface monitored by the Keepalived process as an interface 1 as an example, assuming that the state of the interface 1 is "up", the server can determine that the running state of the network isolation space corresponding to the interface 1 is normal through the Keepalived process; assuming that the state of the interface 1 is "down", the server may determine that the operation state of the network isolation space corresponding to the interface 1 is a fault through the Keepalived process.
Optionally, a server architecture of the primary/secondary server may be used to provide an external Nginx service, and correspondingly, the method for monitoring the operation state of the isolated space of the Nginx network may be simultaneously applied to the primary/secondary servers corresponding to each other, where the processing of step 101 may be as follows: the main/standby server creates a network isolation space corresponding to each user in a locally operated Nginx process based on a user mode protocol stack according to preset Nginx configuration files of a plurality of users.
In the implementation, as shown in fig. 3, in consideration of the situation that a network isolation space inside a single server provides a network service for a user, when the server fails, a nginnx service cannot be continuously provided for the user, and thus the quality of the network service is affected, for this reason, a technician of an internet service provider may provide the nginnx service based on a main/standby server architecture and simultaneously apply the processing of the above steps 101 to 104 to the main/standby servers corresponding to each other. For the step of creating the network isolation space, a technician of an internet service provider may set a Nginx configuration file corresponding to each user in a master/standby server, and the master/standby server may load the Nginx configuration file corresponding to each user through a locally operated Nginx process, respectively, so as to create the network isolation space corresponding to each user inside the Nginx process. It can be understood that the number of the network isolation spaces created on the primary/secondary server is consistent, and the network isolation spaces are in one-to-one correspondence with the primary and secondary servers.
Optionally, the master/standby server may configure a different virtual IP for each network isolation space to provide an Nginx service for different users, and accordingly, after step 101, the following processing may be performed: the master/standby server configures a virtual IP corresponding to each user for each network isolation space; and the main server provides Nginx service for each user through each network isolation space created by the main server locally based on the virtual IP corresponding to each user.
In implementation, after the host/standby server creates a plurality of network isolation spaces in an Nginx process based on a user mode Protocol stack, a configuration file of a keepalive process may be set, where the configuration file of the keepalive process may include various types of configuration information such as global configuration information and VRRP (Virtual Router Redundancy Protocol) configuration information. The global configuration information may include information such as a recipient address of the VRRP packet and a server identifier under the primary/backup server architecture. The VRRP configuration information may include configuration information such as a VRRP synchronization group, a VRRP _ instance (hereinafter, referred to as a VRRP group), and the like, where the VRRP synchronization group may include information such as an identifier of each VRRP group and an execution script when the master/backup state is switched, and the VRRP _ instance may include information such as an initial state of a server, a source address for sending a VRRP packet, a priority of the server, and a virtual IP corresponding to each user. Then, the primary/standby server may configure a virtual IP corresponding to each user for each network isolation space based on the configuration file of the keepalive process. Then, the server can determine a main server and a standby server through the keepalive process based on different priorities of different servers, the main server allocates the virtual IP corresponding to each user to the corresponding network isolation space through the keepalive process, and provides the Nginx service for the corresponding user through the corresponding network isolation space based on the different virtual IP corresponding to each user.
Optionally, the server may divide the multiple network isolation spaces into one VRRP group, and accordingly, the process of creating the network isolation space may specifically be as follows: dividing a plurality of users into a plurality of VRRP groups through a Nginx process operated by a local machine; for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form; and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
In implementation, when the server creates a network isolation space inside a locally running Nginx process based on a user mode protocol stack, all users may be grouped first. Specifically, the server may divide all users into a plurality of VRRP groups through a locally run Nginx process, and each VRRP group may be divided into one or more users. Then, the server can configure the Nginx configuration files of the users included in each VRRP group into the corresponding VRRP group in a linked list mode. If six users, namely user A, user B, user C, user D, user E and user F, exist in total, the server can divide the users into two VRRP groups, for example, user A, user B and user C correspond to the VRRP group 1, user D, user E and user F correspond to the VRRP group 2, then the server can configure the Nginx configuration files of each user A, user B and user C into the VRRP group 1 in a chain table mode, and configure the Nginx configuration files of user D, user E and user F into the VRRP group 2 in a chain table mode. Then, the server can load all the configuration files of the users in each VRRP group through the Nginx process, and then create the network isolation space included in each VRRP group inside the Nginx process based on the user mode protocol stack according to the Nginx configuration files.
Optionally, the main server may notify the running state of the network isolation space on the standby server in a manner of sending a VRRP packet to the standby server, and if the standby server does not receive a VRRP packet of a certain network isolation space sent by the main server for a certain duration, it may be determined that the network isolation space on the main server fails, and accordingly, after step 104, the following processing may be performed: if the running state of the target main isolation space is normal, the main server periodically sends a target VRRP message corresponding to the target main isolation space to the standby server through a keepalive process running by the local machine; if the running state of the target main isolation space is a fault, the main server stops providing the Nginx service for the target user corresponding to the target main isolation space through the target main isolation space and stops sending a target VRRP message to the standby server; and if the target VRRP message is not received within the continuous preset time, the standby server determines a target standby isolation space created by the local machine corresponding to the target VRRP message, and provides Nginx service for a target user corresponding to the target main isolation space through the target standby isolation space based on the virtual IP corresponding to the target main isolation space.
In implementation, when the master server monitors that the state of the virtual interface corresponding to a certain network isolation space (which may be referred to as a target master isolation space) is "up" through the keepalive process, that is, the state of the target master isolation space is normal, the master server may generate a VRRP message (which may be referred to as a target VRRP message) corresponding to the target master isolation space through the keepalive process executed by the master server, where the target VRRP message may carry information such as an execution state of the target master isolation space and a space identifier of the target master isolation space, and periodically (e.g., every 1 second) sends the target VRRP message to the standby server. When the master server monitors that the state of the virtual interface corresponding to the target main isolation space is down through the keepalive process, that is, the state of the target main isolation space is a fault, the master server stops providing the Nginx service for a user (which may be called a target user) corresponding to the target main isolation space through the target main isolation space, and does not send a target VRRP message to the standby server through the keepalive process operated by the local server.
The standby server can record the current receiving time each time when receiving the target VRRP message corresponding to the target main isolation space, and if the standby server does not receive the target VRRP message within the preset time after receiving the target VRRP message, the standby server can determine the target standby isolation space created by the local machine corresponding to the target VRRP message, and then provide Nginx service for the target user through the target standby isolation space based on the virtual IP corresponding to the target main isolation space. Meanwhile, the standby server can also periodically send the VRRP message corresponding to the target standby isolation space to the main server through the Keepalived process operated by the local machine.
Optionally, when the server divides a plurality of network isolation spaces into one VRRP group, the main server may notify the standby server of the operating status of each network isolation space in the VRRP group by sending a VRRP group message to the standby server, and if the standby server does not receive a certain VRRP group message sent by the main server for a certain duration, the standby server may determine that a faulty network isolation space exists in the corresponding VRRP group on the main server, and accordingly, after step 104, the following processing may be performed: if the running states of all network isolation spaces in the target main VRRP group are normal, the main server periodically sends a target VRRP group message corresponding to the target main VRRP group to the standby server through a keepalive process operated by the local machine; if the target main VRRP group has a network isolation space with a fault operation state, the main server stops providing Nginx services for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stops sending a target VRRP group message to the standby server; and if the standby server does not receive the target VRRP group message within the continuous preset time, determining the target VRRP group created by the local machine corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target VRRP group.
In implementation, when the master server monitors that the states of the virtual interfaces corresponding to all the master isolation spaces in a certain VRRP group (which may be referred to as a target master VRRP group) are "up" through the locally run Keepalived process, the master server may determine that the running state of the target master VRRP group is normal. At this time, the master server may generate a VRRP group packet (which may be referred to as a target VRRP group packet) corresponding to the target master VRRP group through a keepalive process run by the local server, that is, one VRRP group corresponds to one VRRP group packet, and when a plurality of users are divided in one VRRP group, that is, a plurality of network isolation spaces are divided in one VRRP group, the number of VRRP packets may be effectively reduced. Then, the main server may periodically send the target VRRP group packet to the standby server, where the target VRRP group packet may carry at least the identification information of the target main VRRP group. When the main server monitors that the state of the virtual interfaces corresponding to one or more network isolation spaces in the target main VRRP group is down through the Keepalived process operated by the local machine, the main server can determine that the network isolation space with the fault operation state exists in the target main VRRP group. At this time, the master server may stop providing the Nginx service for the user through all the network isolation spaces in the target master VRRP group, and no longer send the target master VRRP group message to the standby server through the Keepalived process run by the local server.
The standby server can record the current receiving time each time when receiving the target VRRP group message, and if the standby server does not receive the target VRRP group message continuously within the preset time after receiving the target VRRP group message, the standby server can determine the target VRRP group created by the local machine corresponding to the target VRRP group message, specifically, the standby server can obtain the identification information of the target main VRRP group carried by the target VRRP group message through a keepalive process operated by the local machine, and then determine the target VRRP group created by the local machine corresponding to the target VRRP group message according to the identification information. And then, the standby server can provide the Nginx service for all target users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group. Meanwhile, the standby server can also periodically send the VRRP group message corresponding to the target standby VRRP group to the original main server through the Keepalived process operated by the local machine.
In the embodiment of the invention, a plurality of network isolation spaces are established in the locally operated Nginx process based on a user mode protocol stack; creating a corresponding virtual interface for each network isolation space through the Nginx process; monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local machine; and determining the running state of the network isolation space corresponding to each virtual interface through a Keeplived process based on the state of each virtual interface. Therefore, a virtual interface is created for each network isolation space in the Nginx process, and the running state of each network isolation space is determined by monitoring the state of the virtual interface, so that the running state of each network isolation space in the Nginx process can be effectively monitored under a user mode protocol stack.
Based on the same technical concept, the embodiment of the invention also provides a server for monitoring the running state of the Nginx network isolation space, wherein the server is used for:
establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack;
creating a corresponding virtual interface for each network isolation space through the Nginx process;
monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local computer;
and determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface.
Optionally, the server is a master/slave server corresponding to each other;
the master/backup server is configured to:
according to preset Nginx configuration files of a plurality of users, a network isolation space corresponding to each user is created in a Nginx process running in a machine on the basis of a user mode protocol stack.
Optionally, the master/backup server is further configured to configure a virtual IP corresponding to each user for each network isolation space;
the main server is further configured to:
and providing Nginx service for each user through each locally created network isolation space based on the virtual IP corresponding to each user.
Optionally, the main server is further configured to:
if the running state of the target main isolation space is normal, periodically sending a target VRRP message corresponding to the target main isolation space to the standby server through an keep process running on a local machine;
if the running state of the target main isolation space is a fault, stopping providing Nginx service for a target user corresponding to the target main isolation space through the target main isolation space, and stopping sending the target VRRP message to the standby server;
the standby server is further configured to:
and if the target VRRP message is not received for the duration of preset time, determining a target backup isolation space created by a local machine corresponding to the target VRRP message, and providing Nginx service for a target user corresponding to the target main isolation space through the target backup isolation space based on the virtual IP corresponding to the target main isolation space.
Optionally, the master/slave server is specifically configured to:
dividing the plurality of users into a plurality of VRRP groups through a Nginx process operated by a local machine;
for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form;
and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
Optionally, the main server is further configured to:
if the running states of all network isolation spaces in the target main VRRP group are normal, periodically sending a target VRRP group message corresponding to the target main VRRP group to the standby server through a Keepalived process run by the local machine;
if the target main VRRP group has a network isolation space with a fault operation state, stopping providing Nginx service for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stopping sending the target VRRP group message to the standby server;
the standby server is further configured to:
and if the target VRRP group message is not received for the duration of preset time, determining a locally created target standby VRRP group corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group.
In the embodiment of the invention, a plurality of network isolation spaces are created in the Nginx process operated by a local machine based on a user mode protocol stack; creating a corresponding virtual interface for each network isolation space through the Nginx process; monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by the local machine; and determining the running state of the network isolation space corresponding to each virtual interface through a Keeplived process based on the state of each virtual interface. Therefore, a virtual interface is created for each network isolation space in the Nginx process, and the running state of each network isolation space is determined by monitoring the state of the virtual interface, so that the running state of each network isolation space in the Nginx process can be effectively monitored under a user mode protocol stack.
It should be noted that: the server for monitoring the operation state of the isolated space of the nginnx network and the method for monitoring the operation state of the isolated space of the nginnx network provided in the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments, and are not described herein again.
Fig. 4 is a schematic structural diagram of a server according to an embodiment of the present invention. The server 400 may vary widely due to configuration or performance differences and may include one or more central processors 422 (e.g., one or more processors) and memory 432, one or more storage media 430 (e.g., one or more mass storage devices) storing applications 442 or data 444. Memory 432 and storage media 430 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 430 may include one or more modules (not shown), each of which may include a sequence of instructions operating on the server 400. Still further, the central processor 422 may be arranged to communicate with the storage medium 430, and execute a series of instruction operations in the storage medium 430 on the server 400.
The Server 400 may also include one or more power supplies 426, one or more wired or wireless network interfaces 450, one or more input-output interfaces 458, one or more keyboards 456, and/or one or more operating systems 441, such as Windows Server, mac OS X, unix, linux, freeBSD, and the like.
The server 400 may include memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors include instructions for performing the above-described monitoring of the operational status of the Nginx network isolation space.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (12)

1. A method for monitoring an operation state of an nginnx network isolation space, wherein the method is applied to mutually corresponding main/standby servers, and the method comprises:
establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack;
creating a corresponding virtual interface for each network isolation space through the Nginx process;
monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by a local machine;
determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface;
when the main/standby server divides a plurality of users into a plurality of VRRP groups through the Nginx process operated by the local machine and creates a corresponding network isolation space for each VRRP group, the main server sends a VRRP group message to the standby server to inform the standby server that the operation state of the network isolation space in each VRRP group on the standby server comprises:
if the running states of all network isolation spaces in a target main VRRP group are normal, the main server periodically sends a target VRRP group message corresponding to the target main VRRP group to the standby server through a keepalive process running by a local machine;
if the target main VRRP group has a network isolation space with a fault operation state, the main server stops providing Nginx service for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stops sending the target VRRP group message to the standby server;
and if the standby server does not receive the target VRRP group message for the duration of preset time, determining a locally created target standby VRRP group corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group.
2. The method of claim 1,
the method for creating a plurality of network isolation spaces in the locally operated Nginx process based on the user mode protocol stack comprises the following steps:
and the master/standby server creates a network isolation space corresponding to each user in a Nginx process operated by the local machine based on a user mode protocol stack according to the preset Nginx configuration files of a plurality of users.
3. The method of claim 2, wherein after creating the plurality of network isolation spaces within the natively running Nginx process based on the user mode protocol stack, further comprising:
the master/standby server configures a virtual IP corresponding to each user for each network isolation space;
and the main server provides Nginx service for each user through each network isolation space created by the main server locally based on the virtual IP corresponding to each user.
4. The method according to claim 3, wherein after determining the operating state of the network isolation space corresponding to each virtual interface through the keepalive process based on the state of each virtual interface, the method further comprises:
if the running state of the target main isolation space is normal, the main server periodically sends a target VRRP message corresponding to the target main isolation space to the standby server through a keepalive process running on the main server;
if the running state of the target main isolation space is a fault, the main server stops providing the Nginx service for the target user corresponding to the target main isolation space through the target main isolation space and stops sending the target VRRP message to the standby server;
and if the standby server does not receive the target VRRP message for the preset duration, determining a target standby isolation space which is created by a local machine and corresponds to the target VRRP message, and providing Nginx service for a target user corresponding to the target main isolation space through the target standby isolation space based on the virtual IP corresponding to the target main isolation space.
5. The method according to claim 3, wherein the creating a network isolation space corresponding to each user in a locally running Nginx process based on a user mode protocol stack according to a predetermined Nginx profile of a plurality of users comprises:
for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form;
and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
6. A server for monitoring an operation status of an nginnx network isolation space, wherein the server is a master/backup server corresponding to each other, and the master/backup server is configured to:
establishing a plurality of network isolation spaces in a locally operated Nginx process based on a user mode protocol stack;
creating a corresponding virtual interface for each network isolation space through the Nginx process;
monitoring a virtual interface corresponding to each network isolation space through a Keepalived process operated by a local machine;
determining the running state of the network isolation space corresponding to each virtual interface through the Keepalived process based on the state of each virtual interface;
when the main/standby server divides a plurality of users into a plurality of VRRP groups through a Nginx process operated by the local machine and creates a corresponding network isolation space for each VRRP group, the main server sends a VRRP group message to the standby server to inform the standby server that the operation state of the network isolation space in each VRRP group on the standby server comprises:
if the running states of all network isolation spaces in a target main VRRP group are normal, the main server periodically sends a target VRRP group message corresponding to the target main VRRP group to the standby server through a keepalive process running by a local machine;
if the target main VRRP group has a network isolation space with a fault operation state, the main server stops providing Nginx service for all users corresponding to the target main VRRP group through all network isolation spaces in the target main VRRP group, and stops sending the target VRRP group message to the standby server;
and if the standby server does not receive the target VRRP group message for the duration of preset time, determining a locally created target standby VRRP group corresponding to the target VRRP group message, and providing Nginx service for all users corresponding to the target main VRRP group based on all network isolation spaces in the target standby VRRP group.
7. The server according to claim 6, wherein the primary/backup server is configured to:
according to a preset Nginx configuration file of a plurality of users, a network isolation space corresponding to each user is created in a Nginx process running locally based on a user mode protocol stack.
8. The server according to claim 7, wherein the primary/backup server is further configured to configure a virtual IP corresponding to each user for each network isolation space;
the main server is further configured to:
and providing Nginx service for each user through each locally created network isolation space based on the virtual IP corresponding to each user.
9. The server according to claim 8, wherein the main server is further configured to:
if the running state of the target main isolation space is normal, periodically sending a target VRRP message corresponding to the target main isolation space to the standby server through a keepalive process running by a local machine;
if the running state of the target main isolation space is a fault, stopping providing Nginx service for a target user corresponding to the target main isolation space through the target main isolation space, and stopping sending the target VRRP message to the standby server;
the standby server is further configured to:
and if the target VRRP message is not received for a preset duration, determining a target standby isolation space created by a local machine corresponding to the target VRRP message, and providing Nginx service for a target user corresponding to the target main isolation space through the target standby isolation space based on a virtual IP corresponding to the target main isolation space.
10. The server according to claim 8, wherein the primary/secondary server is specifically configured to:
for each VRRP group, configuring Nginx configuration files of all users included in the VRRP group into the VRRP group in a linked list form;
and according to the Nginx configuration files of all users in each VRRP group, creating a network isolation space of each VRRP group in the Nginx process based on a user mode protocol stack.
11. A server, characterized in that the server comprises a processor and a memory, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, which is loaded and executed by the processor to implement the method of monitoring the operational status of a Nginx network isolation space according to any one of claims 1 to 5.
12. A computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the method of monitoring the operational status of an isolated space of an Nginx network as set forth in any one of claims 1-5.
CN201910320302.XA 2019-04-19 2019-04-19 Method and server for monitoring running state of Nginx network isolation space Active CN111835685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910320302.XA CN111835685B (en) 2019-04-19 2019-04-19 Method and server for monitoring running state of Nginx network isolation space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910320302.XA CN111835685B (en) 2019-04-19 2019-04-19 Method and server for monitoring running state of Nginx network isolation space

Publications (2)

Publication Number Publication Date
CN111835685A CN111835685A (en) 2020-10-27
CN111835685B true CN111835685B (en) 2022-10-28

Family

ID=72912140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910320302.XA Active CN111835685B (en) 2019-04-19 2019-04-19 Method and server for monitoring running state of Nginx network isolation space

Country Status (1)

Country Link
CN (1) CN111835685B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346899B (en) * 2020-11-06 2024-02-09 北京北信源软件股份有限公司 Micro-service performance optimization method and device
CN112787998B (en) * 2020-12-26 2022-04-08 郑州信大捷安信息技术股份有限公司 DPDK-based ALG implementation method and system
CN113098925B (en) * 2021-03-06 2022-03-11 郑州信大捷安信息技术股份有限公司 Method and system for realizing dynamic proxy based on F-Stack and Nginx
CN113992683B (en) * 2021-10-25 2024-02-13 重庆紫光华山智安科技有限公司 Method, system, equipment and medium for realizing effective isolation of double networks in same cluster

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100591046C (en) * 2007-03-27 2010-02-17 华为技术有限公司 A router and method for the router distributing the route information
KR101490548B1 (en) * 2008-12-05 2015-02-05 소우셜 커뮤니케이션즈 컴퍼니 Realtime kernel
CN101741742B (en) * 2009-12-18 2012-01-04 华为技术有限公司 Message processing method, access equipment and communication system
EP2796766A1 (en) * 2013-04-26 2014-10-29 Siemens Aktiengesellschaft Pressure vessel and method for monitoring its state
CN104899126B (en) * 2015-06-12 2018-01-23 北京奇虎科技有限公司 The local method, apparatus and system monitored in real time is carried out to container in host
CN105577632B (en) * 2015-06-26 2018-08-24 宇龙计算机通信科技(深圳)有限公司 A kind of safe networking methods and terminal based on Network Isolation
US11422840B2 (en) * 2015-08-28 2022-08-23 Vmware, Inc. Partitioning a hypervisor into virtual hypervisors
CN105760214B (en) * 2016-04-19 2019-02-26 华为技术有限公司 A kind of equipment state and resource information monitoring method, relevant device and system
CN106411589A (en) * 2016-09-29 2017-02-15 北京神州绿盟信息安全科技股份有限公司 Method and apparatus for realizing high availability
CN106506314B (en) * 2016-09-30 2019-12-17 北京赢点科技有限公司 Network high-availability method and device based on docker
CN108089968A (en) * 2017-12-13 2018-05-29 国云科技股份有限公司 A kind of method of host's machine monitoring virtual-machine data storehouse state

Also Published As

Publication number Publication date
CN111835685A (en) 2020-10-27

Similar Documents

Publication Publication Date Title
CN111835685B (en) Method and server for monitoring running state of Nginx network isolation space
US10635558B2 (en) Container monitoring method and apparatus
US10644952B2 (en) VNF failover method and apparatus
US11895016B2 (en) Methods and apparatus to configure and manage network resources for use in network-based computing
Yamato et al. Fast and reliable restoration method of virtual resources on OpenStack
US9141491B2 (en) Highly available server system based on cloud computing
CN105743692B (en) Policy-based framework for application management
WO2017181876A1 (en) Device state and resource information monitoring method, related device, and system
EP1697843B1 (en) System and method for managing protocol network failures in a cluster system
EP2979183B1 (en) Method and arrangement for fault management in infrastructure as a service clouds
US11567790B2 (en) Node regeneration in distributed storage systems
CN108347339B (en) Service recovery method and device
EP3206335B1 (en) Virtual network function instance migration method, device and system
US10120779B1 (en) Debugging of hosted computer programs
US20200127884A1 (en) Two-channel-based high-availability
CN111835684B (en) Network isolation monitoring method and system for haproxy equipment
JP2013008320A (en) Network system, redundancy method, failure detector and failure detection program
CN113709220B (en) High-availability implementation method and system of virtual load equalizer and electronic equipment
CN111835544B (en) Monitoring method and system of virtual router based on user mode protocol stack
US11757987B2 (en) Load balancing systems and methods
CN114760192A (en) Container switching method and node equipment
CN111385352A (en) Instance control method, node, terminal and distributed storage system
CN112994918B (en) Equipment management method and device
US20230289203A1 (en) Server maintenance control device, server maintenance system, server maintenance control method, and program
WO2024069847A1 (en) Dispersed deployment control for microservices

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
GR01 Patent grant
GR01 Patent grant