CN110266761B - Load balancing application creation method and device, computer equipment and storage medium - Google Patents

Load balancing application creation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110266761B
CN110266761B CN201910414034.8A CN201910414034A CN110266761B CN 110266761 B CN110266761 B CN 110266761B CN 201910414034 A CN201910414034 A CN 201910414034A CN 110266761 B CN110266761 B CN 110266761B
Authority
CN
China
Prior art keywords
container
application
lvs
load balancing
information
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
CN201910414034.8A
Other languages
Chinese (zh)
Other versions
CN110266761A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910414034.8A priority Critical patent/CN110266761B/en
Priority to PCT/CN2019/103260 priority patent/WO2020232890A1/en
Publication of CN110266761A publication Critical patent/CN110266761A/en
Application granted granted Critical
Publication of CN110266761B publication Critical patent/CN110266761B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0889Techniques to speed-up the configuration process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a load balancing application creation method and device, computer equipment and a storage medium, relates to the technical field of cloud computing, and can be applied to a PaaS platform. The method comprises the following steps: if a setting instruction is received, calling a preset setting interface according to the setting instruction so as to set information of the container application to be created and information of the LVS load balancing application through the preset setting interface; creating a container instance of the container application according to the set information of the container application; creating the LVS load balancing application according to the set information of the container application and the information of the load balancing application; configuring a subnet card of the LVS container; and adding a route for the configured sub-network card. According to the method and the device for creating the container application, the LVS load balancing application is created at the same time, the container application and the LVS load balancing application do not need to be created separately, the creating speed and efficiency are improved, and the time cost and the labor cost are saved.

Description

