WO2020252921A1 - 多活负载均衡应用的扩容方法、装置、设备及存储介质 - Google Patents

多活负载均衡应用的扩容方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020252921A1
WO2020252921A1 PCT/CN2019/103353 CN2019103353W WO2020252921A1 WO 2020252921 A1 WO2020252921 A1 WO 2020252921A1 CN 2019103353 W CN2019103353 W CN 2019103353W WO 2020252921 A1 WO2020252921 A1 WO 2020252921A1
Authority
WO
WIPO (PCT)
Prior art keywords
expanded
container instance
load balancing
application
container
Prior art date
Application number
PCT/CN2019/103353
Other languages
English (en)
French (fr)
Inventor
黄桂钦
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020252921A1 publication Critical patent/WO2020252921A1/zh

Links

Images

Classifications

    • 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

Definitions

  • This application relates to the field of cloud computing technology, and in particular to a method, device, computer equipment, and storage medium for expanding a multi-active load balancing application.
  • the embodiments of the present application provide a method, device, computer equipment and storage medium for expanding the capacity of a multi-active load balancing application, which can ensure service when user requests increase significantly in a short period of time while improving the user experience and increase the expansion of the multi-active load balancing application s efficiency.
  • an embodiment of the present application provides a method for expanding a multi-active load balancing application, including:
  • the identification information of the multi-active load balancing application in the expansion instruction is obtained, and the expansion setting interface is called to receive the multi-active load balancing application that needs to be expanded set through the expansion setting interface
  • the number of container instances obtain the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and the resource information required by the container instance to be expanded according to the identification information of the multi-active load balancing application;
  • the application environment, the area of the multi-active load balancing application, the resource information required by the container instance that needs to be expanded, and the number of container instances set for the multi-active load balancing application that needs to be expanded Determine the host of the container instance that needs to be expanded and the host that needs to be expanded
  • the IP of the container instance inherit the information of the created container instance that matches the container instance that needs to be expanded, and create the expanded container instance on the determined host according to the information of the inherited container instance, and use the determined IP Set
  • an embodiment of the present application provides a capacity expansion apparatus for a multi-active load balancing application, and the capacity expansion apparatus for a multi-active load balancing application includes a unit for executing the method corresponding to the above-mentioned first aspect.
  • an embodiment of the present application provides a computer device, the computer device includes a memory, and a processor connected to the memory;
  • the memory is used to store a computer program
  • the processor is used to run the computer program stored in the memory to execute the method described in the first aspect above.
  • an embodiment of the present application provides a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the method described in the first aspect.
  • FIG. 1 is a schematic flowchart of a method for expanding a multi-active load balancing application provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of a sub-flow of a method for expanding a multi-active load balancing application provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of a method for expanding a multi-active load balancing application provided by another embodiment of the present application;
  • FIG. 4 is a schematic flowchart of a method for expanding a multi-active load balancing application according to another embodiment of the present application
  • FIG. 5 is a schematic flowchart of a method for expanding a multi-active load balancing application according to another embodiment of the present application
  • FIG. 6 is a schematic flowchart of a method for expanding a multi-active load balancing application provided by another embodiment of the present application.
  • FIG. 7 is a schematic block diagram of a capacity expansion device for a multi-active load balancing application provided by an embodiment of the present application.
  • FIG. 8 is a schematic block diagram of a capacity expansion device for a multi-active load balancing application according to another embodiment of the present application.
  • FIG. 9 is a schematic block diagram of a capacity expansion apparatus for a multi-active load balancing application provided by another embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a capacity expansion apparatus for a multi-active load balancing application according to another embodiment of the present application.
  • FIG. 11 is a schematic block diagram of a capacity expansion apparatus for a multi-active load balancing application according to another embodiment of the present application.
  • FIG. 12 is a schematic block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a method for expanding a multi-active load balancing application provided by an embodiment of the present application. As shown in Figure 1, the method includes S101-S104.
  • the expansion instruction of the multi-active load balancing application can be triggered in a variety of ways, such as by the user touching or clicking on a related button or image, such as clicking on a corresponding multi-active load balancing application in the list of multi-active load balancing applications
  • the expansion button triggers the expansion instruction of the multi-active load balancing application; it can also be triggered by receiving the user's voice expansion information.
  • the method of triggering the expansion instruction of the multi-active load balancing application is not limited.
  • the capacity expansion instruction includes information of the multi-active load balancing application, such as identification information of the multi-active load balancing application.
  • the identification information of the multi-active load balancing application may be the name of the multi-active load balancing application or the number of the multi-active load balancing application, etc., which can determine the specific multi-active load balancing application.
  • the expansion setting interface is called according to the expansion instruction.
  • the expansion setting interface is developed by the developer and can exist in the form of a setting interface. Through the expansion setting interface, you can set the number of container instances that the multi-active load balancing application needs to expand.
  • the multi-active load balancing application includes an LVS load balancing application and an Nginx load balancing application.
  • the Nginx load balancing application can be regarded as a back-end application of the LVS load balancing application to assist the LVS load balancing application. It should be noted that the expression "can be seen as” is just to facilitate the understanding of the relationship between the LVS load balancing application and the Nginx load balancing application in the multi-active load balancing application.
  • the LVS load balancing application has multiple LVS containers (also called LVS container instances), and the Nginx load balancing application also has multiple Nginx containers (also called LVS container instances).
  • the multi-active load balancing application can be applied to a specific network architecture.
  • the routing protocol in the network architecture needs to use the OSPF protocol, so that user requests are distributed to different LVS containers through the distribution strategy of the router corresponding to the OSPF protocol.
  • the LVS container After receiving the user request, the LVS container sends the user request to the Nginx container instance according to the LVS load balancing algorithm.
  • the Nginx container instance After receiving the user request, the Nginx container instance sends the user request to the backend of the multi-active load balancing application according to the Nginx load balancing algorithm.
  • the back-end application responds to user requests.
  • the back-end application of the multi-active load balancing application can be understood as the service application corresponding to the multi-active load balancing application, that is, an application that truly provides a certain service to the user, and the multi-active load balancing application provides load balancing services for the back-end application .
  • the container instances of the multi-active load balancing application that need to be expanded through the expansion setting interface include: the container instances of the LVS load balancing application in the multi-active load balancing application that need to be expanded, which can be understood as only the LVS load balancing application
  • the number of container instances that need to be expanded and the number of container instances that need to be expanded at the same time is the number of container instances of the LVS load balancing application that needs to be expanded; or the Nginx load balancing application in the multi-active load balancing application needs to be expanded.
  • the balance application needs to be expanded, and the number of container instances that need to be expanded is the number of container instances of the Nginx load balancing application that needs to be expanded; or the container instances of the LVS load balancing application in the multi-active load balancing application need to be expanded and the Nginx load balancing application needs to be expanded
  • the LVS load balancing application and Nginx load balancing application in the multi-active load balancing application need to be expanded, and the number of container instances that need to be expanded is the number of container instances of the LVS load balancing application that needs to be expanded and The sum of the number of container instances of the Nginx load balancing application to be expanded.
  • the use time of the container instance to be expanded, the resource group of the container instance to be expanded, etc. can also be set through the expansion setting interface.
  • the usage time of the container instance that needs to be expanded can be in months or other time units.
  • the container instance that needs to be expanded is charged after the expansion is successful.
  • the resource group of the multi-active load balancing application includes a resource account, which is used to expand the container instance of the multi-active load balancing application.
  • the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource group of the container instances that need to be expanded can be set by receiving user selection or input on the setting interface. You can also directly use information such as the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource groups of the container instances that need to be expanded.
  • the resource group of the container instance to be expanded defaults to the resource group used when creating an all-active load balancing application.
  • the number of container instances that need to be expanded can also be determined according to the current increase in the number of user visits and the preset user visits that each container instance can normally access.
  • S102 Acquire the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the container instance to be expanded according to the identification information of the multi-active load balancing application.
  • the multi-active load balancing application can be determined to further find the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and the container instance that needs to be expanded in the database. Resource information.
  • the application environment of the multi-active load balancing application includes a production environment, a test environment, and a development environment.
  • the production environment means that the multi-active load balancing application is successfully created to connect to the external environment, or for external users to access;
  • the test environment means that the multi-active load balancing application is successfully created for testing;
  • the development environment means the multi-active After the load balancing application is successfully created, it will be used for development.
  • the area of the multi-active load balancing application is composed of two parts: "area" + "safe area”.
  • safety area is a sub-area under "area”.
  • the resource information required to expand the container instance can be determined according to the resource information needed to create the container instance stored in the successfully created container instance. If the set container instance of the multi-active load balancing application that needs to be expanded is the container instance of the LVS load balancing application that needs to be expanded, then the resource information required for expanding the container instance is the resource information required by the LVS container instance that needs to be expanded; if The set container instance of the multi-active load balancing application that needs to be expanded is the container instance of the Nginx load balancing application that needs to be expanded, and the resource information required for expanding the container instance is the resource information required by the Nginx container instance that needs to be expanded; The container instance of the multi-active load balancing application that needs to be expanded includes the container instance of the LVS load balancing application that needs to be expanded and the container instance of the Nginx load balancing application that needs to be expanded. The resource information required by the container instance that needs to be expanded includes the corresponding requirements. The resource information required by the expanded L
  • the location of the multiple-active load balancing application is determined according to the application environment of the multiple-active load balancing application and the area of the multiple-active load balancing application; the host cluster is determined according to the determined location of the multiple-active load balancing application; and the capacity is expanded as needed
  • the resource information required by the container instance and the determined host cluster determine the specific host of the container instance to be expanded.
  • determining the specific host cluster is automatically determined by the orchestration tool.
  • the orchestration tool identifies the host cluster where the multi-active load balancing application is located .
  • the orchestration tool determines the host of the container instance to be expanded according to the resource information required by the container instance to be expanded and the resource situation of the host cluster. For example, the resources in the host must be at least greater than the resources required by the container instance to be expanded Information before you can create a container instance on the host.
  • the orchestration tool can be Marathon or other orchestration tools.
  • a container instance is created on a host machine. Understandably, a container instance corresponds to a host machine.
  • the application environment and the area of the multi-active load balancing application determine the location of the multi-active load balancing application; determine the pre-allocated IP address pool used to create the container instance according to the determined location of the multi-active load balancing application creation; from the IP address The pool obtains the same number of IP addresses as the container instances of the multiple-active load balancing application to be expanded, and determines the obtained IP addresses as the IP of the container instance to be expanded.
  • the information of the container instance that matches the container instance to be expanded and the created container instance is the information of the created LVS container; if the container instance needs to be expanded For the container instance of the Nginx load balancing application that needs to be expanded, the information of the created container instance that matches the container instance that needs to be expanded is the information of the created Nginx container instance; if the container instance needs to be expanded is the LVS that needs to be expanded For the container instance of the load balancing application and the container instance of the Nginx load balancing application, the information of the created container instance that matches the container instance that needs to be expanded is the information of the created LVS container instance and the information of the Nginx container instance.
  • the step S104 includes the following steps S1041-S1043.
  • S1041 Inherit the information of the created container instance that matches the container instance that needs to be expanded.
  • Inheriting the information of the created container instance that matches the container instance that needs to be expanded can be simply understood as copying the information of the created container instance that matches the container instance that needs to be expanded.
  • S1042 Send the inherited container instance information to the determined host computer through the container orchestration tool, and create an expanded container instance.
  • the container instance that needs to be expanded is created on the determined host.
  • the created expanded container instance inherits the application package and configuration of the existing created container instance, and is not re-created based on the application image and configuration of the container application, that is, there is no need to re-upload the application package And configuration, etc.
  • the speed of expanding the multi-active load balancing application is greatly accelerated, and the expansion can be achieved in seconds.
  • the container instances that need to be expanded can be created on the determined host in parallel.
  • each container instance that needs to be expanded corresponds to a host, and multiple container instances that need to be expanded are created in parallel, which further accelerates the speed of expansion.
  • the information of the inherited container instance can be sent to the determined host through the container orchestration tool, and the container to be expanded can be created on the determined host Instance.
  • the container orchestration tool can be a Marathon tool or other tools.
  • S1043 Connect the created container instance through an automated operation and maintenance tool, and bind the created container instance with the determined IP, so as to set the determined IP as the IP of the created container instance.
  • the container instance to be expanded is created, and the IP of the container instance needs to be set for the created container instance.
  • Set IP through automated operation and maintenance tools. Among them, automated operation and maintenance tools such as ansible tools.
  • the method further includes step S105.
  • Step S105 Update the information of the expanded container instance to the database.
  • the information of the expanded container instance includes the IP of the expanded container instance, the host where the expanded container instance is located, the number of expanded container instances, and other information. Update the database to keep it consistent with the data in the database.
  • the method further includes the following steps: The number of container instances to be expanded, the usage time of the container instance to be expanded, and the resource group of the container instance to be expanded determine whether there is enough money in the resource group to expand the corresponding container instance.
  • the cost of expanding the container instance of the multi-active load balancing application is determined by the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the monthly unit price of each container instance that needs to be expanded.
  • the cost of the container instance that needs to be expanded the number of LVS container instances that need to be expanded * the use time of the LVS container instance that needs to be expanded * the monthly unit price of each LVS container instance that needs to be expanded + the Nginx container instance that needs to be expanded Quantity * Usage time of the Nginx container instance to be expanded * The monthly unit price of each Nginx container instance to be expanded.
  • step S102 is executed; if it is determined that there is not enough money in the resource group to expand the container instance, a prompt is given.
  • the method further includes: binding the subnet card of the created LVS container instance with the virtual IP of the LVS load balancing application.
  • the method further includes: adding the expanded Nginx to the configuration file of the LVS load balancing application according to the information of the created Nginx container instance Information about the container instance.
  • FIG. 3 is a schematic flowchart of a capacity expansion method for a multi-active load balancing application provided by another embodiment of the present application.
  • the container instance to be expanded for the multi-active load balancing application is the container instance for which the LVS load balancing application in the multi-active load balancing application needs to be expanded, that is, only the LVS load balancing application in the multi-active load balancing application needs to be expanded.
  • the expansion method of the multiple-active load balancing application includes the following steps S301-S306.
  • S302 Acquire the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the LVS container instance to be expanded according to the identification information of the multi-active load balancing application.
  • S303 Determine the number of LVS container instances to be expanded according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the LVS container instance to be expanded, and the set number of LVS container instances to be expanded.
  • S305 Binding the created subnet card of the LVS container instance with the virtual IP of the LVS load balancing application.
  • the subnet card is not an actual network interface device, but it can also appear in the system as a network interface, such as eth0:1, eth1:2. They must depend on the physical network card. Although they can exist in the system at the same time as the network interface of the physical network card and use a different IP address, these subnetwork cards will not work together when the dependent physical network card is not enabled (Down state).
  • One LVS container can correspond to multiple subnet cards.
  • a virtual IP corresponds to a subnet card, so no matter how many ports are used for LVS load balancing, it corresponds to a subnet card.
  • configuring the subnet card of the LVS container can be implemented by running a command. For example: ifconfig eth0:1192.168.1.54 netmask 255.255.255.255 broadcast 192.168.1.54up. Among them, eth0:1 represents the network interface 1 of the subnet card eth0, 192.168.1.54 is the virtual IP, 255.255.255.255 is the mask address, and 192.168.1.54 is the broadcast address.
  • the method further includes step S306.
  • Step S306 Update the information of the expanded LVS container instance to the database.
  • the method further includes the following steps: according to the needs of the multi-active load balancing application
  • the number of LVS container instances to be expanded, the use time of the container instance to be expanded, and the resource group of the container instance to be expanded determine whether there is enough money in the resource group to expand the corresponding LVS container instance.
  • step S302 is executed; if it is determined that there is not enough money in the resource group to expand the LVS container instance, a prompt is given.
  • FIG. 4 is a schematic flowchart of a method for expanding a multi-active load balancing application according to another embodiment of the present application.
  • the container instance to be expanded for the multi-active load balancing application is the container instance for the Nginx load balancing application in the multi-active load balancing application to be expanded, that is, only the Nginx load balancing application in the multi-active load balancing application needs to be expanded.
  • the expansion method of the multiple-active load balancing application includes the following steps S401-S405.
  • S402 Acquire the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the Nginx container instance to be expanded according to the identification information of the multi-active load balancing application.
  • S403 Determine the number of Nginx container instances that need to be expanded according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the Nginx container instance that needs to be expanded, and the set number of Nginx container instances that need to be expanded The IP of the host and the Nginx container instance to be expanded.
  • S405 Add the information of the expanded Nginx container instance to the configuration file of the LVS load balancing application according to the information of the created Nginx container instance.
  • the Nginx load balancing application is equivalent to the back-end application of the LVS load balancing application. Therefore, in the configuration file of the LVS load balancing application (the configuration file mentioned here corresponds to keeplived.conf ) Records the Nginx container instance information. After expanding the Nginx container instance, if you want the expanded Nginx container instance to start providing services, you need to add the expanded container instance in the configuration file of the LVS load balancing application, so that the LVS load balancing application will assign users when assigning user requests. Requests can be allocated to the expanded Nginx container instance.
  • a pre-set container instance template is obtained; for each port of the Nginx load balancing application, the container instance template is copied the same number of copies according to the number of expanded Nginx container instances; the expanded Nginx container instance Replace the IP parameter of the container instance in the container instance template, replace the port parameter in the container instance template with the port of the Nginx load balancing application, and complete the replacement of all container instance templates; insert the replaced container instance template into The corresponding position in the configuration file of the LVS load balancing application is used to add the information of the expanded Nginx container instance to the configuration file of the LVS load balancing application.
  • the container instance template includes the IP parameters of the container instance, the port parameters for the container instance to provide services, the health check parameters of the container instance, and the weight parameters of the container instance.
  • the port parameters for the container instance to provide services are based on the Nginx load balancing application. The port is determined, and the parameter values in the health check parameters of the container instance and the weight parameters of the container instance have corresponding default values.
  • the IP of an expanded Nginx container instance replaces the IP in a container instance template.
  • each container instance template corresponds to an Nginx port and an IP of the expanded Nginx container instance.
  • the configuration file of the LVS load balancing application in a code segment determined by the virtual IP and each LVS port, after the code end corresponding to the last real server, add the replaced container instance template content.
  • each real server corresponds to a container instance of the Nginx load balancing application.
  • a container instance template may include the following:
  • xxx.yyy.zzz.nnn represents the IP of an Nginx container of the Nginx load balancing application
  • realserver-port represents the port of the Nginx load balancing application
  • weight represents the weight parameter of the server corresponding to the container instance
  • TCP_CHECK represents the corresponding container instance
  • the TCP health check parameters of the server include the following parameters: connect_timeout represents the connection timeout parameter, nb_get_retry represents the number of reconnection parameters, delay_before_retry represents the reconnection interval time parameter, and connect_port represents the port parameter of the connected Nginx load balancing application.
  • the code segment content of the real server part of the LVS load balancing application can also be directly obtained as the container instance template.
  • the method further includes step S406.
  • Step S406 Update the information of the expanded Nginx container instance to the database.
  • the method further includes the following steps: according to the needs of the multi-active load balancing application
  • the number of Nginx container instances to be expanded, the usage time of the container instance to be expanded, and the resource group of the container instance to be expanded determine whether there is enough money in the resource group to expand the corresponding Nginx container instance.
  • step S402 is executed; if it is determined that there is not enough money in the resource group to expand the Nginx container instance, a prompt is given.
  • FIG. 5 is a schematic flowchart of a method for expanding a multi-active load balancing application according to another embodiment of the present application.
  • the container instance that needs to be expanded for the multi-active load balancing application is the container instance that needs to be expanded for the LVS load balancing application in the multi-active load balancing application and the container instance that needs to be expanded for the Nginx load balancing application, that is, the multi-active load balancing application. Both LVS load balancing applications and Nginx load balancing applications need to be expanded.
  • the expansion method of the multiple-active load balancing application includes the following steps S501-S506.
  • S502 Acquire the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the LVS container instance to be expanded, and the Nginx container instance to be expanded according to the identification information of the multi-active load balancing application Resource information.
  • the number of LVS container instances and the number of Nginx container instances that need to be expanded determine the host of the LVS container instance that needs to be expanded, the IP of the LVS container instance that needs to be expanded, and the host of the Nginx container instance that needs to be expanded, and the Nginx container instance that needs to be expanded IP.
  • the host machine of the LVS container instance and the IP of the LVS container instance, the host machine of the Nginx container instance and the IP of the Nginx container instance can be determined respectively.
  • the area of the multi-active load balancing application, the resource information required by the LVS container instance that needs to be expanded, and the number of LVS container instances that need to be expanded to determine the number of LVS container instances that need to be expanded The IP of the host machine and the LVS container instance to be expanded.
  • the IP of the Nginx container instance to be expanded Determine the host of the Nginx container instance to be expanded according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the Nginx container instance to be expanded, and the number of Nginx container instances that need to be expanded. , The IP of the Nginx container instance to be expanded.
  • the host of the LVS container instance and the host of the Nginx container instance can be determined respectively, and then the IPs of the LVS container instance and the Nginx container instance can be determined.
  • the area of the multi-active load balancing application, the resource information required by the LVS container instance that needs to be expanded, and the number of LVS container instances that need to be expanded to determine the number of LVS container instances that need to be expanded Host can be determined according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the LVS container instance that needs to be expanded, and the number of LVS container instances that need to be expanded to determine the number of LVS container instances that need to be expanded Host.
  • S506 Bind the created subnet card of the LVS container instance with the virtual IP of the LVS load balancing application.
  • the method further includes step S507.
  • Step S507 Update the information of the expanded Nginx container instance and the information of the LVS container instance to the database.
  • the method further includes: according to the multi-active load balancing application that needs to be expanded
  • the number of LVS container instances, the number of Nginx container instances, the usage time of the container instance to be expanded, and the resource group of the container instance to be expanded determine whether there is enough money in the resource group to expand the corresponding container instance.
  • step S502 is executed; if it is determined that there is not enough money in the resource group to expand the corresponding container instance, a prompt is given.
  • inventions described in Figures 1 to 5 above all involve the expansion of the LVS load balancing application and/or the Nginx load balancing application in the multi-active load balancing application.
  • the above method embodiments can implement the expansion of the container instance of the multi-active load balancing application, guarantee the service when the user request increases significantly in a short time, and improve the user experience.
  • the expansion process of container instances of other specific multi-active load balancing applications is automatic, which improves the efficiency of expansion, saves time and labor costs; at the same time, set the information of the number of container instances to be expanded by setting the interface, so that Users can understand and set related settings at a glance, which improves the user experience, and can realize the expansion of multi-active load balancing applications without high professional knowledge.
  • the expansion method of the multi-active load balancing application further includes the expansion of the back-end application of the multi-active load balancing application.
  • FIG. 6 is a schematic flowchart of a method for expanding a multi-active load balancing application according to another embodiment of the present application. As shown in Figure 6, the method includes the following steps S601-S605.
  • the region of the back-end application the resource information required by the container instance to be expanded by the back-end application, and the set number of container instances that need to be expanded by the back-end application , Determine the host of the container instance to be expanded by the back-end application and the IP of the container instance to be expanded by the back-end application.
  • S604 Inherit the information of the container instance created by the back-end application, create an expanded container instance of the back-end application on the determined host machine according to the inherited information of the container instance, and set the determined IP to The IP of the expanded container instance.
  • S605 Add the container instance information expanded by the back-end application to the configuration file of the Nginx load balancing application of the multi-active load balancing application according to the information of the created container instance.
  • the container instance information expanded by the added back-end application includes: server 192.168.12.23:8080.
  • the method further includes step S606.
  • Step S606 Update the information of the container instance of the expanded back-end application to the database.
  • FIG. 7 is a schematic block diagram of a capacity expansion device for a multi-active load balancing application provided by an embodiment of the present application.
  • the device includes a unit corresponding to the expansion method for executing the above-mentioned multi-active load balancing application.
  • the capacity expansion device 100 of the multi-active load balancing application includes a setting unit 101, an obtaining unit 102, a determining unit 103, and a capacity expansion unit 104.
  • the setting unit 101 is configured to, if a capacity expansion instruction of a multi-active load balancing application is received, obtain identification information of the multi-active load balancing application in the expansion instruction, and call the expansion setting interface to receive the capacity expansion required through the expansion setting interface The number of container instances of the multi-active load balancing application.
  • the obtaining unit 102 is configured to obtain the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the container instance to be expanded according to the identification information of the multi-active load balancing application.
  • the determining unit 103 is used for setting the number of container instances of the multi-active load balancing application to be expanded according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the container instance to be expanded Determine the host of the container instance to be expanded and the IP of the container instance to be expanded.
  • the expansion unit 104 is configured to inherit the information of the created container instance that matches the container instance to be expanded, create the expanded container instance on the determined host machine according to the information of the inherited container instance, and set the determined IP is set to the IP of the expanded container instance.
  • the capacity expansion unit 104 includes an inheritance unit, a container creation unit, and an IP setting unit.
  • the inheritance unit is used to inherit the information of the created container instance that matches the container instance that needs to be expanded.
  • the container creation unit is used to send the inherited container instance information to the determined host machine through the container orchestration tool, and create an expanded container instance.
  • the IP setting unit is used to connect the created container instance through an automated operation and maintenance tool, and bind the created container instance with the determined IP, so as to set the determined IP as the IP of the created container instance.
  • the capacity expansion apparatus 100 of the multi-active load balancing application further includes an information update unit 105.
  • the information update unit 105 is used to update the information of the expanded container instance to the database.
  • the capacity expansion device 100 of the multi-active load balancing application further includes a judgment unit and a prompt unit.
  • the judging unit is used to determine whether there is enough money in the resource group for expansion based on the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource group of the container instances that need to be expanded. The corresponding container instance. If it is determined that there is not enough money in the resource group to expand the container instance, the prompt unit is triggered for prompting. If it is determined that there is enough money in the resource group to expand the container instance, the acquiring unit 102 is triggered.
  • FIG. 8 is a schematic block diagram of a capacity expansion device for a multi-active load balancing application according to another embodiment of the present application, corresponding to the case where the set container instance to be expanded is the LVS container instance of the LVS load balancing application that needs to be expanded. It corresponds to the unit corresponding to the expansion method of the multi-active load balancing application shown in FIG. 3.
  • the capacity expansion device 200 of the multi-active load balancing application includes a first setting unit 201, a first obtaining unit 202, a first determining unit 203, a first capacity expansion unit 204, and a first binding unit 205.
  • the first setting unit 201 is configured to, if an expansion instruction of a multi-active load balancing application is received, obtain identification information of the multi-active load balancing application in the expansion instruction, and call the expansion setting interface to receive the settings through the expansion setting interface The number of LVS container instances of the LVS load balancing application to be expanded.
  • the first obtaining unit 202 is configured to obtain the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the LVS container instance to be expanded according to the identification information of the multi-active load balancing application.
  • the first determining unit 203 is configured to determine the demand according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the LVS container instance to be expanded, and the set number of LVS container instances to be expanded.
  • the first expansion unit 204 is configured to inherit the information of the created LVS container instance, create an expanded LVS container instance on the determined host machine according to the information of the inherited LVS container instance, and set the determined IP as expansion The IP of the LVS container instance.
  • the first binding unit 205 binds the created subnet card of the LVS container instance with the virtual IP of the LVS load balancing application.
  • the capacity expansion apparatus 200 of the multi-active load balancing application further includes a first information update unit 206.
  • the first information update unit 206 is configured to update the information of the expanded LVS container instance to the database.
  • the capacity expansion apparatus 200 of the multi-active load balancing application further includes a first judgment unit and a first prompt unit.
  • the first judgment unit is used to determine whether there is enough money in the resource group according to the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource group of the container instances that need to be expanded. To expand the corresponding container instance. If it is determined that there is not enough money in the resource group to expand the container instance, the first prompt unit is triggered for prompting. If it is determined that there is enough money in the resource group to expand the container instance, the first acquiring unit 202 is triggered.
  • FIG. 9 is a schematic block diagram of an expansion device for a multi-active load balancing application according to another embodiment of the present application, corresponding to the case where the container instance to be expanded is the Nginx container instance of the Nginx load balancing application that needs to be expanded. It corresponds to the unit corresponding to the expansion method of the multi-active load balancing application shown in FIG. 4.
  • the capacity expansion device 300 of the multi-active load balancing application includes a second setting unit 301, a second acquisition unit 302, a second determination unit 303, a second capacity expansion unit 304, and a first configuration update unit 305.
  • the second setting unit 301 is configured to, if a capacity expansion instruction of a multi-active load balancing application is received, obtain the identification information of the multi-active load balancing application in the expansion instruction, and call the expansion setting interface to receive the settings through the expansion setting interface The number of Nginx container instances of the Nginx load balancing application to be expanded.
  • the second obtaining unit 302 is configured to obtain, according to the identification information of the multi-active load balancing application, the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, and resource information required by the Nginx container instance to be expanded.
  • the second determining unit 303 is used to determine the demand according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the Nginx container instance to be expanded, and the set number of Nginx container instances to be expanded.
  • the second expansion unit 304 is configured to inherit the information of the created Nginx container instance, create an expanded Nginx container instance on the determined host machine according to the inherited Nginx container instance information, and set the determined IP as expansion The IP of the Nginx container instance.
  • the first configuration updating unit 305 is configured to add the information of the expanded Nginx container instance to the configuration file of the LVS load balancing application according to the information of the created Nginx container instance.
  • the capacity expansion apparatus 300 of the multi-active load balancing application further includes a second information update unit 306.
  • the second information update unit 306 is used to update the information of the expanded Nginx container instance to the database.
  • the capacity expansion device 300 of the multi-active load balancing application further includes a second judgment unit and a second prompt unit.
  • the second judgment unit is used to determine whether there is enough money in the resource group according to the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource group of the container instances that need to be expanded. To expand the corresponding container instance. If it is determined that there is not enough money in the resource group to expand the container instance, the second prompt unit is triggered for prompting. If it is determined that there is enough money in the resource group to expand the container instance, the second acquiring unit 302 is triggered.
  • FIG. 10 is a schematic block diagram of an expansion device for a multi-active load balancing application according to another embodiment of the present application.
  • the container instance that needs to be expanded includes the Nginx container instance of the Nginx load balancing application that needs to be expanded and the Nginx container instance of the Nginx load balancing application that needs to be expanded.
  • the case of the Nginx container instance of the Nginx load balancing application specifically, corresponds to the unit corresponding to the expansion method of the multi-active load balancing application shown in FIG. 5. As shown in FIG.
  • the capacity expansion device 400 of the multi-active load balancing application includes a third setting unit 401, a third acquisition unit 402, a third determination unit 403, a third expansion unit 404, a second configuration update unit 405, and a second configuration update unit 405. Binding unit 406.
  • the third setting unit 401 is configured to, if a capacity expansion instruction of a multi-active load balancing application is received, obtain the identification information of the multi-active load balancing application in the expansion instruction, and call the expansion setting interface to receive the settings through the expansion setting interface
  • the third obtaining unit 402 is used to obtain the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the LVS container instance to be expanded, and the resource information that needs to be expanded according to the identification information of the multi-active load balancing application Resource information required by the Nginx container instance.
  • the third determining unit 403 is used to determine the resource information required by the LVS container instance to be expanded according to the application environment of the multi-active load balancing application, the area of the multi-active load balancing application, the resource information required by the Nginx container instance to be expanded, and Set the number of LVS container instances that need to be expanded and the number of Nginx container instances that need to be expanded, determine the host of the LVS container instance that needs to be expanded, the IP of the LVS container instance that needs to be expanded, and the host of the Nginx container instance that needs to be expanded, The IP of the Nginx container instance to be expanded.
  • the third expansion unit 404 is used to inherit the information of the created LVS container instance and the information of the Nginx container instance, and create the expanded LVS container instance on the determined part of the host according to the information of the inherited LVS container instance, and according to The information of the inherited Nginx container instance creates an expanded Nginx container instance on other determined hosts, and the determined IP is set to the IP of the expanded LVS container instance and the Nginx container instance.
  • the second configuration updating unit 405 is configured to add the information of the expanded Nginx container instance in the configuration file of the LVS load balancing application according to the created Nginx container instance.
  • the second binding unit 406 is configured to bind the created subnet card of the LVS container instance with the virtual IP of the LVS load balancing application.
  • the capacity expansion apparatus 400 of the multi-active load balancing application further includes a third information update unit 407.
  • the third information updating unit 407 is used to update the information of the expanded LVS container instance and the information of the Nginx container instance to the database.
  • the capacity expansion device 400 of the multi-active load balancing application further includes a third judgment unit and a third prompt unit.
  • the third judgment unit is used to determine whether there is enough money in the resource group based on the number of container instances that need to be expanded, the usage time of the container instances that need to be expanded, and the resource group of the container instances that need to be expanded. To expand the corresponding container instance. If it is determined that there is not enough money in the resource group to expand the container instance, the third prompt unit is triggered for prompting. If it is determined that there is enough money in the resource group to expand the container instance, the third acquiring unit 402 is triggered.
  • FIG. 11 is a schematic block diagram of an expansion device for a multi-active load balancing application provided by another embodiment of the present application, corresponding to the case where the set container instance to be expanded is the container instance of the back-end application, specifically, corresponding to FIG.
  • the capacity expansion device 500 of the multi-active load balancing application includes a setting unit 501, an obtaining unit 502, a determining unit 503, a capacity expansion unit 504, and an application configuration updating unit 505.
  • the setting unit 501 For the setting unit 501, the obtaining unit 502, the determining unit 503, and the capacity expansion unit 504, please refer to the content described in the setting unit 101, the obtaining unit 102, the determining unit 103, and the capacity expansion unit 104 in the embodiment of FIG.
  • the setting unit 501 is also used to receive the expansion request of the back-end application of the multi-active load balancing application, obtain the back-end application identifier in the expansion request, and call the pre-processing according to the expansion request.
  • a setting interface is set to receive the number of container instances that need to be expanded by the back-end application set through the preset setting interface.
  • the obtaining unit 502 is further configured to obtain, according to the identification information of the back-end application, resource information required by the application environment of the back-end application, the area of the back-end application, and the container instance to be expanded by the back-end application.
  • the determining unit 503 is further configured to determine, according to the application environment of the back-end application, the area of the back-end application, the resource information required by the container instance to be expanded by the back-end application, and the set requirements of the back-end application.
  • the number of container instances to be expanded determines the host of the container instance to be expanded by the back-end application and the IP of the container instance to be expanded by the back-end application.
  • the capacity expansion unit 504 is further configured to inherit the information of the container instance created by the back-end application, create the expanded container instance of the back-end application on the determined host machine according to the information of the inherited container instance, and add The determined IP is set to the IP of the expanded container instance.
  • the application configuration updating unit 505 is configured to add the container instance information expanded by the back-end application to the configuration file of the Nginx load balancing application of the multi-active load balancing application according to the created container instance information.
  • the capacity expansion device 500 of the multi-active load balancing application further includes an information update unit 506.
  • the information update unit 506 is configured to update the container instance information of the expanded back-end application to the database.
  • the above-mentioned apparatus may be implemented in the form of a computer program, and the computer program may run on the computer device as shown in FIG. 12.
  • FIG. 12 is a schematic block diagram of a computer device provided by an embodiment of the application.
  • the equipment is a terminal and other equipment, such as a server in the PaaS platform.
  • the device 100 includes a processor 102, a memory, and a network interface 103 connected through a system bus 101, where the memory may include a non-volatile storage medium 104 and an internal memory 105.
  • the non-volatile storage medium 104 can store an operating system 1041 and a computer program 1042.
  • the computer program 1042 stored in the non-volatile storage medium is executed by the processor 102, the method for expanding the capacity of the multi-active load balancing application described in the above terminal can be implemented.
  • the processor 102 is used to provide computing and control capabilities and support the operation of the entire device 100.
  • the internal memory 105 provides an environment for the running of a computer program in a non-volatile storage medium. When the computer program is executed by the processor 102, the processor 102 can make the processor 102 execute the expansion method of the multi-active load balancing application described in the above terminal .
  • the network interface 103 is used for network communication.
  • the structure shown in the figure is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the device to which the solution of the present application is applied.
  • the specific device may include a diagram More or fewer components are shown in, or some components are combined, or have different component arrangements.
  • the processor 102 is configured to run a computer program stored in a memory to implement any embodiment of the method for expanding the capacity of the multiple-active load balancing application.
  • the processor 102 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (DSP). , Application-specific integrated circuit (application license Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the computer program may be stored in a storage medium, and the storage medium may be a computer-readable storage medium.
  • the computer program is executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiment.
  • the storage medium may be a computer-readable storage medium, and the computer-readable storage medium includes a non-volatile computer-readable storage medium.
  • the storage medium stores a computer program that, when executed by a processor, implements any embodiment of the method for expanding the capacity of the multi-active load balancing application.
  • the storage medium is a physical, non-transitory storage medium, such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.
  • a physical, non-transitory storage medium such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

一种多活负载均衡应用的扩容方法、装置、设备及存储介质,其涉及云计算技术领域,可应用于PaaS平台中。所述方法包括:根据所设置的需扩容的多活负载均衡应用的容器实例数量以及所获取的多活负载均衡应用的标识信息,获取多活负载均衡应用的应用环境、区域,并根据多活负载均衡应用的应用环境、区域、多活负载均衡应用需扩容的容器实例数量对所述多活负载均衡应用进行容器实例的扩容。

Description

多活负载均衡应用的扩容方法、装置、设备及存储介质
本申请要求于2019年6月18日提交中国专利局、申请号为CN 201910528149.X、申请名称为“多活负载均衡应用的扩容方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及云计算技术领域,尤其涉及一种多活负载均衡应用的扩容方法、装置、计算机设备及存储介质。
背景技术
使用LVS负载均衡应用和Nginx负载均衡应用实现多活负载均衡应用时,由于LVS负载均衡应用中的LVS容器有多个,Nginx负载均衡应用中的Nginx容器有多个,多活负载均衡应用的后端应用的容器也有多个,如此可满足一定程度的用户请求的并发量的需求。然而当用户请求短时间内大幅增加时,多活负载均衡应用中的原多个LVS容器或者原多个Nginx容器可能不能很好满足用户的需求,如会导致响应变慢等,影响用户的体验。
发明内容
本申请实施例提供一种多活负载均衡应用的扩容方法、装置、计算机设备及存储介质,可在用户请求短时间内大幅增加时保证服务的同时提高用户的体验,提高多活负载均衡应用扩容的效率。
第一方面,本申请实施例提供了一种多活负载均衡应用的扩容方法,包括:
若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量;根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息;根据多活负载均衡应用的应用环境、多活负载均衡 应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP;继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
第二方面,本申请实施例提供了一种多活负载均衡应用的扩容装置,该多活负载均衡应用的扩容装置包括用于执行上述第一方面所述的方法对应的单元。
第三方面,本申请实施例提供了一种计算机设备,所述计算机设备包括存储器,以及与所述存储器相连的处理器;
所述存储器用于存储计算机程序,所述处理器用于运行所述存储器中存储的计算机程序,以执行上述第一方面所述的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时,实现上述第一方面所述的方法。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的多活负载均衡应用的扩容方法的流程示意图;
图2是本申请实施例提供的多活负载均衡应用的扩容方法的子流程示意图;
图3是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图;
图4是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图;
图5是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意 图;
图6是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图;
图7是本申请实施例提供的多活负载均衡应用的扩容装置的示意性框图;
图8是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图;
图9是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图;
图10是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图;
图11是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图;
图12是本申请实施例提供的计算机设备的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
图1是本申请实施例提供的多活负载均衡应用的扩容方法的流程示意图。如图1所示,该方法包括S101-S104。
S101,若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量。
其中,多活负载均衡应用的扩容指令可由多种方式触发,如由用户触摸或者点击相关按钮或者图像触发,如在多活负载均衡应用的列表中,点击某一个多活负载均衡应用所对应的扩容按钮,触发该多活负载均衡应用的扩容指令;也可以接收用户的语音扩容信息来触发等。在本实施例中,多活负载均衡应用的扩容指令触发的方式不做限制。该扩容指令中包括多活负载均衡应用的信息, 如多活负载均衡应用的标识信息。多活负载均衡应用的标识信息可以为多活负载均衡应用的名称或者多活负载均衡应用的编号等等可以确定具体是哪一个多活负载均衡应用的信息。根据扩容指令调用扩容设置接口,其中,扩容设置接口是由开发人员开发的,可以以一个设置界面的形式存在。通过扩容设置接口可以设置该多活负载均衡应用需扩容的容器实例数量。
在本实施例中,该多活负载均衡应用包括LVS负载均衡应用和Nginx负载均衡应用,Nginx负载均衡应用可以看做是LVS负载均衡应用的的后端应用,以用来辅助LVS负载均衡应用。需要注意的是,“可以看做”这种表述只是为了方便理解多活负载均衡应用中的LVS负载均衡应用和Nginx负载均衡应用之间的关系。在该多活负载均衡应用中,LVS负载均衡应用有多个LVS容器(也称为LVS容器实例),Nginx负载均衡应用也有多个Nginx容器(也称为LVS容器实例)。该多活负载均衡应用可应用于特定的一种网络架构,该网络架构中的路由协议需要使用OSPF协议,以使得用户请求通过OSPF协议所对应的路由器的分发策略分发到不同的LVS容器上,LVS容器接收到用户请求后,按照LVS负载均衡算法将用户请求发送到Nginx容器实例上,Nginx容器实例接收到用户请求后,按照Nginx负载均衡算法将用户请求发送到多活负载均衡应用的后端应用,由后端应用来响应用户请求。多活负载均衡应用的后端应用可以理解为多活负载均衡应用所对应的服务应用,也即真正为用户提供某一服务的应用,该多活负载均衡应用为该后端应用提供负载均衡服务。
如此,通过扩容设置接口设置的该多活负载均衡应用需扩容的容器实例,包括:该多活负载均衡应用中的LVS负载均衡应用需扩容的容器实例,可以理解为,仅仅只有LVS负载均衡应用需要扩容,同时需扩容的容器实例数量为需扩容的LVS负载均衡应用的容器实例数量;或者该多活负载均衡应用中的Nginx负载均衡应用需扩容的容器实例,可以理解为,仅仅只有Nginx负载均衡应用需要扩容,同时需扩容的容器实例数量为需扩容的Nginx负载均衡应用的容器实例数量;或者该多活负载均衡应用中的LVS负载均衡应用需扩容的容器实例和Nginx负载均衡应用需扩容的容器实例,可以理解为,该多活负载均衡应用中的LVS负载均衡应用和Nginx负载均衡应用都需要进行扩容,同时需扩容的容器实例数量为需扩容的LVS负载均衡应用的容器实例数量和需扩容 的Nginx负载均衡应用的容器实例数量之和。
在一些实施例中,通过扩容设置接口还可以设置需扩容的容器实例使用时间、需扩容的容器实例的资源组等。其中,需扩容的容器实例使用时间可以月为单位,也可以以其他的时间为单位。需扩容的容器实例扩容成功后是需要收费的,多活负载均衡应用的资源组下包括有资源账户,用于扩容多活负载均衡应用的容器实例所需要使用的费用支出。
需要注意的是,多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组等信息可以通过接收用户在设置界面上选择或者输入的方式设置,也可以直接使用默认的多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组等信息。如需扩容的容器实例的资源组默认为创建多活负载均衡应用时所使用的资源组。在一实施例中,需扩容的容器实例数量还可以根据当前用户访问量的增加数量,以及预设的每个容器实例可以正常访问的用户访问量来确定。
S102,根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息。
根据多活负载均衡应用的标识信息可以确定哪一个多活负载均衡应用,以进一步在数据库中查找该多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息。
其中,多活负载均衡应用的应用环境包括生产环境、测试环境、开发环境等。其中,生产环境意味着该多活负载均衡应用创建成功后对接外部环境,或者供外部用户进行访问;测试环境意味着该多活负载均衡应用创建成功后供测试使用;开发环境意味着该多活负载均衡应用创建成功后供开发使用。根据多活负载均衡应用的应用环境和容器应用的区域确定容器应用创建的位置。其中,多活负载均衡应用的区域由两部分组成:“区域”+“安全区域”。其中,“安全区域”是“区域”下的一个子区域。确定多活负载均衡应用在哪个具体位置中,根据多活负载均衡应用的应用环境和多活负载均衡应用的区域共同决定,可以理解为将多活负载均衡应用创建在某个应用环境下某个区域所对应的机房中。如将多活负载均衡应用创建在测试环境下宝信(地名)区域下的SF(宝信下面的一个更小的区域标识)子区域所在的机房中。可以理解为,一个应用环境和一个 区域确定一个机房位置,同一个区域不同应用环境所对应的机房不同。
其中,扩容容器实例所需要的资源信息可以根据已经创建成功的容器实例中保存的创建该容器实例所需要使用的资源信息确定。若所设置的需扩容的多活负载均衡应用的容器实例为需扩容的LVS负载均衡应用的容器实例,那么扩容容器实例所需要的资源信息为需扩容的LVS容器实例所需要的资源信息;若所设置的需扩容的多活负载均衡应用的容器实例为需扩容的Nginx负载均衡应用的容器实例,那么扩容容器实例所需要的资源信息为需扩容的Nginx容器实例所需要的资源信息;若所设置的需扩容的多活负载均衡应用的容器实例包括需扩容的LVS负载均衡应用的容器实例和需扩容的Nginx负载均衡应用的容器实例,需扩容的容器实例所需要的资源信息包括对应的需扩容的LVS容器实例所需要的资源信息和需扩容的Nginx容器实例所需要的资源信息。
S103,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP。
根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机。具体地,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域确定多活负载均衡应用创建的位置;根据所确定的多活负载均衡应用创建的位置确定宿主机集群;根据需扩容的容器实例所需要的资源信息、所确定的宿主机集群确定需扩容的容器实例的具体宿主机。具体地,确定具体宿主机集群是通过编排工具自动确定的,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域,通过编排工具识别该多活负载均衡应用所处的宿主机集群,编排工具根据需扩容的容器实例所需要的资源信息、以及宿主机集群的资源情况确定需扩容的容器实例的宿主机,如宿主机中的资源至少要大于需扩容的容器实例所需要的资源信息,才可以在宿主机上创建容器实例。其中,编排工具可以为Marathon编排工具,还可以为其他的编排工具。其中,一个容器实例创建在一个宿主机上,可以理解地,一个容器实例对应一个宿主机。
根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、设置的需 扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的IP,具体地,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域确定多活负载均衡应用创建的位置;根据所确定的多活负载均衡应用创建的位置确定预先分配的用于创建容器实例的IP地址池;从IP地址池中获取与需扩容的多活负载均衡应用的容器实例数量相同的IP地址,将所获取的IP地址确定为需扩容的容器实例的IP。
S104,继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
若需扩容的容器实例为需扩容的LVS负载均衡应用的容器实例,那么与需扩容的容器实例相匹配且已创建的容器实例的信息为已创建的LVS容器的信息;若需扩容的容器实例为需扩容的Nginx负载均衡应用的容器实例,那么与需扩容的容器实例相匹配且已创建的容器实例的信息为已创建的Nginx容器实例的信息;若需扩容的容器实例为需扩容的LVS负载均衡应用的容器实例和Nginx负载均衡应用的容器实例,那么与需扩容的容器实例相匹配且已创建的容器实例的信息为已创建的LVS容器实例的信息和Nginx容器实例的信息。
在一实施例中,如图2所示,所述步骤S104包括以下步骤S1041-S1043。
S1041,继承与需扩容的容器实例相匹配且已创建的容器实例的信息。
继承与需扩容的容器实例相匹配且已创建的容器实例的信息,可以简单的理解为,复制与需扩容的容器实例相匹配且已创建的容器实例的信息。
S1042,通过容器编排工具将所继承的容器实例的信息发送到所确定的宿主机上,并创建扩容的容器实例。
根据所继承的、与需扩容的容器实例相匹配且已创建的容器实例的信息,在所确定的宿主机上创建需扩容的容器实例。如此,所创建的扩容的容器实例,是继承现有的已创建的容器实例的应用包以及配置等,并不是重新根据容器应用的应用镜像以及配置来创建的,即并不需要重新上传应用包以及配置等。如此,大大加快了扩容多活负载均衡应用的速度,可以达到秒级的扩容。同时,需要指出的是,若需扩容的容器实例的数量有多个,那么可以并行在所确定的宿主机上创建需扩容的容器实例。其中,每个需扩容的容器实例对应一个宿主 机,多个需扩容的容器实例并行的创建,进一步加快了扩容的速度。
在所确定的宿主机上创建需扩容的容器实例时,可通过容器编排工具将所继承的容器实例的信息发送到所确定的宿主机上,并在所确定的宿主机上创建需扩容的容器实例。其中,容器编排工具可以为Marathon工具,也可以为其他的工具。
S1043,通过自动化运维工具连接所创建的容器实例,将所创建的容器实例与所确定的IP进行绑定,以将所确定的IP设置为所创建的容器实例的IP。
需扩容的容器实例创建完成,需要为所创建的容器实例设置容器实例的IP。通过自动化运维工具来设置IP。其中,自动化运维工具如ansible工具等。
在一实施例中,所述方法还包括步骤S105。步骤S105:将所扩容的容器实例的信息更新至数据库。
其中,所扩容的容器实例信息包括所扩容的容器实例的IP,所扩容的容器实例所在的宿主机,所扩容的容器实例的数量等信息。更新数据库以保持与数据库中的数据一致。
在一实施例中,当所设置的信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组时,在步骤S102之前,所述方法还包括以下步骤:根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。
扩容多活负载均衡应用的容器实例所需要使用的费用根据需扩容的容器实例数量、需扩容的容器实例使用时间、每个需扩容的容器实例的每个月的单价来确定。即需扩容的容器实例所需要使用的费用=需扩容的LVS容器实例数量*需扩容的LVS容器实例使用时间*每个需扩容的LVS容器实例的每个月的单价+需扩容的Nginx容器实例数量*需扩容的Nginx容器实例使用时间*每个需扩容的Nginx容器实例的每个月的单价。计算该资源组中的剩余金额与需扩容的容器实例所需要使用的费用的差值;若差值大于等于零,则确定该资源组中存在足够金额以用来扩容容器实例;若差值小于零,则确定该资源组中没有足够金额以用来扩容容器实例。
若确定该资源组中存在足够金额来扩容容器实例,则执行步骤S102;若确 定该资源组中不存在足够金额来扩容容器实例,则进行提示。
上述方法实施例中若需扩容的容器实例包括LVS负载均衡应用的容器实例,那么所述方法还包括:将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
上述方法实施例中若需扩容的容器实例包括Nginx负载均衡应用的容器实例,那么所述方法还包括:根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
图3是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图。图3中,多活负载均衡应用需扩容的容器实例为该多活负载均衡应用中的LVS负载均衡应用需扩容的容器实例,即仅仅只有多活负载均衡应用中的LVS负载均衡应用需要扩容。如图3所示,该多活负载均衡应用的扩容方法包括以下步骤S301-S306。
S301,若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的LVS负载均衡应用的LVS容器实例数量。
S302,根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息。
S303,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息以及所设置的需扩容的LVS容器实例数量确定需扩容的LVS容器实例的宿主机和需扩容的LVS容器实例的IP。
S304,继承已创建的LVS容器实例的信息,根据所继承的LVS容器实例的信息在所确定的宿主机上创建扩容的LVS容器实例,并将所确定的IP设置为扩容的LVS容器实例的IP。
S305,将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
为了让LVS负载均衡应用可以提供服务,在创建LVS容器时会有对应的负载均衡应用所依赖的环境信息,该环境信息包括子网卡。需要指出的是,子网卡并不是实际上的网络接口设备,但是也可以作为网络接口在系统中出现,如eth0:1、eth1:2这种网络接口。它们必须要依赖于物理网卡,虽然可以与物理 网卡的网络接口同时在系统中存在并使用不同的IP地址,但是当所依赖的物理网卡不启用时(Down状态)这些子网卡也将一同不能工作。一个LVS容器可以对应有多个子网卡。
将LVS负载均衡应用的虚拟IP分配给LVS容器的一个子网卡,如此,可通过虚拟IP访问该子网卡。需要注意的是,一个虚拟IP对应一个子网卡,因此无论LVS负载均衡的端口有多少个,那么都对应一个子网卡。在一实施例中,配置该LVS容器的子网卡,可通过运行命令来实现。如:ifconfig eth0:1192.168.1.54 netmask 255.255.255.255 broadcast 192.168.1.54up。其中,eth0:1表示子网卡eth0的网络接口1,192.168.1.54为虚拟IP,255.255.255.255为掩码地址,192.168.1.54为广播地址。
在一实施例中,所述方法还包括步骤S306。步骤S306:将所扩容的LVS容器实例信息更新至数据库。
在一实施例中,当所设置的信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组时,在步骤S302之前,所述方法还包括以下步骤:根据多活负载均衡应用需扩容的LVS容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的LVS容器实例。
若确定该资源组中存在足够金额来扩容LVS容器实例,则执行步骤S302;若确定该资源组中不存在足够金额来扩容LVS容器实例,则进行提示。
该实施例中其他步骤的详细实现方式可参看图1实施例中的描述,在此不再赘述。
图4是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图。图4中,多活负载均衡应用需扩容的容器实例为该多活负载均衡应用中的Nginx负载均衡应用需扩容的容器实例,即仅仅只有多活负载均衡应用中的Nginx负载均衡应用需要扩容。如图4所示,该多活负载均衡应用的扩容方法包括以下步骤S401-S405。
S401,若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的Nginx负载均衡应用的Nginx容器实例数量。
S402,根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息。
S403,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息以及所设置的需扩容的Nginx容器实例数量确定需扩容的Nginx容器实例的宿主机和需扩容的Nginx容器实例的IP。
S404,继承已创建的Nginx容器实例的信息,根据所继承的Nginx容器实例的信息在所确定的宿主机上创建扩容的Nginx容器实例,并将所确定的IP设置为扩容的Nginx容器实例的IP。
S405,根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
可以理解地,在多活负载均衡应用中,Nginx负载均衡应用相当于LVS负载均衡应用的后端应用,因此,在LVS负载均衡应用的配置文件(该处所说的配置文件对应的是keeplived.conf)中记录了Nginx容器实例的信息。扩容Nginx容器实例后,若想所扩容的Nginx容器实例开始提供服务,需要在LVS负载均衡应用的配置文件中将所扩容的容器实例添加进去,以使得LVS负载均衡应用在分配用户请求时将用户请求可分配到所扩容的Nginx容器实例上。
在一实施例中,获取预先设置的容器实例模板;对于Nginx负载均衡应用的每一个端口,根据所扩容的Nginx容器实例数量将容器实例模板复制相同数量的份数;将所扩容的Nginx容器实例的IP替换容器实例模板中的容器实例的IP参数、将Nginx负载均衡应用的该端口替换容器实例模板中的端口参数,如此,完成所有容器实例模板的替换;将替换后的容器实例模板插入到由LVS负载均衡应用的配置文件中的相应位置,以在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
其中,容器实例模板中包括容器实例的IP参数、容器实例提供服务的端口参数、容器实例的健康检查参数、容器实例的权重参数等,其中,容器实例提供服务的端口参数根据Nginx负载均衡应用的端口确定,容器实例的健康检查参数、容器实例的权重参数等中的参数值都有对应的默认值。在替换时,对于Nginx负载均衡应用的每个端口,一个所扩容的Nginx容器实例的IP替换一个容器实例模板中的IP。可以理解地,若Nginx负载均衡应用的端口有2个,而 所扩容的Nginx容器实例的数量为1个,那么需要复制2份容器实例模板;若Nginx负载均衡应用的端口有2个,而所扩容的Nginx容器实例的数量为2个,那么需要复制4份容器实例模板。每个容器实例模板中对应一个Nginx端口和一个所扩容的Nginx容器实例的IP。在LVS负载均衡应用的配置文件中,由虚拟IP和每个LVS端口所确定的一段代码段中,在最后一个real server所对应的代码端之后,添加所替换后的容器实例模板内容。其中,每个real server对应一个Nginx负载均衡应用的容器实例。
在一实施例中,一个容器实例模板可包括以下内容:
Figure PCTCN2019103353-appb-000001
其中,xxx.yyy.zzz.nnn表示Nginx负载均衡应用的一个Nginx容器的IP、realserver-port表示Nginx负载均衡应用的端口、weight表示容器实例所对应服务器的权重参数、TCP_CHECK表示容器实例所对应的服务器的TCP健康检查参数,该参数中包括以下参数:connect_timeout表示连接超时时间参数、nb_get_retry表示重连次数参数、delay_before_retry表示重连间隔时间参数、connect_port表示所连接的Nginx负载均衡应用的端口参数。
在一实施例中,若没有预先保存的容器实例模板,也可直接获取LVS负载均衡应用中的real server部分的代码段内容作为容器实例模板。
在一实施例中,所述方法还包括步骤S406。步骤S406:将所扩容的Nginx容器实例的信息更新至数据库。
在一实施例中,当所设置的信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组时,在步骤S402之前,所述方法还包括以下步骤:根据多活负载均衡应用需扩容的Nginx容器实例数量、需扩容的容器实例使用时间、 需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的Nginx容器实例。
若确定该资源组中存在足够金额来扩容Nginx容器实例,则执行步骤S402;若确定该资源组中不存在足够金额来扩容Nginx容器实例,则进行提示。
该实施例中其他步骤的详细实现方式可参看图1实施例中的描述,在此不再赘述。
图5是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图。图5中,多活负载均衡应用需扩容的容器实例为该多活负载均衡应用中的LVS负载均衡应用需扩容的容器实例和Nginx负载均衡应用需扩容的容器实例,即多活负载均衡应用中的LVS负载均衡应用和Nginx负载均衡应用均需要扩容。如图5所示,该多活负载均衡应用的扩容方法包括以下步骤S501-S506。
S501,若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的LVS负载均衡应用的LVS容器实例数量和Nginx负载均衡应用的Nginx容器实例数量。
S502,根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息以及需扩容的Nginx容器实例所需要的资源信息。
S503,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息、需扩容的Nginx容器实例所需要的资源信息以及所设置的需扩容的LVS容器实例数量和需扩容的Nginx容器实例数量,确定需扩容的LVS容器实例的宿主机、需扩容的LVS容器实例的IP,以及需扩容的Nginx容器实例的宿主机、需扩容的Nginx容器实例的IP。
在一实施例中,可分别确定LVS容器实例的宿主机和LVS容器实例的IP、Nginx容器实例的宿主机和Nginx容器实例的IP。如此,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息、所设置的需扩容的LVS容器实例数量确定需扩容的LVS容器实例的宿主机、需扩容的LVS容器实例的IP。根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息、所设置 的需扩容的Nginx容器实例数量确定需扩容的Nginx容器实例的宿主机、需扩容的Nginx容器实例的IP。
在一实施例中,可分别确定LVS容器实例的宿主机、Nginx容器实例的宿主机,再确定LVS容器实例和Nginx容器实例的IP。如此,根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息、所设置的需扩容的LVS容器实例数量确定需扩容的LVS容器实例的宿主机。根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息、所设置的需扩容的Nginx容器实例数量确定需扩容的Nginx容器实例的宿主机。根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、所设置的需扩容的LVS容器实例数量、所设置的需扩容的Nginx容器实例数量确定需扩容的LVS容器实例和Nginx容器实例的IP。
S504,继承已创建的LVS容器实例的信息和Nginx容器实例的信息,根据所继承的LVS容器实例的信息在所确定的部分宿主机上创建扩容的LVS容器实例,并根据所继承的Nginx容器实例的信息在所确定的其他宿主机上创建扩容的Nginx容器实例,将所确定的IP设置为扩容的LVS容器实例和Nginx容器实例的IP。
S505,根据所创建的Nginx容器实例在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例信息。
S506,将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
在一实施例中,所述方法还包括步骤S507。步骤S507:将所扩容的Nginx容器实例的信息和LVS容器实例的信息更新至数据库。
在一实施例中,当所设置的信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组时,在步骤S502之前,所述方法还包括:根据多活负载均衡应用需扩容的LVS容器实例数量、Nginx容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。
若确定该资源组中存在足够金额来扩容对应的容器实例,则执行步骤 S502;若确定该资源组中不存在足够金额来扩容对应的容器实例,则进行提示。
该实施例中其他步骤的详细实现方式可参看上述实施例中对应的描述,在此不再赘述。
上述图1-图5所述的实施例都是涉及到多活负载均衡应用中的LVS负载均衡应用和/或Nginx负载均衡应用的扩容。上述方法实施例可实现对多活负载均衡应用的容器实例的扩容,在用户请求短时间内大幅增加时保证服务的同时提高用户的体验,且除了需设置扩容的容器实例的数量的信息外,其他具体的多活负载均衡应用的容器实例扩容的过程是自动进行的,提高了扩容的效率,节约了时间成本和人工成本;同时通过设置接口来设置需扩容的容器实例的数量的信息,使用户一目了然的了解和设置相关的设置,提高了用户的体验,无需较高的专业知识即可实现多活负载均衡应用的扩容。
在一实施例中,在多活负载均衡应用的扩容方法中还包括多活负载均衡应用的后端应用的扩容。图6是本申请另一实施例提供的多活负载均衡应用的扩容方法的流程示意图。如图6所示,该方法包括以下步骤S601-S605。
S601,若接收到多活负载均衡应用的后端应用的扩容请求,获取扩容请求中的后端应用标识,并根据扩容请求调用预设设置接口,以接收通过所述预设设置接口设置的所述后端应用需扩容的容器实例数量。
S602,根据所述后端应用的标识信息获取所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息。
S603,根据所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息以及所设置的所述后端应用需扩容的容器实例数量,确定所述后端应用需扩容的容器实例的宿主机和所述后端应用需扩容的容器实例的IP。
S604,继承所述后端应用已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建所述后端应用的扩容容器实例,并将所确定的IP设置为扩容的容器实例的IP。
S605,根据所创建的容器实例的信息在多活负载均衡应用的Nginx负载均衡应用的配置文件中添加所述后端应用所扩容的容器实例信息。
具体地,在Nginx负载均衡应用的配置文件(该处的配置文件指的是 Nginx.conf)中的upstream节点中添加所创建的容器实例的信息中的容器实例的IP和容器实例所对应的端口。如所添加的后端应用所扩容的容器实例信息,包括:server 192.168.12.23:8080。
在一实施例中,所述方法还包括步骤S606。步骤S606,将所扩容的后端应用的容器实例的信息更新至数据库。
图7是本申请实施例提供的多活负载均衡应用的扩容装置的示意性框图。该装置包括用于执行上述多活负载均衡应用的扩容方法所对应的单元。如图7所示,该多活负载均衡应用的扩容装置100包括设置单元101、获取单元102、确定单元103、扩容单元104。
设置单元101,用于若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量。获取单元102,用于根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息。确定单元103,用于根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP。扩容单元104,用于继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
在一实施例中,扩容单元104包括继承单元、容器创建单元、IP设置单元。其中,继承单元,用于继承与需扩容的容器实例相匹配且已创建的容器实例的信息。容器创建单元,用于通过容器编排工具将所继承的容器实例的信息发送到所确定的宿主机上,并创建扩容的容器实例。IP设置单元,用于通过自动化运维工具连接所创建的容器实例,将所创建的容器实例与所确定的IP进行绑定,以将所确定的IP设置为所创建的容器实例的IP。
在一实施例中,该多活负载均衡应用的扩容装置100还包括信息更新单元105。该信息更新单元105,用于将所扩容的容器实例的信息更新至数据库。
在一实施例中,该多活负载均衡应用的扩容装置100还包括判断单元、提 示单元。其中,判断单元,用于根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。若确定该资源组中不存在足够金额来扩容容器实例,触发提示单元,以用于进行提示。若确定该资源组中存在足够金额来扩容容器实例,触发获取单元102。
图8是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图,对应于所设置的需扩容的容器实例为需扩容的LVS负载均衡应用的LVS容器实例的情况,具体地,对应于图3所示的多活负载均衡应用的扩容方法所对应的单元。如图8所示,该多活负载均衡应用的扩容装置200包括第一设置单元201、第一获取单元202、第一确定单元203、第一扩容单元204、第一绑定单元205。
第一设置单元201,用于若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的LVS负载均衡应用的LVS容器实例数量。第一获取单元202,用于根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息。第一确定单元203,用于根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息以及所设置的需扩容的LVS容器实例数量确定需扩容的LVS容器实例的宿主机和需扩容的LVS容器实例的IP。第一扩容单元204,用于继承已创建的LVS容器实例的信息,根据所继承的LVS容器实例的信息在所确定的宿主机上创建扩容的LVS容器实例,并将所确定的IP设置为扩容的LVS容器实例的IP。第一绑定单元205,将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
在一实施例中,该多活负载均衡应用的扩容装置200还包括第一信息更新单元206。该第一信息更新单元206,用于将所扩容的LVS容器实例的信息更新至数据库。
在一实施例中,该多活负载均衡应用的扩容装置200还包括第一判断单元、第一提示单元。其中,第一判断单元,用于根据多活负载均衡应用需扩容的容 器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。若确定该资源组中不存在足够金额来扩容容器实例,触发第一提示单元,以用于进行提示。若确定该资源组中存在足够金额来扩容容器实例,触发第一获取单元202。
图9是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图,对应于所设置的需扩容的容器实例为需扩容的Nginx负载均衡应用的Nginx容器实例的情况,具体地,对应于图4所示的多活负载均衡应用的扩容方法所对应的单元。如图9所示,该多活负载均衡应用的扩容装置300包括第二设置单元301、第二获取单元302、第二确定单元303、第二扩容单元304、第一配置更新单元305。
第二设置单元301,用于若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的Nginx负载均衡应用的Nginx容器实例数量。第二获取单元302,用于根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息。第二确定单元303,用于根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的Nginx容器实例所需要的资源信息以及所设置的需扩容的Nginx容器实例数量确定需扩容的Nginx容器实例的宿主机和需扩容的Nginx容器实例的IP。第二扩容单元304,用于继承已创建的Nginx容器实例的信息,根据所继承的Nginx容器实例的信息在所确定的宿主机上创建扩容的Nginx容器实例,并将所确定的IP设置为扩容的Nginx容器实例的IP。第一配置更新单元305,用于根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
在一实施例中,该多活负载均衡应用的扩容装置300还包括第二信息更新单元306。其中,第二信息更新单元306,用于将所扩容的Nginx容器实例的信息更新至数据库。
在一实施例中,该多活负载均衡应用的扩容装置300还包括第二判断单元、第二提示单元。其中,第二判断单元,用于根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所 述资源组中是否存在足够金额以用来扩容对应的容器实例。若确定该资源组中不存在足够金额来扩容容器实例,触发第二提示单元,以用于进行提示。若确定该资源组中存在足够金额来扩容容器实例,触发第二获取单元302。
图10是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图,对应于所设置的需扩容的容器实例包括需扩容的Nginx负载均衡应用的Nginx容器实例和需扩容的Nginx负载均衡应用的Nginx容器实例的情况,具体地,对应于图5所示的多活负载均衡应用的扩容方法所对应的单元。如图10所示,该多活负载均衡应用的扩容装置400包括第三设置单元401、第三获取单元402、第三确定单元403、第三扩容单元404、第二配置更新单元405、第二绑定单元406。
第三设置单元401,用于若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的LVS负载均衡应用的LVS容器实例数量和Nginx负载均衡应用的Nginx容器实例数量。第三获取单元402,用于根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息以及需扩容的Nginx容器实例所需要的资源信息。第三确定单元403,用于根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的LVS容器实例所需要的资源信息、需扩容的Nginx容器实例所需要的资源信息以及所设置的需扩容的LVS容器实例数量和需扩容的Nginx容器实例数量,确定需扩容的LVS容器实例的宿主机、需扩容的LVS容器实例的IP,以及需扩容的Nginx容器实例的宿主机、需扩容的Nginx容器实例的IP。第三扩容单元404,用于继承已创建的LVS容器实例的信息和Nginx容器实例的信息,根据所继承的LVS容器实例的信息在所确定的部分宿主机上创建扩容的LVS容器实例,并根据所继承的Nginx容器实例的信息在所确定的其他宿主机上创建扩容的Nginx容器实例,将所确定的IP设置为扩容的LVS容器实例和Nginx容器实例的IP。第二配置更新单元405,用于根据所创建的Nginx容器实例在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。第二绑定单元406,用于将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
在一实施例中,所述多活负载均衡应用的扩容装置400还包括第三信息更新单元407。其中,第三信息更新单元407,用于将所扩容的LVS容器实例的信息和Nginx容器实例的信息更新至数据库。
在一实施例中,所述所述多活负载均衡应用的扩容装置400还包括第三判断单元、第三提示单元。其中,第三判断单元,用于根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。若确定该资源组中不存在足够金额来扩容容器实例,触发第三提示单元,以用于进行提示。若确定该资源组中存在足够金额来扩容容器实例,触发第三获取单元402。
图11是本申请另一实施例提供的多活负载均衡应用的扩容装置的示意性框图,对应于所设置的需扩容的容器实例为后端应用的容器实例的情况,具体地,对应于图6所示的多活负载均衡应用的扩容方法所对应的单元。如图11所示,该多活负载均衡应用的扩容装置500包括设置单元501、获取单元502、确定单元503、扩容单元504、应用配置更新单元505。其中,设置单元501、获取单元502、确定单元503、扩容单元504请参看图7实施例中的设置单元101、获取单元102、确定单元103、扩容单元104所述的内容。该实施例与图7实施例的区别在于:设置单元501,还用于接收到多活负载均衡应用的后端应用的扩容请求,获取扩容请求中的后端应用标识,并根据扩容请求调用预设设置接口,以接收通过所述预设设置接口设置的所述后端应用需扩容的容器实例数量。获取单元502,还用于根据所述后端应用的标识信息获取所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息。确定单元503,还用于根据所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息以及所设置的所述后端应用需扩容的容器实例数量,确定所述后端应用需扩容的容器实例的宿主机和所述后端应用需扩容的容器实例的IP。扩容单元504,还用于继承所述后端应用已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建所述后端应用的扩容容器实例,并将所确定的IP设置为扩容的容器实例的IP。应用配置更新单元505,用于根据所创建的容器实例信息多活负载均衡应用的Nginx负载均衡应用的配置文件中添加所述后端应用所扩容的容 器实例信息。
在一实施例中,该多活负载均衡应用的扩容装置500还包括信息更新单元506。其中,信息更新单元506,用于,将所扩容的后端应用的容器实例信息更新至数据库。需要说明的是,所属领域的技术人员可以清楚地了解到,上述装置和各单元的具体实现过程,可以参考前述方法实施例中的相应描述,为了描述的方便和简洁,在此不再赘述。
上述装置可以实现为一种计算机程序的形式,计算机程序可以在如图12所示的计算机设备上运行。
图12为本申请实施例提供的一种计算机设备的示意性框图。该设备为终端等设备,如PaaS平台中的服务器等。该设备100包括通过系统总线101连接的处理器102、存储器和网络接口103,其中,存储器可以包括非易失性存储介质104和内存储器105。
该非易失性存储介质104可存储操作系统1041和计算机程序1042。该非易失性存储介质中所存储的计算机程序1042被处理器102执行时,可实现上述终端中所述的多活负载均衡应用的扩容方法。该处理器102用于提供计算和控制能力,支撑整个设备100的运行。该内存储器105为非易失性存储介质中的计算机程序的运行提供环境,该计算机程序被处理器102执行时,可使得处理器102执行上述终端中所述的多活负载均衡应用的扩容方法。该网络接口103用于进行网络通信。本领域技术人员可以理解,图中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的设备的限定,具体的设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
其中,所述处理器102用于运行存储在存储器中的计算机程序,以实现上述多活负载均衡应用的扩容方法的任一实施例。
应当理解,在本申请实施例中,所称处理器102可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(应用程序lication Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立 硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
本领域普通技术人员可以理解的是实现上述实施例的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序可存储于一存储介质中,该存储介质可以为计算机可读存储介质。该计算机程序被该计算机系统中的至少一个处理器执行,以实现上述方法的实施例的流程步骤。
因此,本申请还提供了一种存储介质。该存储介质可以为计算机可读存储介质,该计算机可读存储介质包括非易失性计算机可读存储介质。该存储介质存储有计算机程序,该计算机程序当被处理器执行时实现上述多活负载均衡应用的扩容方法的任一实施例。
所述存储介质为实体的、非瞬时性的存储介质,例如可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的实体存储介质。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置、设备和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置、设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种多活负载均衡应用的扩容方法,所述方法包括:
    若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量;
    根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息;
    根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP;
    继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
  2. 根据权利要求1所述的方法,其中,所述多活负载均衡应用包括LVS(Linux Virtual Server)负载均衡应用和Nginx负载均衡应用;
    所述所设置的需扩容的多活负载均衡应用的容器实例为需扩容的LVS负载均衡应用的容器实例;所述所设置的需扩容的多活负载均衡应用的容器实例数量为需扩容的LVS负载均衡应用的容器实例数量;所述需扩容的容器实例所需要的资源信息为需扩容的LVS容器实例所需要的资源信息;所述与需扩容的容器实例相匹配且已创建的容器实例的信息为已创建的LVS负载均衡应用的LVS容器实例的信息;
    所述方法还包括:将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
  3. 根据权利要求1所述的方法,其中,所述多活负载均衡应用包括Nginx负载均衡应用和Nginx负载均衡应用;
    所述所设置的需扩容的多活负载均衡应用的容器实例为需扩容的Nginx负载均衡应用的容器实例;所述所设置的需扩容的多活负载均衡应用的容器实例数量为需扩容的Nginx负载均衡应用的容器实例数量;所述需扩容的容器实例所需要的资源信息为需扩容的Nginx容器实例所需要的资源信息;所述与需扩 容的容器实例相匹配且已创建的容器实例的信息为已创建的Nginx负载均衡应用的Nginx容器实例的信息;
    所述方法还包括:根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
  4. 根据权利要求1所述的方法,其中,所述多活负载均衡应用包括LVS(Linux Virtual Server)负载均衡应用和Nginx负载均衡应用;
    所述所设置的需扩容的多活负载均衡应用的容器实例包括需扩容的LVS负载均衡应用的容器实例和Nginx负载均衡应用的容器实例;所述所设置的需扩容的多活负载均衡应用的容器实例数量包括需扩容的LVS负载均衡应用的容器实例数量和需扩容的Nginx负载均衡应用的容器实例数量;所述需扩容的容器实例所需要的资源信息包括需扩容的LVS容器实例所需要的资源信息和需扩容的Nginx容器实例所需要的资源信息;所述与需扩容的容器实例相匹配且已创建的容器实例的信息包括已创建的LVS负载均衡应用的LVS容器实例的信息,和已创建的Nginx负载均衡应用的Nginx容器实例的信息;
    所述继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP,包括:继承已创建的LVS容器实例的信息和Nginx容器实例的信息,根据所继承的LVS容器实例的信息在所确定的部分宿主机上创建扩容的LVS容器实例,并根据所继承的Nginx容器实例的信息在所确定的其他宿主机上创建扩容的Nginx容器实例,将所确定的IP设置为扩容的LVS容器实例和Nginx容器实例的IP;
    所述方法还包括:
    将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定,并根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
  5. 根据权利要求1所述的方法,其中,所述方法还包括:
    若接收到多活负载均衡应用的后端应用的扩容请求,获取扩容请求中的后端应用标识,并根据扩容请求调用预设设置接口,以接收通过所述预设设置接口设置的所述后端应用需扩容的容器实例数量;
    根据所述后端应用的标识信息获取所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息;
    根据所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息以及所设置的所述后端应用需扩容的容器实例数量,确定所述后端应用需扩容的容器实例的宿主机和所述后端应用需扩容的容器实例的IP;
    继承所述后端应用已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建所述后端应用的扩容容器实例,并将所确定的IP设置为扩容的容器实例的IP;
    根据所创建的容器实例信息在多活负载均衡应用的Nginx负载均衡应用的配置文件中添加所述后端应用所扩容的容器实例信息。
  6. 根据权利要求1所述的方法,其中,所述继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP,包括:
    继承与需扩容的容器实例相匹配且已创建的容器实例的信息;
    通过容器编排工具将所继承的容器实例的信息发送到所确定的宿主机上,并创建扩容的容器实例;
    通过自动化运维工具连接所创建的容器实例,将所创建的容器实例与所确定的IP进行绑定,以将所确定的IP设置为所创建的容器实例的IP。
  7. 根据权利要求1-6任一项所述的方法,其中,所述方法还包括:
    将所扩容的容器实例的信息更新至数据库。
  8. 根据权利要求1所述的方法,其中,所述需扩容的容器实例所需要的资源信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组,在所述根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息的步骤之前,所述方法还包括以下步骤:根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。
  9. 一种多活负载均衡应用的扩容装置,其中,所述装置包括:
    设置单元,用于若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量;
    获取单元,用于根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息;
    确定单元,用于根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP;
    扩容单元,用于继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
  10. 如权利要求9所述的多活负载均衡应用的扩容装置,其中,所述多活负载均衡应用包括LVS(LinuxVirtual Server)负载均衡应用和Nginx负载均衡应用;
    所述所设置的需扩容的多活负载均衡应用的容器实例为需扩容的LVS负载均衡应用的容器实例;所述所设置的需扩容的多活负载均衡应用的容器实例数量为需扩容的LVS负载均衡应用的容器实例数量;所述需扩容的容器实例所需要的资源信息为需扩容的LVS容器实例所需要的资源信息;所述与需扩容的容器实例相匹配且已创建的容器实例的信息为已创建的LVS负载均衡应用的LVS容器实例的信息;
    所述多活负载均衡应用的扩容装置还包括:
    第一绑定单元,用于将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
  11. 一种计算机设备,所述计算机设备包括存储器,以及与所述存储器相连的处理器;
    其中,所述存储器用于存储计算机程序;所述处理器用于运行所述存储器中存储的计算机程序,以执行如下操作:
    若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载 均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量;
    根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息;
    根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP;
    继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
  12. 如权利要求11所述的计算机设备,其中,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
  13. 如权利要求11所述的计算机设备,其中,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
  14. 如权利要求11所述的计算机设备,其中,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定,并根据所创建的Nginx容器实例的信息在LVS负载均衡应用的配置文件中添加所扩容的Nginx容器实例的信息。
  15. 如权利要求11所述的计算机设备,其中,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    若接收到多活负载均衡应用的后端应用的扩容请求,获取扩容请求中的后端应用标识,并根据扩容请求调用预设设置接口,以接收通过所述预设设置接口设置的所述后端应用需扩容的容器实例数量;
    根据所述后端应用的标识信息获取所述后端应用的应用环境、所述后端应 用的区域、所述后端应用需扩容的容器实例所需要的资源信息;
    根据所述后端应用的应用环境、所述后端应用的区域、所述后端应用需扩容的容器实例所需要的资源信息以及所设置的所述后端应用需扩容的容器实例数量,确定所述后端应用需扩容的容器实例的宿主机和所述后端应用需扩容的容器实例的IP;
    继承所述后端应用已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建所述后端应用的扩容容器实例,并将所确定的IP设置为扩容的容器实例的IP;
    根据所创建的容器实例信息在多活负载均衡应用的Nginx负载均衡应用的配置文件中添加所述后端应用所扩容的容器实例信息。
  16. 如权利要求11所述的计算机设备,其中,所述继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP,包括:
    继承与需扩容的容器实例相匹配且已创建的容器实例的信息;
    通过容器编排工具将所继承的容器实例的信息发送到所确定的宿主机上,并创建扩容的容器实例;
    通过自动化运维工具连接所创建的容器实例,将所创建的容器实例与所确定的IP进行绑定,以将所确定的IP设置为所创建的容器实例的IP。
  17. 如权利要求11-16任一项所述的计算机设备,其中,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    将所扩容的容器实例的信息更新至数据库。
  18. 如权利要求11所述的计算机设备,其中,所述需扩容的容器实例所需要的资源信息还包括需扩容的容器实例使用时间、需扩容的容器实例的资源组,所述处理器用于运行所述存储器中存储的计算机程序,还执行如下操作:
    根据多活负载均衡应用需扩容的容器实例数量、需扩容的容器实例使用时间、需扩容的容器实例的资源组确定所述资源组中是否存在足够金额以用来扩容对应的容器实例。
  19. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算 机程序,所述计算机程序被处理器执行时,实现如下步骤:
    若接收到多活负载均衡应用的扩容指令,获取所述扩容指令中的多活负载均衡应用的标识信息,并调用扩容设置接口,以接收通过扩容设置接口设置的需扩容的多活负载均衡应用的容器实例数量;
    根据多活负载均衡应用的标识信息获取多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息;
    根据多活负载均衡应用的应用环境、多活负载均衡应用的区域、需扩容的容器实例所需要的资源信息以及所设置的需扩容的多活负载均衡应用的容器实例数量确定需扩容的容器实例的宿主机和需扩容的容器实例的IP;
    继承与需扩容的容器实例相匹配且已创建的容器实例的信息,根据所继承的容器实例的信息在所确定的宿主机上创建扩容的容器实例,并将所确定的IP设置为扩容的容器实例的IP。
  20. 如权利要求19所述的一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时,还实现如下步骤:
    将所创建的LVS容器实例的子网卡与LVS负载均衡应用的虚拟IP进行绑定。
PCT/CN2019/103353 2019-06-18 2019-08-29 多活负载均衡应用的扩容方法、装置、设备及存储介质 WO2020252921A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910528149.X 2019-06-18
CN201910528149.XA CN110417856B (zh) 2019-06-18 2019-06-18 多活负载均衡应用的扩容方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020252921A1 true WO2020252921A1 (zh) 2020-12-24

Family

ID=68359341

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103353 WO2020252921A1 (zh) 2019-06-18 2019-08-29 多活负载均衡应用的扩容方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN110417856B (zh)
WO (1) WO2020252921A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242700A (zh) * 2021-04-23 2022-10-25 网联清算有限公司 一种通信传输方法、装置及系统

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710488B (zh) * 2022-03-29 2024-05-03 浪潮云信息技术股份公司 实现弹性伸缩跨可用区伸缩的方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070250836A1 (en) * 2006-04-24 2007-10-25 Inventec Corporation Method for expanding data flow
CN102681899A (zh) * 2011-03-14 2012-09-19 金剑 云计算服务平台的虚拟计算资源动态管理系统
US20140307580A1 (en) * 2013-04-13 2014-10-16 Hei Tao Fung Switch fabric
CN105979009A (zh) * 2016-07-06 2016-09-28 乾云众创(北京)信息科技研究院有限公司 一种针对云应用容器的增加负载自动均衡方法
CN109660466A (zh) * 2019-02-26 2019-04-19 浪潮软件集团有限公司 一种面向云数据中心租户的多活负载均衡实现方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106301829B (zh) * 2015-05-21 2019-08-09 华为技术有限公司 一种网络业务扩容的方法和装置
CN106453564B (zh) * 2016-10-18 2019-11-05 北京京东尚科信息技术有限公司 弹性云分布式海量请求处理的方法、装置及系统
CN108205481B (zh) * 2016-12-19 2022-03-08 华为技术有限公司 应用的容器实例创建方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070250836A1 (en) * 2006-04-24 2007-10-25 Inventec Corporation Method for expanding data flow
CN102681899A (zh) * 2011-03-14 2012-09-19 金剑 云计算服务平台的虚拟计算资源动态管理系统
US20140307580A1 (en) * 2013-04-13 2014-10-16 Hei Tao Fung Switch fabric
CN105979009A (zh) * 2016-07-06 2016-09-28 乾云众创(北京)信息科技研究院有限公司 一种针对云应用容器的增加负载自动均衡方法
CN109660466A (zh) * 2019-02-26 2019-04-19 浪潮软件集团有限公司 一种面向云数据中心租户的多活负载均衡实现方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242700A (zh) * 2021-04-23 2022-10-25 网联清算有限公司 一种通信传输方法、装置及系统
CN115242700B (zh) * 2021-04-23 2024-03-22 网联清算有限公司 一种通信传输方法、装置及系统

Also Published As

Publication number Publication date
CN110417856A (zh) 2019-11-05
CN110417856B (zh) 2022-04-26

Similar Documents

Publication Publication Date Title
CN108549580B (zh) 自动部署Kubernetes从节点的方法及终端设备
CN110289982B (zh) 容器应用的扩容方法、装置、计算机设备及存储介质
US10700947B2 (en) Life cycle management method and device for network service
US20210004258A1 (en) Method and Apparatus for Creating Virtual Machine
CN106537338B (zh) 自扩展云
US9887959B2 (en) Methods and system for allocating an IP address for an instance in a network function virtualization (NFV) system
EP3754494A1 (en) Using multidimensional metadata tag sets to determine resource allocation in a distributed computing environment
CN109067877B (zh) 一种云计算平台部署的控制方法、服务器及存储介质
EP3664372A1 (en) Network management method and related device
CN110224860B (zh) 负载均衡应用创建方法、装置、计算机设备及存储介质
US10826723B1 (en) Virtual network address space auto-migration
CN110266761B (zh) 负载均衡应用创建方法、装置、计算机设备及存储介质
CN109981493B (zh) 一种用于配置虚拟机网络的方法和装置
US11036535B2 (en) Data storage method and apparatus
EP3879875A1 (en) Resource change method and device, apparatus, and storage medium
US20180004563A1 (en) Orchestrator apparatus, system, virtual machine creation method, and computer-readable recording medium
JP6003590B2 (ja) データセンタ,仮想システムの複写サービスの提供方法,データセンタの管理サーバ及び仮想システムの複写プログラム
CN113495732A (zh) 服务器部署方法、装置、设备及可读存储介质
WO2020252921A1 (zh) 多活负载均衡应用的扩容方法、装置、设备及存储介质
WO2020232891A1 (zh) 负载均衡应用虚拟ip切换方法、装置、计算机设备及存储介质
JP2018526916A (ja) リソース管理方法および装置
US11785054B2 (en) Deriving system architecture from security group relationships
CN112311669B (zh) 网络业务切换方法、装置、系统和存储介质
EP3531282A1 (en) Accelerator loading method and system, and accelerator loading apparatus
CN110365742B (zh) 多活负载均衡应用创建方法、装置、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19933489

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19933489

Country of ref document: EP

Kind code of ref document: A1