Load balancing application creation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a load balancing application creation method and apparatus, a computer device, and a storage medium.
Background
Currently, many PaaS platforms (Platform-as-a-Service) need to create a load balancing application for a container application when creating the container application. There are applications in the industry that use F5 load balancing, whereas F5 load balancing requires leased hardware resources, increasing costs. When other non-F5 load balancing applications are created in many existing PaaS platforms, creating a container application and creating the other non-F5 load balancing applications are separately created, that is, the container application is created separately, and when the other non-F5 load balancing applications are created, the association relationship between the created container application and the other non-F5 load balancing applications is configured manually. Therefore, the creating process and the configuration of the association relationship are complex, inconvenient and not fast, and errors are easy to occur.
Disclosure of Invention
Embodiments of the present application provide a method and an apparatus for creating a load balancing application, a computer device, and a storage medium, which can increase the speed and efficiency of creating a container application and creating an associated load balancing application.
In a first aspect, an embodiment of the present application provides a method for creating a load balancing application, where the method includes:
if a setting instruction is received, calling a preset setting interface according to the setting instruction to set information of container application to be created and information of load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Liunx Virtual Server (LVS); if a setting completion instruction is received, creating a container instance of the container application according to the set information of the container application; determining a host machine for creating the LVS load balancing application according to the set container application information, and creating an LVS container on the host machine; allocating a virtual IP for the created LVS container; reconstructing a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application and the port information; configuring a subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container; and adding a route for the configured sub-network card to finish creating the LVS load balancing application when creating the container application.
In a second aspect, an embodiment of the present invention provides a load balancing application creating apparatus, where the load balancing application creating apparatus includes a unit configured to execute the method according to the first aspect.
In a third aspect, an embodiment of the present invention provides a computer device, where the computer device includes a memory and a processor connected to the memory;
the memory is adapted to store a computer program and the processor is adapted to execute the computer program stored in the memory to perform the method of the first aspect.
In a fourth aspect, the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the method according to the first aspect.
According to the method and the device for creating the LVS load balancing application, the container creating application and the LVS load balancing application are created at the same time, so that the container creating application and the LVS load balancing application do not need to be created separately, and the creating speed is increased. The LVS load balancing application is created while the container application is created, the process is automatically completed, the creating speed and efficiency are further increased, and the time cost and the labor cost are saved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are 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 schematic flowchart of a load balancing application creation method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a setup interface provided by an embodiment of the present application;
fig. 3 is a sub-flow diagram of a load balancing application creation method provided in an embodiment of the present application;
FIG. 4 is a sub-flow diagram of FIG. 4 provided by an embodiment of the present application;
fig. 5 is a sub-flow diagram of a load balancing application creation method provided in an embodiment of the present application;
fig. 6 is a sub-flow diagram of a load balancing application creation method provided in an embodiment of the present application;
fig. 7 is a schematic block diagram of a load balancing application creation apparatus provided in an embodiment of the present application;
FIG. 8 is a schematic block diagram of an application creation unit provided by an embodiment of the present application;
FIG. 9 is a schematic block diagram of an example creation unit provided by an embodiment of the present application;
fig. 10 is a schematic block diagram of an LVS creating unit provided in an embodiment of the present application;
fig. 11 is a schematic block diagram of a reconstruction unit provided in an embodiment of the present application;
fig. 12 is a schematic block diagram of a computer device provided by an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a flowchart illustrating a load balancing application creation method according to an embodiment of the present application. As shown in fig. 1, the method includes S101-S108.
And S101, if a setting instruction is received, calling a preset setting interface according to the setting instruction to set information of the container application to be created and information of the load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Linux Virtual Server (LVS).
If a setting instruction is received, calling a preset setting interface according to the setting instruction so as to set information of the container application to be created and information of the load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is LVS; the information of the container application includes an application environment of the container application, a region of the container application, a number of container instances of the container application, and container application mirror information.
The preset setting interface is a setting interface written by a developer, and can be presented in the form of a setting page, as shown in fig. 2. And setting information of the container application to be created and information of the load balancing application through the preset setting interface. Specifically, information of a container application to be created and information of a load balancing application, which are input/selected by a user, are received. Because the information of the container application and the information of the load balancing application can be set in the preset creation interface, the information of the container application and the information of the load balancing application can be simultaneously acquired.
The information of the container application includes an application environment of the container application, an area of the container application, the number of container instances of the container application, mirror image information of the container application, and the like. The information of the container application also includes whether monitoring is enabled, an application administrator (the person who creates the container application, who can manage the created container application), a resource group of the container application, and the like. The application environment of the container application includes a production environment, a test environment, a development environment, and the like. Wherein, the production environment means that the container application is successfully created and then is connected to the external environment or is accessed by an external user; the test environment means that the container application is used for testing after being successfully created; the development environment means that the container application is successfully created and used for development. The area of the container application refers to a machine room location where the container application is created, and consists of two parts: "area" + "safe area". Wherein a "safe area" is a sub-area under the "area". It is understood that the container application is created in a machine room of "xxx safe area" under "xx area". However, determining in which specific machine room the container application is created needs to be determined according to the application environment of the container application and the area of the container application, and it can be understood that the container application is created in the machine room corresponding to the area of the container application in a certain application environment. It can be understood that the machine rooms corresponding to different application environments in the same area are different. The number of container instances for a container application refers to the number of containers for that container application, and there is no upper limit to the number of containers for a container application. Wherein, the number of container instances can be determined according to the access amount of the container application. The container instance mirror information includes a mirror version, a mirror type, and a mirror name. Wherein, the mirror image version comprises an official version, an official version 1.1, an official version 4.5 and the like; the mirror type refers to which mirror the container instance uses, such as nginx, tomcat, weblogic, springboot, etc.; mirror names refer to specific mirror names, such as tomcat1.1, etc. The mirror image information can be acquired from a corresponding mirror image warehouse for a user to select, wherein the corresponding mirror image warehouse refers to a mirror image warehouse in a machine room determined by the application environment of the container application and the area of the container application together. The creation of the container application is subject to a fee, and a resource account is included under the resource group of the container application for the fee used by the creation of the container application. Whether monitoring is enabled or not refers to whether monitoring on the container instance of the container application is selected, such as the use condition of resources such as CPU/memory/IO of the container instance. In some embodiments, the information of the container application further includes a beneficiary resource pool, which refers to a subsidiary/department that creates the container application, determines the IP network segment allocated by the created container and the host resources of the container, and different resource pools, which use different IP network segments and host resources. If the information of the container application further comprises the beneficiary resource pool, the beneficiary resource pool together with the application environment of the container application, the area of the container application determines the IP network segment allocated by the created container instance and the host resources of the container instance.
The information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, wherein the type of the load balancing application is LVS. The port information of the load balancing application may be one or more, and the port of the load balancing application refers to an access port supported by the LVS load balancing application, that is, a port accessed in http mode, such as 80,443, and the like. In this embodiment, the number of containers for the load balancing application defaults to 1.
And S102, if the setting completion instruction is received, creating a container instance of the container application according to the set information of the container application.
The setting completion instruction is triggered by a user clicking a button for submitting and the like, the information of the container application and the information of the load balancing application are set, and the setting completion instruction triggered by the user is received, so that the container application, the load balancing application and the incidence relation between the container application and the load balancing application can be automatically established.
In one embodiment, as shown in FIG. 3, step S102 includes the following steps S301-S302.
S301, determining a container instance IP of the container application according to the application environment of the container application, the area of the container application and the number of container instances of the container application in the set information of the container application.
S302, creating container instances according to the container application mirror image information, the application environment of the container application, the area of the container application and the number of the container instances of the container application in the set container application information, and setting the determined IP of the container instances as the IP of the created container instances.
The location of creating the container application, i.e. in which specific machine room the container application is created, can be determined according to the application environment of the container application and the area of the container application. Such as creating the container application in a computer room where SF (a smaller area identifier under the treasure letter) sub-area under the treasure letter (place name) area under the test environment is located. Acquiring an IP address pool which is pre-allocated at a corresponding position (below the machine room) in a database and is used for creating a container instance; and acquiring the idle IPs with the same number as the container instances of the container application from the IP address pool, and determining the idle IPs as the IPs of the container instances of the container application.
After the IP of the container instance for the container application is allocated, the container instance is then created. Specifically, as shown in fig. 4, the steps of creating a container instance according to the container application mirroring information in the set information of the container application, the application environment of the container application, the area of the container application, and the number of container instances of the container application, and setting the determined container instance IP as the IP of the created container instance, i.e., step S302, include the following steps S401 to S403.
S401, determining a mirror image warehouse used for storing mirror image information of the container application according to the application environment of the container application and the area of the container application, and extracting a specific mirror image needed for creating a container instance from the determined mirror image warehouse according to the mirror image type, the mirror image version and the mirror image name of the mirror image information of the container application.
S402, determining the resources required to be occupied for creating the container instance according to the container mirror image type, the mirror image version and the mirror image name, and determining the host for creating the container instance according to the application environment of the container application, the area of the container application and the resources required to be occupied for creating the container instance.
And S403, creating a container instance of the container application on the determined host according to the determined specific mirror image, and binding the created container instance with the determined container instance IP to set the determined container instance IP as the IP of the created container instance.
In the above process of creating the container instance, the determining of the specific mirror image and the determining of the execution sequence of the host that creates the container instance are not strictly limited, and in other embodiments, the host that creates the container instance may be determined first, and then the specific mirror image may be determined.
The location of creating the container application, that is, in which specific machine room the container application is created, can be determined according to the application environment of the container application and the area of the container application. It should be noted that in each application environment, a mirror repository for storing mirror resources is corresponding to each region. All mirror resources needed by the area in the application environment are saved in the mirror repository. Acquiring an IP address pool of a host machine which is pre-allocated at a corresponding position (below the machine room) in a database and used for creating a container instance; and determining the host machine for creating the container instance from the IP address pool of the host machine according to the resources occupied by creating the container instance. Creating a container instance requires occupying certain resources on the host, and therefore, it is necessary to determine the resources occupied by creating the container instance first to determine whether the host has enough resources to create the container instance. The resources occupied by creating the container instance include a CPU (CPU core number, etc.), a memory, monitoring resources, and the like.
Step S403, creating a container instance of the container application on the determined host according to the determined specific mirror image, and binding the created container instance with the determined container instance IP to set the determined container instance IP as the IP of the created container instance, includes: sending the determined specific mirror image to the determined host computer for creating the container instance through the container arrangement tool so as to create the container instance; if the creation is completed, the container instance is connected through an operation and maintenance tool such as an allowed tool, and the created container instance is bound with the determined container instance IP so as to set the determined container instance IP as the IP of the created container instance. After the container instance is successfully created, returning a message of successful creation; if the container instance fails to be created, the reason of the creation failure is returned. Wherein the container arrangement tool may be marathon.
In an embodiment, if the identifier in the monitoring enabling information in the information of the current container application is the monitoring enabling identifier, the above container application creation process also involves enabling monitoring for the container instance of the created container application, and the corresponding steps further include:
and pushing the enabling monitoring identification in the enabling monitoring information corresponding to the container instance to the determined host machine so as to collect the running data information of the container instance according to the monitoring process of the host machine. Wherein, the monitoring process is installed on all the hosts by default and is in an enabled state. And pushing the monitoring enabling identification to the determined host machine, and monitoring the container instance through a monitoring process installed on the host machine. Therefore, the related information of all container instances of the container application can be conveniently acquired, and the abnormity appearing in the container application can be conveniently positioned.
In an embodiment, as shown in fig. 3, before step S301, the step of creating a container instance of the container application according to the set information of the container application further includes:
s301a, generates an application name of the container application according to a preset name generation rule.
S301b, determining whether the generated application name already exists in the area corresponding to the container application, where the area corresponding to the container application is determined according to the application environment of the container application and the area of the container application. If the generated application name does not exist in the area corresponding to the container application, step S301 is executed. If the generated application name already exists in the area corresponding to the container application, step S301d is executed.
And S301d, presenting.
In an embodiment, as shown in fig. 3, before step S301, the step of creating a container instance of the container application according to the set information of the container application further includes:
s301c, judging whether there is enough money in the resource group of the container application to create the container instance of the container application according to the using time of the container instance, the resource group of the container application and the number of the container instances. If there is sufficient money to create a container instance for the container application, step S301 is performed. If there is not enough money to create the container instance for the container application, step S301d is performed.
The method comprises the steps of creating a container application, wherein the container application is used for storing relevant information of all created container applications in advance, and the stored information comprises application names and areas of the container applications. It is to be understood that two identical application names are not allowed to exist in the same area. Calculating the amount of money required to be paid for creating the current container application according to the number of container instances of the container application, the using time of the container instances and the cost of each container instance; judging whether the residual amount in the resource group of the container application is larger than or equal to the amount to be paid for creating the current container application; if so, determining that the resource group of the container application has enough money to be used for creating the corresponding container application; if not, determining that the resource group of the container application does not have enough money to be created.
S103, determining a host machine for creating the LVS load balancing application according to the set container application information, and creating the LVS container on the host machine.
The location of the container application creation, that is, the host of which specific machine room the container application is created in, can be determined according to the application environment of the container application and the area of the container application. It should be noted that, in general, the host where the container instance of the container application is located and the host where the load balancing application is located are not the same host, so as to avoid that the load balancing application cannot be used and the application service cannot be used after the host fails. In addition, the host machine where the container instance of the container application is located and the host machine where the load balancing application is located are usually in a network segment, so as to improve the speed of network access. It should be noted that the host cluster for creating the load balancing application and the host cluster for creating the container application may be the same host cluster, or may be different and independent host clusters. After the host machine for creating the load balancing application is determined, the LVS container for the LVS load balancing application is created.
In one embodiment, as shown in FIG. 5, step S103 includes the following steps S501-S503.
S501, determining the LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application.
And S502, determining a host machine for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information.
And S503, creating a container instance of the LVS load balancing application on the host according to the LVS mirror image information, and calling the created container instance of the LVS load balancing application as an LVS container.
And determining a mirror warehouse for storing the LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application, and acquiring the LVS mirror image information from the mirror warehouse. Determining resources required to be occupied by a container instance for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information, and determining a host for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the determined resources required to be occupied by the container instance for creating the LVS load balancing application.
The method for creating the container instance of the LVS load balancing application is the same as the method for creating the container instance of the container application, and is not described herein again. When the LVS load balancing application is created, a default configuration file is generated according to the LVS mirror image information, and the configuration file is stored in a preset directory.
In an embodiment, before step S501, step S103 further includes: and judging whether the resource group of the container application has enough money to be used for creating the load balancing application according to the using time of the container instance, the resource group of the container application and the number of containers of the load balancing application. If there is enough money to create the load balancing application, step S501 is executed. And if the amount is not enough to create the load balancing application, prompting.
In an embodiment, before creating the container application and the load balancing application, the method further comprises: it is determined whether there are sufficient amounts in the resource group of the container application to create the container application and the load balancing application. And if the sum is enough, creating a container application and a load balancing application, and otherwise, prompting.
And S104, allocating virtual IPs and management IPs for the created LVS containers.
The Virtual IP (VIP) is a service IP, and the service IP is an IP required to provide a load balancing service, and may also be understood as an IP used for external, that is, an IP corresponding to an incoming request of an external user. The management IP is an IP used for internally managing the LVS container, such as an IP used for logging in the LVS container. It should be noted that LVS load balancing is four-layer load balancing. The four-layer load balancing receives the request through the virtual IP + port, forwards the request according to the destination address and the source address in the request, but cannot modify or judge the specific type of the request resource, and forwards the request to the real server of the request to be processed through the load balancing algorithm. Because of the four-layer load balancing, all applications can be load balanced without considering the specific application to be processed. Therefore, two IPs are allocated to the LVS container, the LVS is convenient to provide services to the outside, and the inside of the PaaS platform is convenient to manage the LVS container.
In one embodiment, step S104 includes the steps of: acquiring two idle IPs from a pre-allocated IP address pool according to the application environment of the container application and the area of the container application in the information of the container application; and taking the two acquired idle IPs as a virtual IP and a management IP, and allocating the virtual IP and the management IP to the created LVS container. Wherein, the pre-allocated IP address pool can be determined according to the application environment of the container application and the area of the container application in the information of the container application. It should be noted that the Virtual IP (VIP) and the management IP addresses may be obtained from the free IP of two different pre-assigned address pools, such as a VIP address pool and a management IP address pool; or may be obtained from a pre-allocated address pool, that is, two idle IPs are obtained from an IP address pool, one of the two idle IPs is a VIP and the other is a management IP.
And S105, reconstructing a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application and the port information.
When creating the LVS container, a default configuration file is generated according to the LVS image information, and the configuration file cannot be really used for load balancing. Therefore, the configuration file needs to be reconstructed.
In one embodiment, as shown in FIG. 6, step S105 includes the following steps S601-S603.
S601, the virtual IP, the created container instance of the container application and the port information are used as variables and are transmitted to a preset configuration file generation interface.
And S602, generating a new configuration file according to the configuration file template integrated in the preset configuration file generation interface.
And S603, uploading the new configuration file to a preset directory where the configuration file of the LVS container is located, so as to replace the configuration file generated when the LVS container of the LVS load balancing application is created.
In an embodiment, before step S602, generating a profile template is further included. The step of generating the configuration file template comprises the following steps: acquiring preset parameter information of LVS load balance and preset parameter information of a container instance of container application; setting virtual IP parameters, IP parameters of container instances of container applications and load balancing port parameters; and generating a configuration file template according to preset parameter information of LVS load balancing, preset parameter information of a container instance of the container application, the set virtual IP parameter, the IP parameter of the container instance of the container application and the load balancing port parameter. In one embodiment, the generated profile template may be understood as follows: the generated configuration file template comprises load balancing information and container instance information, wherein the load balancing information comprises set virtual IP parameters, load balancing port parameters and preset LVS load balancing parameter information, and the container instance information comprises IP parameters of a container instance of container application, load balancing port parameters and preset container instance parameter information of the container application. In this embodiment, the configuration file template may be understood as the relevant configuration information corresponding to one port.
The preset LVS load balancing parameter information comprises an LVS load balancing parameter and a value corresponding to the LVS load balancing parameter. The LVS load balancing parameters include a LVS load balancing algorithm parameter (default is a polling algorithm (the polling algorithm may be abbreviated as rr)), a LVS load balancing forwarding mode parameter (default is a DR mode, in which a new MAC address is repackaged for a received request packet to forward to a corresponding server (i.e., a container instance)), a LVS load balancing forwarding protocol parameter (default is a TCP protocol, and the protocol uses LVS four-layer load balancing) and the like. The preset parameter information of the container instance of the container application comprises a container instance parameter and a value corresponding to the container instance parameter. The container instance parameters include a weight parameter of a server corresponding to the container instance (which container instance (server) the access request should be forwarded to is determined according to the weight, the weight corresponding to each container instance is the same in case of a polling algorithm), a TCP health check parameter corresponding to the container instance (server) is periodically checked to detect whether the container instance is available for LVS load balancing), and the like. The TCP health check parameters corresponding to the container instance include a connection timeout time parameter (default is 3s), a reconnection number parameter (default is 3s), a reconnection interval time parameter (default is 3s), and a connected port parameter (which may be consistent with a port of the load balancing application). It will be appreciated that if the complements are all connected within 3s, then the connection is considered to be timed out and reconnects are defaulted 3 times, with a reconnection interval of 3s each time. If the reconnection is performed 3 times, and the connection is still overtime after the reconnection interval time is 3s, the container instance is considered to be unavailable. It should be noted that all parameters in the profile template are default values, and it can also be understood that the parameter values in the profile template are optimal values based on the current application scenario of the current environment. As in one embodiment, the generated profile template may include the following:
Figure BDA0002063764110000111
the method comprises the following steps of obtaining a virtual component, obtaining a virtual component, and obtaining a virtual component. xxx, yy, zzz, nnn represents IP of a container instance of the container application, weight represents a weight parameter of a server corresponding to the container instance, and TCP _ CHECK represents a TCP health CHECK parameter of the server corresponding to the container instance, where the parameters include the following parameters: the connection _ timeout represents a connection timeout time parameter, nb _ get _ retry represents a reconnection number parameter, delay _ before _ retry represents a reconnection interval time parameter, and connection _ port represents a connected port parameter. The container instance and the server corresponding to the container instance are two different expressions, and actually both are container instances.
And the VIP, the created container instance and the port information are used as variables and are transmitted to a configuration file generation interface. The configuration file generation interface may be understood as an interface function. And generating a new configuration file through the configuration file template integrated in the interface function. The step of generating a new configuration file according to a configuration file template integrated in a preset configuration file generation interface includes: for each port of the load balancing application, generating container instance information with corresponding quantity in a configuration file template according to the quantity of the created container instances of the container application, replacing the IP parameters of the container instances in each container instance information with the IP of the created container instances, and replacing the load balancing port parameters in each container instance information with the port of the load balancing application; the VIP and the port information of the load balancing application are respectively substituted for the set virtual IP parameters and the set load balancing port parameters in the load balancing information, so that the relevant configuration information of a plurality of ports of the load balancing application can be generated, and a file formed by the relevant configuration information of all the ports of the load balancing application is used as a new configuration file.
If the container instance created is a first number, such as 4, a second number, such as two ports 80,443, is included in the port information. Then the generated new configuration file has 4 container instance information corresponding to 80 ports and 4 container instances corresponding to 443 ports. The new configuration file generated finally includes the relevant configuration information of 80 ports and the relevant configuration information of 443 ports.
In one embodiment, the load balancing port parameters are default, such as default ports including 80,443 ports. Thus, the related configuration information corresponding to at least two different ports is included in the configuration file template.
And after the new configuration file is generated, uploading the new configuration file to a preset directory where the configuration file of the LVS container is located so as to replace the configuration file generated according to the LVS mirror image information when the LVS container is created. Thus, the new configuration file has the values of the newly allocated VIP, the created container instance Information (IP), and the port information.
And S106, starting the LVS load balancing service of the LVS container.
In one embodiment, step S106 includes: associating the new configuration file with a preset starting script; and executing the associated preset starting script. After the LVS load balancing service is started, the state of the LVS load balancing service is modified to be started. In a certain embodiment, this may be accomplished using commands. For example, xxx/xxxxx/xx/xx/keepalive. conf restart, where keepalive. conf is a new configuration file, and restart represents restart.
It should be noted that, in order to enable the LVS load balancing application to provide services, when the LVS container is created, there is environment information that the corresponding load balancing application depends on, where the environment information includes the sub-network card. It should be noted that the subnet card is not an actual network interface device, but may also be present in the system as a network interface, such as eth0:1, eth1: 2. They must rely on the physical network card, and although they can exist in the system and use different IP addresses simultaneously with the network interface of the physical network card, these sub-network cards will not work together when the dependent physical network card is not enabled (Down state). One LVS container may correspond to a plurality of sub-network cards. When the LVS load balancing service of the LVS container is started, the subnet card corresponding to the LVS container is started.
S107, configuring the subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container.
It will be appreciated that VIP is assigned to a subnet card of the LVS container, and thus, the subnet card is accessible by VIP. Such as a command ifconfig may be used to configure the daughter card. It should be noted that one VIP corresponds to one sub-network card, and therefore corresponds to one sub-network card no matter how many ports are used for LVS load balancing. In one embodiment, configuring the subnet card of the LVS container may be implemented using a command. Such as: ifconfig eth0: 1192.168.1.54 netmask 255.255.255.255 Broadcast 192.168.1.54 up. Wherein eth0:1 indicates network interface 1 of the sub-network card eth0, 192.168.1.54 is VIP, 255.255.255.255 is mask address, and 192.168.1.54 is broadcast address.
And S108, adding a route for the configured sub-network card to complete the creation of the LVS load balancing application when the container application is created.
Because LVS load balancing is four-layer load balancing, a route needs to be added to the configured subnet card, so that when accessing the load balancing application, the access request can reach the subnet card, and then reach the host corresponding to the LVS container through the subnet card. In an embodiment, the command route add may be used to add a route. Such as routeadd-host 192.168.1.54 dev eth0: 1.
The method embodiment automatically completes the creation of the container application and the creation of the LVS load balancing application, automatically realizes the basic setting of the created load balancing application, and accelerates the speed and efficiency of the creation.
In an embodiment, the load balancing application creation method may only include S101-S106, S108-S109, i.e., the load balancing application method may not include S107. It can be understood that the creation of the LVS load balancing application is only completed, and the LVS load balancing service may not be started.
In an embodiment, the steps of the load balancing application creation method may be S101-S106, S108-S109, and S107, that is, after the creation of the LVS load balancing application is completed, the LVS load balancing service is started.
In an embodiment, after the basic setting of the LVS container is completed and the LVS load balancing service is started, it is further required to verify the validity of the LVS container, i.e. whether it is really available. For example, in some cases, an IP is released and then placed back into the corresponding IP address pool to exist as a free IP, but in reality, the IP is still in memory and is not completely released. In this embodiment, as shown in fig. 1, the load balancing application creating method further includes the following steps:
s108a, verifying the validity of the LVS container according to the virtual IP.
Verifying the validity of the LVS container includes verifying whether a VIP of the LVS is truly fully released, i.e., whether the VIP can be accessed as a separate IP entity. Such as an alert command may be used. That is, an ICMP packet is sent to the VIP of the LVS container to detect the IP address, and if an ICMP response of the VIP can be received within a set time, it is considered to ping. If ping is enabled, it indicates that it is valid. If the VIP cannot ping, the VIP cannot be used and further check is needed.
If data on each server is desired to be sent to the client through the LVS load balancing application, an association relationship between the server (container instance of the container application) and the LVS load balancing application needs to be set on each server. In an embodiment, as shown in fig. 1, the load balancing application creating method further includes the following steps:
s108b, setting the association relationship between the container instance of the container application and the virtual IP, so as to bind the container instance of the container application and the virtual IP.
The created container instance of the container application is a real server corresponding to the application, namely a server which really provides service for the user access request. And setting the association relationship between the container instance and the LVS load balancing application, specifically, setting the association relationship between the container instance of the container application and the VIP so as to bind the container instance and the VIP. Therefore, when accessing the server, the access request first reaches the LVS load balancing container through the subnet card, and the LVS load balancing container distributes the access request to a certain container instance (one of the servers) according to the port information of the access request and through a certain load balancing algorithm, so as to return information required by the access request through the container instance.
The container application is created and the LVS load balancing application is created at the same time, and the created container application and the created LVS load balancing application are automatically associated, so that the container application and the LVS load balancing application do not need to be created separately and manually associated, and the creating speed is increased. The LVS load balancing application is created while the container application is created, and the created container application and the created LVS load balancing application are automatically associated, so that the whole process is automatically completed, the creating speed and efficiency are further increased, and the time cost and the labor cost are saved.
Fig. 7 is a schematic block diagram of a load balancing application creation apparatus provided in an embodiment of the present application. The device comprises a unit corresponding to the load balancing application creation method. Specifically, as shown in fig. 7, the apparatus 70 includes a setting unit 701, an application creating unit 702, an LVS creating unit 703, an IP allocating unit 704, a reconstructing unit 705, an opening unit 706, a network card configuring unit 707, and a route adding unit 708.
The setting unit 701 is configured to, if a setting instruction is received, call a preset setting interface according to the setting instruction, so as to set information of a container application and information of a load balancing application, which need to be created, through the preset setting interface, where the information of the load balancing application includes a type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is an LVS.
An application creating unit 702, configured to create a container instance of the container application according to the set information of the container application if the setting completion instruction is received.
In one embodiment, as shown in fig. 8, the application creation unit 702 includes an instance IP determination unit 801 and an instance creation unit 802. The instance IP determining unit 801 is configured to determine the container instance IP of the container application according to the application environment of the container application, the area of the container application, and the number of container instances of the container application in the set information of the container application. An instance creating unit 802, configured to create a container instance according to the container application mirroring information in the set information of the container application, the application environment of the container application, the area of the container application, and the number of container instances of the container application, and set the determined container instance IP as the created container instance IP.
In one embodiment, as shown in fig. 8, the application creating unit 702 further includes a name generating unit 801a, a name judging unit 801b, and a prompting unit 801 d. The name generating unit 801a is configured to generate an application name of the container application according to a preset name generating rule. A name judging unit 801b for judging whether the generated application name already exists in the area corresponding to the container application. If the generated application name does not exist in the area corresponding to the container application, the instance IP determination unit 801 is triggered. The presentation unit 801d is configured to present the generated application name if the application name already exists in the area corresponding to the container application.
In one embodiment, as shown in FIG. 8, the application creation unit 702 further includes a money amount determination unit 801 c. The amount judgment unit 801c is configured to judge whether there is enough amount in the resource group of the container application to create the container instance of the container application according to the usage time of the container instance, the resource group of the container application, and the number of the container instances. If there is sufficient money to create a container instance for the container application, instance IP determination unit 801 is triggered. If there is not enough money to create a container instance for the container application, prompt unit 801d is triggered.
In one embodiment, as shown in fig. 9, the instance creating unit 802 includes an image determining unit 901, a host determining unit 902, and an application instance creating unit 903. The mirror image determining unit 901 is configured to determine, according to the application environment of the container application and the area of the container application, a mirror image warehouse used for storing mirror image information of the container application, and extract, from the determined mirror image warehouse, a specific mirror image that is needed to be used for creating a container instance according to the mirror image type, the mirror image version, and the mirror image name of the container application mirror image information. A host determining unit 902, configured to determine, according to the mirror image type, the mirror image version, and the mirror image name, a resource that needs to be occupied for creating the container instance, and determine, according to the application environment of the container application, the area of the container application, and the resource that needs to be occupied for creating the container instance, a host that creates the container instance. An application instance creating unit 903, configured to create a container instance of the container application on the determined host according to the determined specific mirror, and bind the created container instance and the determined container instance IP to set the determined container instance IP as the IP of the created container instance.
The LVS creating unit 703 is configured to determine, according to the set information of the container application, a host that creates the LVS load balancing application, and create the LVS container on the host.
In an embodiment, as shown in fig. 10, the LVS creating unit 703 includes an LVS mirror determining unit 101, an LVS host determining unit 102, and an LVS container creating unit 103. The LVS mirror image determining unit 101 is configured to determine, according to an application environment of the container application and an area of the container application in the information of the container application, LVS mirror image information. An LVS host determining unit 102, configured to determine, according to the application environment of the container application, the area of the container application, and the LVS mirror image information, a host that creates an LVS load balancing application. The LVS container creating unit 103 is configured to create a container instance of the LVS load balancing application on the host according to the LVS mirror information, and refer to the created container instance of the LVS load balancing application as a LVS container.
And an IP allocating unit 704, configured to allocate a virtual IP and a management IP for the created LVS container.
A reconstructing unit 705, configured to reconstruct a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application, and the port information.
In an embodiment, as shown in fig. 11, the reconstructing unit 705 includes a parameter importing unit 111, a configuration file generating unit 112, and a replacing unit 113. The parameter importing unit 111 is configured to import the virtual IP, the created container instance of the container application, and the port information as variables into a preset configuration file generation interface. And a configuration file generating unit 112, configured to generate a new configuration file according to the configuration file template integrated in the preset configuration file generating interface. A replacing unit 113, configured to upload a new configuration file to a preset directory where the configuration file of the LVS container is located, so as to replace the configuration file generated when the LVS container of the LVS load balancing application is created.
In an embodiment, the reconstruction unit 705 further comprises a template generation unit. The template generating unit is used for generating a configuration file template. The template generating unit comprises a parameter acquiring unit, a parameter setting unit and a configuration template generating unit. The parameter acquiring unit is used for acquiring information of preset LVS load balancing parameters and parameter information of preset container instances. And the parameter setting unit is used for setting the virtual IP parameters, the IP parameters of the container instance and the port parameters. And the configuration template generating unit is used for generating a configuration file template according to the preset parameter information of LVS load balance, the preset parameter information of the container instance, the set virtual IP parameter, the IP parameter of the container instance and the port parameter.
An opening unit 706, configured to open an LVS load balancing service of the LVS container.
A network card configuration unit 707, configured to configure a subnet card of the LVS container, so as to bind the virtual IP with the subnet card of the LVS container.
A route adding unit 708, configured to add a route to the configured sub-network card, so as to complete creating the LVS load balancing application when creating the container application.
In an embodiment, the load balancing application creating apparatus includes a setting unit 701, an application creating unit 702, an LVS creating unit 703, an IP allocating unit 704, a reconstructing unit 705, a network card configuring unit 707, and a route adding unit 708.
In an embodiment, the start unit 706 is not triggered after the reconfiguration unit 705 in the load balancing application creation apparatus. But the activation unit 706 is triggered after the route addition unit 708 is triggered.
In an embodiment, as shown in fig. 7, the load balancing application creation apparatus further includes a verification unit 708 a. The verifying unit 708a is configured to verify the validity of the LVS container according to the virtual IP.
In an embodiment, as shown in fig. 7, the load balancing application creating apparatus further includes an association setting unit 708 b. The association setting unit 708b is configured to set an association relationship between the container instance of the container application and the virtual IP if the LVS container is valid, so as to bind the container instance of the container application and the virtual IP.
It should be noted that, as will be clear to those skilled in the art, specific implementation processes of the above apparatus and each unit may refer to corresponding descriptions in the foregoing method embodiments, and for convenience and brevity of description, no further description is provided herein.
The above-described apparatus may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 12.
Fig. 12 is a schematic block diagram of a computer device according to an embodiment of the present application. The device is a terminal or other device, such as a server in a PaaS platform. The device 120 includes a processor 122, memory, and a network interface 123 connected by a system bus 121, where the memory may include a non-volatile storage medium 124 and an internal memory 125.
The non-volatile storage medium 124 may store an operating system 1241 and computer programs 1242. The computer program 1242 stored in the non-volatile storage medium, when executed by the processor 122, may implement the load balancing application creation method described in the server above. The processor 122 is used to provide computing and control capabilities to support the operation of the overall device 120. The internal memory 125 provides an environment for running a computer program in a non-volatile storage medium, and when the computer program is executed by the processor 122, the computer program may cause the processor 122 to execute the load balancing application creation method described in the server. The network interface 123 is used for network communication. Those skilled in the art will appreciate that the configuration shown in fig. 12 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation on the devices to which the present application applies, and that a particular device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 122 is configured to run a computer program stored in the memory to implement the steps of:
if a setting instruction is received, calling a preset setting interface according to the setting instruction to set information of container application to be created and information of load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Liunx Virtual Server (LVS); if a setting completion instruction is received, creating a container instance of the container application according to the set information of the container application; determining a host machine for creating the LVS load balancing application according to the set container application information, and creating an LVS container on the host machine; allocating a virtual IP for the created LVS container; reconstructing a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application and the port information; configuring a subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container; and adding a route for the configured sub-network card to finish creating the LVS load balancing application when creating the container application.
In an embodiment, when the processor 122 executes the step of determining, according to the set information of the container application, a host for creating the LVS load balancing application, and creating the LVS container on the host, the following steps are specifically implemented:
determining LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application; determining a host machine for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information; and creating a container instance of the LVS load balancing application on the host according to the LVS mirror image information, wherein the created container instance of the LVS load balancing application is called an LVS container.
In an embodiment, when the processor 122 executes the step of reconstructing the configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application, and the port information, the following steps are specifically implemented:
transmitting the virtual IP, the created container instance of the container application and the port information as variables to a preset configuration file generation interface; generating a new configuration file according to a configuration file template integrated in the preset configuration file generation interface; and uploading the new configuration file to a preset directory where the configuration file of the LVS container is located, so as to replace the configuration file generated when the LVS container of the LVS load balancing application is created.
In one embodiment, the processor 122 further performs the steps of: and generating a configuration file template. When the processor 122 executes the step of generating the configuration file template, the following steps are specifically implemented:
acquiring preset parameter information of LVS load balance and preset parameter information of a container instance; setting virtual IP parameters, IP parameters of container instances and port parameters; and generating a configuration file template according to preset LVS load balancing parameter information, preset container instance parameter information, the set virtual IP parameter, the IP parameter of the container instance and the port parameter.
In an embodiment, when the processor 122 executes the step of creating the container instance of the container application according to the set information of the container application, the following steps are specifically implemented:
determining a container instance IP of the container application according to the application environment of the container application, the area of the container application and the number of container instances of the container application in the set information of the container application; creating a container instance according to the container application mirror image information, the application environment of the container application, the area of the container application and the number of the container instances of the container application in the set information of the container application, and setting the determined IP of the container instance as the IP of the created container instance.
In an embodiment, when the processor 122 executes the steps of creating a container instance according to the container application mirroring information in the set information of the container application, the application environment of the container application, the area of the container application, and the number of container instances of the container application, and setting the determined IP of the container instance as the IP of the created container instance, the following steps are specifically implemented:
determining a mirror image warehouse used for storing mirror image information of the container application according to the application environment of the container application and the area of the container application, and extracting a specific mirror image required for creating a container instance from the determined mirror image warehouse according to the mirror image type, the mirror image version and the mirror image name of the mirror image information of the container application; determining resources required to be occupied for creating the container instance according to the mirror image type, the mirror image version and the mirror image name, and determining a host for creating the container instance according to the application environment of the container application, the area of the container application and the resources required to be occupied for creating the container instance; and creating a container instance of the container application on the determined host according to the determined specific mirror image, and binding the created container instance with the determined container instance IP to set the determined container instance IP as the IP of the created container instance.
In one embodiment, the processor 122 further implements the following steps when executing:
starting LVS load balancing service of the LVS container; verifying the validity of the LVS container according to the virtual IP; if the LVS container is valid, setting the association relationship between the container instance of the container application and the virtual IP so as to bind the container instance of the container application and the virtual IP.
It should be understood that in the embodiment of the present application, the Processor 122 may be a Central Processing Unit (CPU), and the Processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program may be stored in a storage medium, which may be a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium including a non-volatile computer-readable storage medium. The storage medium stores a computer program which, when executed by a processor, implements the steps of:
if a setting instruction is received, calling a preset setting interface according to the setting instruction to set information of container application to be created and information of load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Liunx Virtual Server (LVS); if a setting completion instruction is received, creating a container instance of the container application according to the set information of the container application; determining a host machine for creating the LVS load balancing application according to the set container application information, and creating an LVS container on the host machine; allocating a virtual IP for the created LVS container; reconstructing a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application and the port information; configuring a subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container; and adding a route for the configured sub-network card to finish creating the LVS load balancing application when creating the container application.
In an embodiment, when the processor executes the step of determining a host that creates the LVS load balancing application according to the set information of the container application, and creating the LVS container on the host, the following steps are specifically implemented:
determining LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application; determining a host machine for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information; and creating a container instance of the LVS load balancing application on the host according to the LVS mirror image information, wherein the created container instance of the LVS load balancing application is called an LVS container.
In an embodiment, when the processor executes the step of reconstructing the configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application, and the port information, the following steps are specifically implemented:
transmitting the virtual IP, the created container instance of the container application and the port information as variables to a preset configuration file generation interface; generating a new configuration file according to a configuration file template integrated in the preset configuration file generation interface; and uploading the new configuration file to a preset directory where the configuration file of the LVS container is located, so as to replace the configuration file generated when the LVS container of the LVS load balancing application is created.
In one embodiment, the processor further performs the steps of: and generating a configuration file template. When the processor 122 executes the step of generating the configuration file template, the following steps are specifically implemented:
acquiring preset parameter information of LVS load balance and preset parameter information of a container instance; setting virtual IP parameters, IP parameters of container instances and port parameters; and generating a configuration file template according to preset LVS load balancing parameter information, preset container instance parameter information, the set virtual IP parameter, the IP parameter of the container instance and the port parameter.
In an embodiment, when the processor executes the step of creating the container instance of the container application according to the set information of the container application, the following steps are specifically implemented:
determining a container instance IP of the container application according to the application environment of the container application, the area of the container application and the number of container instances of the container application in the set information of the container application; creating a container instance according to the container application mirror image information, the application environment of the container application, the area of the container application and the number of the container instances of the container application in the set information of the container application, and setting the determined IP of the container instance as the IP of the created container instance.
In an embodiment, when the processor executes the step of creating a container instance according to the container application mirroring information in the set information of the container application, the application environment of the container application, the area of the container application, and the number of container instances of the container application, and setting the determined IP of the container instance as the IP of the created container instance, the following steps are specifically implemented:
determining a mirror image warehouse used for storing mirror image information of the container application according to the application environment of the container application and the area of the container application, and extracting a specific mirror image required for creating a container instance from the determined mirror image warehouse according to the mirror image type, the mirror image version and the mirror image name of the mirror image information of the container application; determining resources required to be occupied for creating the container instance according to the mirror image type, the mirror image version and the mirror image name, and determining a host for creating the container instance according to the application environment of the container application, the area of the container application and the resources required to be occupied for creating the container instance; and creating a container instance of the container application on the determined host according to the determined specific mirror image, and binding the created container instance with the determined container instance IP to set the determined container instance IP as the IP of the created container instance.
In one embodiment, the processor further implements the steps of:
starting LVS load balancing service of the LVS container; verifying the validity of the LVS container according to the virtual IP; if the LVS container is valid, setting the association relationship between the container instance of the container application and the virtual IP so as to bind the container instance of the container application and the virtual IP.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and the division of the unit is only one logical function division, and other division manners may be available in actual implementation. It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. A method for load balancing application creation, the method comprising:
if a setting instruction is received, calling a preset setting interface according to the setting instruction to set information of container application to be created and information of load balancing application through the preset setting interface, wherein the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Liunx Virtual Server (LVS);
if a setting completion instruction is received, creating a container instance of the container application according to the set information of the container application;
determining a host machine for creating the LVS load balancing application according to the set container application information, and creating an LVS container on the host machine;
allocating a virtual IP for the created LVS container;
reconstructing a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application and the port information;
starting LVS load balancing service of the LVS container;
configuring a subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container;
adding a route for the configured sub-network card to complete the creation of LVS load balancing application when the container application is created;
the determining, according to the set information of the container application, a host that creates the LVS load balancing application, and creating the LVS container on the host, includes:
determining LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application;
determining a host machine for creating the LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information;
and creating a container instance of the LVS load balancing application on the host according to the LVS mirror image information, wherein the created container instance of the LVS load balancing application is called an LVS container.
2. The method according to claim 1, wherein reconstructing a configuration file of an LVS load balancing application from the virtual IP, the created container instance of the container application, and the port information comprises:
transmitting the virtual IP, the created container instance of the container application and the port information as variables to a preset configuration file generation interface;
generating a new configuration file according to a configuration file template integrated in the preset configuration file generation interface;
and uploading the new configuration file to a preset directory where the configuration file of the LVS container is located, so as to replace the configuration file generated when the LVS container of the LVS load balancing application is created.
3. The method of claim 2, further comprising generating a profile template, the generating a profile template comprising:
acquiring preset parameter information of LVS load balance and preset parameter information of a container instance;
setting virtual IP parameters, IP parameters of container instances and port parameters;
and generating a configuration file template according to preset LVS load balancing parameter information, preset container instance parameter information, the set virtual IP parameter, the IP parameter of the container instance and the port parameter.
4. The method according to claim 1, wherein the creating of the container instance of the container application according to the set information of the container application comprises:
determining a container instance IP of the container application according to the application environment of the container application, the area of the container application and the number of container instances of the container application in the set information of the container application;
creating a container instance according to the container application mirror image information, the application environment of the container application, the area of the container application and the number of the container instances of the container application in the set information of the container application, and setting the determined IP of the container instance as the IP of the created container instance.
5. The method according to claim 4, wherein the creating container instances according to the container application mirror image information, the application environment of the container application, the area of the container application, and the number of container instances of the container application in the set information of the container application, and setting the determined container instance IP as the IP of the created container instances comprises:
determining a mirror image warehouse used for storing mirror image information of the container application according to the application environment of the container application and the area of the container application, and extracting a specific mirror image required for creating a container instance from the determined mirror image warehouse according to the mirror image type, the mirror image version and the mirror image name of the mirror image information of the container application;
determining resources required to be occupied for creating the container instance according to the mirror image type, the mirror image version and the mirror image name, and determining a host for creating the container instance according to the application environment of the container application, the area of the container application and the resources required to be occupied for creating the container instance;
and creating a container instance of the container application on the determined host according to the determined specific mirror image, and binding the created container instance with the determined container instance IP to set the determined container instance IP as the IP of the created container instance.
6. The method of claim 1, further comprising:
verifying the validity of the LVS container according to the virtual IP;
if the LVS container is valid, setting the association relationship between the container instance of the container application and the virtual IP so as to bind the container instance of the container application and the virtual IP.
7. A load balancing application creation apparatus, characterized in that the load balancing application creation apparatus comprises:
the device comprises a setting unit, a setting unit and a processing unit, wherein the setting unit is used for calling a preset setting interface according to a setting instruction so as to set information of container application to be created and information of load balancing application through the preset setting interface, the information of the load balancing application comprises the type of the load balancing application and port information of the load balancing application, and the type of the load balancing application is a Linux Virtual Server (LVS);
the application creating unit is used for creating a container instance of the container application according to the set information of the container application if a setting completion instruction is received;
the LVS creating unit is used for determining a host machine for creating the LVS load balancing application according to the set container application information and creating an LVS container on the host machine;
an IP allocation unit, configured to allocate a virtual IP to the created LVS container;
a reconstruction unit, configured to reconstruct a configuration file of the LVS load balancing application according to the virtual IP, the created container instance of the container application, and the port information;
the starting unit is used for starting LVS load balancing service of the LVS container;
a network card configuration unit, configured to configure a subnet card of the LVS container, so as to bind the virtual IP with the subnet card of the LVS container;
the route adding unit is used for adding a route for the configured sub-network card so as to establish LVS load balancing application when the container application is established;
wherein the LVS creating unit includes:
the LVS mirror image determining unit is used for determining LVS mirror image information according to the application environment of the container application and the area of the container application in the information of the container application;
the LVS host determining unit is used for determining a host for creating LVS load balancing application according to the application environment of the container application, the area of the container application and the LVS mirror image information;
and the LVS container creating unit is used for creating a container instance of the LVS load balancing application on the host according to the LVS mirror image information, and the created container instance of the LVS load balancing application is called an LVS container.
8. A computer device, comprising a memory, and a processor coupled to the memory;
the memory is used for storing a computer program; the processor is configured to execute a computer program stored in the memory to perform the method of any of claims 1-6.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1-6.
CN201910414034.8A 2019-05-17 2019-05-17 Load balancing application creation method and device, computer equipment and storage medium Active CN110266761B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910414034.8A CN110266761B (en) 2019-05-17 2019-05-17 Load balancing application creation method and device, computer equipment and storage medium
PCT/CN2019/103260 WO2020232890A1 (en) 2019-05-17 2019-08-29 Load balancing application creation method and device, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910414034.8A CN110266761B (en) 2019-05-17 2019-05-17 Load balancing application creation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110266761A CN110266761A (en) 2019-09-20
CN110266761B true CN110266761B (en) 2022-04-19

Family

ID=67913413

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910414034.8A Active CN110266761B (en) 2019-05-17 2019-05-17 Load balancing application creation method and device, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN110266761B (en)
WO (1) WO2020232890A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110830574B (en) * 2019-11-05 2023-01-20 浪潮云信息技术股份公司 Method for realizing intranet load balance based on docker container
CN112905210B (en) * 2021-03-24 2023-09-15 青岛聚看云科技有限公司 Server and gray level publishing method
CN113467932A (en) * 2021-06-11 2021-10-01 广东浪潮智慧计算技术有限公司 Load balancing method, system and storage medium
CN113709054A (en) * 2021-07-16 2021-11-26 济南浪潮数据技术有限公司 Keepallved-based LVS (Low Voltage differential Signaling) system deployment adjusting method, device and system
CN113672337B (en) * 2021-07-16 2024-02-13 广东浪潮智慧计算技术有限公司 Application migration method, device, equipment and computer readable storage medium
CN113497765B (en) * 2021-09-08 2021-11-30 中兴通讯股份有限公司 Method and device for route management, electronic equipment and storage medium
CN113992683B (en) * 2021-10-25 2024-02-13 重庆紫光华山智安科技有限公司 Method, system, equipment and medium for realizing effective isolation of double networks in same cluster

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108023953A (en) * 2017-12-04 2018-05-11 北京小度信息科技有限公司 The high availability implementation method and device of FTP service
CN108512872A (en) * 2017-02-27 2018-09-07 长沙六人行网络科技合伙企业(有限合伙) One kind being based on Virtual Server Cluster load balancing method
CN108833163A (en) * 2018-06-13 2018-11-16 平安科技(深圳)有限公司 Creation method, device, computer equipment and the storage medium of Linux virtual server
CN109167702A (en) * 2018-08-28 2019-01-08 新华三大数据技术有限公司 A kind of distributed test method and device based on load balancing

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104780115B (en) * 2014-01-14 2019-06-18 上海盛大网络发展有限公司 Load-balancing method and system in cloud computing environment
CN105979009B (en) * 2016-07-06 2019-05-17 乾云数创(山东)信息技术研究院有限公司 A kind of increase load automatic balancing method for cloud application container
CN106302771A (en) * 2016-08-23 2017-01-04 浪潮电子信息产业股份有限公司 Domain name configuration method of application created based on Docker container
CN106686085B (en) * 2016-12-29 2020-06-16 华为技术有限公司 Load balancing method, device and system
CN108829384A (en) * 2018-06-13 2018-11-16 平安科技(深圳)有限公司 Management method, device, computer equipment and the storage medium of container
CN109343963B (en) * 2018-10-30 2021-12-07 杭州数梦工场科技有限公司 Application access method and device for container cluster and related equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108512872A (en) * 2017-02-27 2018-09-07 长沙六人行网络科技合伙企业(有限合伙) One kind being based on Virtual Server Cluster load balancing method
CN108023953A (en) * 2017-12-04 2018-05-11 北京小度信息科技有限公司 The high availability implementation method and device of FTP service
CN108833163A (en) * 2018-06-13 2018-11-16 平安科技(深圳)有限公司 Creation method, device, computer equipment and the storage medium of Linux virtual server
CN109167702A (en) * 2018-08-28 2019-01-08 新华三大数据技术有限公司 A kind of distributed test method and device based on load balancing

Also Published As

Publication number Publication date
WO2020232890A1 (en) 2020-11-26
CN110266761A (en) 2019-09-20

Similar Documents

Publication Publication Date Title
CN110266761B (en) Load balancing application creation method and device, computer equipment and storage medium
CN108549580B (en) Method for automatically deploying Kubernets slave nodes and terminal equipment
CN110224860B (en) Load balancing application creation method and device, computer equipment and storage medium
CN109067877B (en) Control method for cloud computing platform deployment, server and storage medium
US11252228B2 (en) Multi-tenant multi-session catalogs with machine-level isolation
WO2019183366A1 (en) Adoption of existing virtual computing resources into logical containers for management operations
CN111934918A (en) Network isolation method and device for container instances in same container cluster
CN110166544B (en) Load balancing application creation method and device, computer equipment and storage medium
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
JP2018519687A (en) Multi-tenant aware dynamic host configuration protocol (DHCP) mechanism for cloud networking
CN106657444B (en) A kind of method and device for the IP address configuring BMC
CN114070723A (en) Virtual network configuration method and system of bare metal server and intelligent network card
CN109246201B (en) Cloud resource delivery method, processor and storage medium
US11108673B2 (en) Extensible, decentralized health checking of cloud service components and capabilities
CN109819023B (en) Distributed transaction processing method and related product
CN113312064A (en) Installation configuration method and device of physical machine and computer readable medium
CN112035062B (en) Migration method of local storage of cloud computing, computer equipment and storage medium
US11586447B2 (en) Configuration after cluster migration
CN109120680B (en) Control system, method and related equipment
CN110417856B (en) Capacity expansion method, device, equipment and storage medium for multi-active load balancing application
CN112003964A (en) Multi-architecture-based IP address allocation method, device and medium
CN115658221A (en) State detection method, service virtual machine, equipment and medium
CN116264538A (en) Data processing method, device, equipment and computer storage medium
CN110365742B (en) Multi-active load balancing application creation method and device, computer equipment and storage medium
CN106302838B (en) Domain name system DNS resolution 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
GR01 Patent grant
GR01 Patent grant