CN110399137A - Port delet method, device, equipment and the storage medium of more live load equilibrium applications - Google Patents

Port delet method, device, equipment and the storage medium of more live load equilibrium applications Download PDF

Info

Publication number
CN110399137A
CN110399137A CN201910527674.XA CN201910527674A CN110399137A CN 110399137 A CN110399137 A CN 110399137A CN 201910527674 A CN201910527674 A CN 201910527674A CN 110399137 A CN110399137 A CN 110399137A
Authority
CN
China
Prior art keywords
deleted
port numbers
port
load balancing
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910527674.XA
Other languages
Chinese (zh)
Other versions
CN110399137B (en
Inventor
黄桂钦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910527674.XA priority Critical patent/CN110399137B/en
Priority claimed from CN201910527674.XA external-priority patent/CN110399137B/en
Publication of CN110399137A publication Critical patent/CN110399137A/en
Application granted granted Critical
Publication of CN110399137B publication Critical patent/CN110399137B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/62Uninstallation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the present application provides port delet method, device, equipment and the storage medium of a kind of more live load equilibrium applications, is related to field of cloud computer technology, can be applied in PaaS platform.The described method includes: obtaining the port numbers to be deleted in the removal request of port if receiving the port removal request of the LVS load balancing application in more live load equilibrium applications;If the port numbers to be deleted have existed, configuration information corresponding to port numbers to be deleted described in the configuration file that the LVS load balancing is applied is positioned according to port numbers to be deleted, and the configuration information of the port numbers to be deleted is monitored in the configuration file of the Nginx load balancing application in the more live load equilibrium applications of positioning, and configuration information corresponding to the port numbers to be deleted positioned is deleted.The embodiment of the present application improves the speed and efficiency that the port of more live load equilibrium applications is deleted, and has saved time cost and cost of labor.

Description

Port delet method, device, equipment and the storage medium of more live load equilibrium applications
Technical field
This application involves field of cloud computer technology more particularly to a kind of port delet method of more live load equilibriums application, Device, computer equipment and storage medium.
Background technique
Currently, PaaS platform (Platform-as-a-Service, platform service) in the market is equal for more live loads The modification of weighing apparatus application is all the user progress manual amendment for relying on corresponding authority, needs the user modified to have so higher Specialty background knowledge, and be manual modification, modification operation is very cumbersome, it is easy to malfunction.In addition, equal using more live loads During the load balancing service of weighing apparatus application, if some enterprise is not desired to some port applied using more live load equilibriums, It would be possible that needing to delete the port.Under above situation, it is related to the modification applied to more live load equilibriums, i.e., more live loads are equal It deletes the port of weighing apparatus application.
Summary of the invention
The embodiment of the present application provide the port delet method of more live load equilibriums application a kind of, device, computer equipment and Speed and efficiency that the port of more live load equilibrium applications is deleted can be improved in storage medium.
In a first aspect, the embodiment of the present application provides a kind of port delet method of more live load equilibrium applications, comprising:
If receiving the port removal request of the LVS load balancing application in more live load equilibrium applications, the end is obtained Port numbers to be deleted in mouth removal request;Judge whether the port numbers to be deleted have existed;If described to be deleted Port numbers have existed, position institute in the configuration file of LVS load balancing application according to the port numbers to be deleted Configuration information corresponding to port numbers to be deleted is stated, and configuration information corresponding to the port numbers to be deleted is deleted It removes;Positioned according to the port numbers to be deleted monitored in the configuration file of Nginx load balancing application it is described to be deleted Port numbers configuration information, and the configuration information for monitoring the port numbers to be deleted is deleted;It will be deleted Port numbers be updated to database.
Second aspect, the embodiment of the invention provides a kind of ports of more live load equilibrium applications to delete device, this is mostly living It includes for executing the corresponding unit of method described in above-mentioned first aspect that device is deleted in the port of load balancing application.
The third aspect, the embodiment of the invention provides a kind of computer equipment, the computer equipment includes memory, with And the processor being connected with the memory;
The memory is for storing computer program, and the processor is for running the calculating stored in the memory Machine program, to execute method described in above-mentioned first aspect.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage Media storage has computer program, when the computer program is executed by processor, realizes method described in above-mentioned first aspect.
The embodiment of the present application can realize that the port to more live load equilibriums application is deleted, and is arranged after port numbers to be deleted certainly Dynamic realize deletes the port that more live load equilibriums are applied, and improves speed and effect that the port of more live load equilibrium applications is deleted Rate has saved time cost and cost of labor.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the flow diagram of the port delet method of more live load equilibrium applications provided by the embodiments of the present application;
Fig. 2 is the sub-process schematic diagram of the port delet method of more live load equilibrium applications provided by the embodiments of the present application;
Fig. 3 is the sub-process schematic diagram of the port delet method of more live load equilibrium applications provided by the embodiments of the present application;
Fig. 4 is the sub-process schematic diagram of the port delet method of more live load equilibrium applications provided by the embodiments of the present application;
Fig. 5 is the process signal of the port delet method for more live load equilibriums application that another embodiment of the application provides Figure;
Fig. 6 is that the schematic block diagram of device is deleted in the port of more live load equilibrium applications provided by the embodiments of the present application;
Fig. 7 is that the first deletion unit of device is deleted in the port of more live load equilibrium applications provided by the embodiments of the present application Schematic block diagram;
Fig. 8 is that the second deletion unit of device is deleted in the port of more live load equilibrium applications provided by the embodiments of the present application Schematic block diagram;
Fig. 9 is that the schematic frame of device is deleted in the port for more live load equilibriums application that another embodiment of the application provides Figure;
Figure 10 is that the third for more live load equilibriums application that another embodiment of the application provides deletes the schematic frame of unit Figure;
Figure 11 is the schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen Please in embodiment, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall in the protection scope of this application.
Fig. 1 is the flow diagram of the port delet method of more live load equilibrium applications provided by the embodiments of the present application.Such as Shown in Fig. 1, this method includes S101-S106.
S101 obtains institute if receiving the port removal request of the LVS load balancing application in more live load equilibrium applications State the port numbers to be deleted in the removal request of port.
In the present embodiment, it includes that LVS load balancing is answered using with Nginx load balancing which, which applies, With the application of Nginx load balancing can regard the backend application of LVS load balancing application as, to be used to assist LVS load equal Weighing apparatus application.It is to be appreciated that if the LVS load balancing application can be some rear end when LVS load balancing application individualism Using offer load balancing service.In the present embodiment, the application of Nginx load balancing can regard LVS load balancing application as Backend application when individualism, and the backend application of more live load equilibriums application can regard Nginx load balancing application as Backend application when individualism.It should be noted that " can regard as " this statement is intended merely to facilitate and understands more live loads Relationship between LVS load balancing application in equilibrium application and the application of Nginx load balancing.Wherein, more live loads are balanced LVS load balancing application in has multiple LVS containers, the Nginx load balancing application in more live load equilibrium applications There are multiple Nginx containers.Wherein, it should be noted that the backend application of more live load equilibrium applications can be understood as how living negative It carries equilibrium to be served by using corresponding, namely really provides the application of a certain service for user, which answers Load balancing service is provided with for the backend application.
Port includes access port and serve port.Wherein, access port is exposed to user, and user's access is how living negative It is accessed when carrying balanced application by the access port;Serve port refers to the backend application institute of more live load equilibrium applications The port of offer, the port are not exposed to user, i.e. user does not know without the information for knowing the serve port.In this reality It applies in example, the end for the backend application that port deletion, more live load equilibriums including more live load equilibriums application are applied is deleted in port Mouth is deleted.Delete the port of the LVS load balancing application of as more live load equilibriums applications in the port of more live load equilibrium applications It deletes.It, can also since the port deletion of backend application also relates to the modification of the configuration file of more live load equilibriums applications It, in this application also can be in the deletion of the port of backend application to regard related with the port deletion of more live load equilibriums application as The part for being related to more live load equilibrium applications is described.
Wherein, the port removal request of more live load equilibriums application can be triggered by various ways, such as by user's touch or It clicks associated button or image triggers port removal request, such as by calling the setting of some more live load equilibrium application to connect Mouthful, port numbers to be deleted are applied so that LVS load balancing is arranged on setting interface, are set if detecting that user touches or clicks Associated buttons or the images such as completion are set, corresponding port removal request is triggered;Also the voice port that can receive user is deleted Information triggers, if receiving 8080 ends of the LVS load balancing application for deleting some more live load equilibriums application of user The voices such as mouth are to trigger corresponding port removal request.It include the letter of more live load equilibriums applications in the port removal request Breath, such as identification information of more live load equilibriums application;And port numbers to be deleted.Wherein, the mark of more live load equilibrium applications Knowing information can determine specifically for the title of more live load equilibriums application or the number etc. of more live load equilibriums application It is the information of which more live load equilibrium application.Wherein, port numbers to be deleted can be one, be also possible to multiple.
More live load equilibrium applications can be applied to a kind of specific network architecture, and the Routing Protocol in the network architecture needs Will use ospf protocol so that user request be distributed to by the distribution policy of router corresponding to ospf protocol it is different On LVS container, after LVS container reception to user is requested, Nginx is sent by user's request according to LVS load-balancing algorithm and is held On device, after Nginx container reception to user is requested, backend application is sent by user's request according to Nginx load-balancing algorithm, User's request is responded by backend application.It is applied and is applied in the special network architecture due to more live load equilibriums, It is not necessary that for the LVS load balancing application configuration routing iinformation, (LVS load balancing is using the load balancing application for being four layers, i.e. work Make that request is received and forwarded by virtual IP address and port at four layers of network).Meanwhile LVS load balancing is applied and Nginx is negative Equilibrium is carried to apply in the same network, and Nginx load balancing is applied and the backend application of more live load equilibriums application can be with In different networks, in this way, can meet the needs of more scenes, applicability is wide, and applicability is stronger.
S102, judges whether the port numbers to be deleted have existed.
The LVS load balancing preserved in more live load equilibrium applications in the database is believed using corresponding port Breath, then judging whether port numbers to be deleted have existed, comprising: obtain the more live load equilibriums saved in database and answer LVS load balancing in applies corresponding port numbers;The port numbers that will acquire are compared with port numbers to be deleted; If port numbers to be deleted are not present in the port numbers obtained, then it is determined that port numbers to be deleted are not present, otherwise, it determines institute The port numbers to be deleted being arranged have existed.It should be noted that if port numbers to be deleted have it is multiple, as long as then having one A port numbers are not present, then it is determined that port numbers to be deleted are not present;If port numbers to be deleted all exist, then it is determined that The port numbers of deletion have existed.
If the port numbers to be deleted are not present, step S103 is executed;If the port numbers to be deleted have existed, Execute step S104.
S103 is prompted.
S104, according to the port numbers to be deleted position described in the configuration file that the LVS load balancing is applied to Configuration information corresponding to the port numbers of deletion, and configuration information corresponding to the port numbers to be deleted is deleted.
The port numbers to be deleted are searched in the configuration file that LVS load balancing is applied according to port numbers to be deleted, And configuration information corresponding to port numbers to be deleted is positioned, configuration information corresponding to port numbers to be deleted is deleted It removes.Wherein, the configuration file of LVS load balancing application refers to keepalived.conf.
It should be noted that in the embodiment of the present application delete mean so that port numbers to be deleted institute is right The configuration information answered is invalid namely configuration code is invalid.Meanwhile it should be mentioned that making corresponding to port numbers to be deleted The invalid method of configuration information include it is a variety of, if deleted configuration information corresponding to port numbers to be deleted, it is negative to delete rear LVS Carrying in the configuration file of balanced application will be not present configuration information corresponding to port numbers to be deleted;Or by end to be deleted Configuration information corresponding to slogan is annotated, wherein annotation includes that block annotates and go annotation.Wherein, block annotation be will be every Configuration information corresponding to a port numbers to be deleted is annotated as a monolith code, and row annotation is will be each to be deleted Every line code in configuration information corresponding to port numbers all adds annotation.
In one embodiment, as shown in Fig. 2, step S104 includes S1041-S1045.
S1041 determines the configuration file for saving the application of LVS load balancing according to the information of more live load equilibrium applications Host, using the host as the first host.
Due to including how living negative in the port removal request of the LVS load balancing application in more live load equilibriums application The identification information of balanced application is carried, therefore the various of more live load equilibrium applications can be obtained from database by identification information Information determines the host for saving LVS load balancing application configuration file according to the information of more live load equilibriums application, by the place Host is as the first host.The virtual IP address that more live load equilibriums are applied such as is obtained from the information that more live load equilibriums are applied (virtual IP address corresponding to the application of LVS load balancing);It is determined according to virtual IP address and saves the of LVS load balancing application configuration file One host.
S1042, the configuration file that the LVS load balancing is applied are locally downloading from first host.
The configuration file of LVS load balancing application is obtained from identified first host;By acquired configuration text A locally downloading pre-set catalogue of part.It should be noted that acquired configuration file is locally downloading, with It modifies to configuration file, rather than directly remotely modifies on the first host, if allowing for configuration text During part is modified, network is interrupted, then the process rewritten also will appear interruption, that is, excludes the mistake remotely rewritten On the other hand the fortuitous event occurred in journey influence caused by rewriting is matched locally rewriting configuration file ratio in long-range rewriting The speed for setting file is fast;Meanwhile the problems such as being related to safety is easy to during long-range rewriting.
S1043, according to the port numbers to be deleted position described in the configuration file that the LVS load balancing is applied to Configuration information corresponding to the port numbers of deletion.
Search the port numbers to be deleted in the configuration file of LVS load balancing application, and position it is described to Initial row and end row where the port numbers of deletion, will be between the initial row and end row where the port numbers to be deleted Configuration information as configuration information corresponding to the port numbers to be deleted.If should be noted that port to be deleted Number have multiple, can successively position configuration information corresponding to each port numbers to be deleted, and by all port numbers to be deleted Corresponding configuration information is as configuration information corresponding to final port numbers to be deleted.Position a port to be deleted The method of initial row corresponding to number includes: the row where when detection port numbers to be deleted occur for the first time, this is to be deleted Port numbers for the first time when occurring where row as initial row.Position the side of end row corresponding to the port numbers to be deleted If method includes: the initial row for detecting another port numbers, a line before the initial row of another port numbers is determined as end Tail row;Or another bracket of first parenthesis matching of the port numbers to be deleted in pairs is detected, by another bracket institute Row as end row.Preferably, it is positioned using later approach (parenthesis matching is pairs of) corresponding to port numbers to be deleted End row.
S1044 deletes configuration information corresponding to the port numbers to be deleted, to obtain first object configuration File.
The first object configuration file is pushed in first host by S1045.
First object configuration file is pushed in the first host from pre-set catalogue.It will this be updated Configuration file is pushed in the first host.
This embodiment achieves will match corresponding to port numbers to be deleted in the configuration file that LVS load balancing is applied Confidence breath is deleted, wherein and configuration file is locally downloading, configuration file is carried out on the first host without logging on Modification, improves safety, accelerates the speed and efficiency for deleting configuration information corresponding to port numbers to be deleted; And the process deleted carries out automatically, has further speeded up the speed for deleting configuration information corresponding to port numbers to be deleted Degree and efficiency, while having stronger professional knowledge without user, save cost of labor and time cost.
S105 is positioned according to the port numbers to be deleted and is monitored in the configuration file of the Nginx load balancing application The configuration information of the port numbers to be deleted, and the configuration information for monitoring the port numbers to be deleted is deleted It removes.
The configuration file of Nginx load balancing application refers to Nginx.conf.Equally, in the step will monitor described in The configuration information of port numbers to be deleted is deleted also referred to as so that monitoring corresponding to port numbers to be deleted with confidence Breath is invalid.
In one embodiment, as shown in figure 3, step S105 includes the following steps S1051-S1055.
S1051 determines the configuration text for saving the application of Nginx load balancing according to the information of more live load equilibrium applications The host of part, using the host as the second host.
S1052, the configuration file that the Nginx load balancing is applied are locally downloading from second host.
S1053 is positioned according to the port numbers to be deleted and is monitored in the configuration file of the Nginx load balancing application The configuration information of the port numbers to be deleted.
Since the LVS load balancing in more live load equilibriums application is four layers of load balancing.Four-layer load-equalizing passes through Virtual IP address+port numbers receives request, according in request destination address and source address request is forwarded.Therefore, Nginx is negative The port numbers that balanced application needs to monitor the application of LVS load balancing are carried, to receive the request that the application forwarding of LVS load balancing comes. The request received is forwarded again, to be forwarded to rear end container application.Therefore, if more live load equilibriums application in LVS Load balancing application deletes port numbers, needs to delete in the configuration file that Nginx load balancing is applied and monitors LVS load Configuration information corresponding to weighing apparatus application port numbers to be deleted.
Such as Nginx load balancing application configuration file in search port numbers to be deleted, detect find wait delete Whether there is listen field in row corresponding to the port numbers removed, if there is listen field, confidence will be matched corresponding to the row It ceases as the configuration information for monitoring the port numbers to be deleted.Or it is searched in the configuration file of Nginx load balancing application Listen field obtains the port numbers in the row where listen field, if the port numbers in row where listen field with Port numbers matching to be deleted, then by the row where listen field as the configuration information institute for monitoring the port numbers to be deleted Row.The server node for the configuration file that the configuration information as corresponding to listening port number is applied in Nginx load balancing In, specifically, the row where listen field in configuration file in server node.Such as listen 0.0.0.0 8080; Wherein, 8080 be port numbers.
S1054 deletes the configuration information for monitoring the port numbers to be deleted, is matched with forming the second target Set file.
Second target configuration file is pushed in second host by S1055.
Need that important is steps S1051, S1052, S1054, S1055 in this implementation corresponding with Fig. 2 embodiment It is similar, the description in Fig. 2 embodiment is specifically please referred to, details are not described herein.
The port numbers deleted are updated to database by S106.
The information for deleting deleted port numbers in the database, such as port numbers, the erasing time etc. deleted.
In one embodiment, the method also includes S107.
S107 restarts more live load balancing services of more live load equilibrium applications, so that LVS load balancing application Configuration file and the modification of configuration file of Nginx load balancing application come into force.
More live load balancing services as described in can be restarted by instruction of restarting.It should be noted that LVS load balancing is answered Configuration file and the configuration file of Nginx load balancing application are maintained in the book on corresponding host, wherein The configuration file of LVS load balancing application is the shared configuration file of all LVS containers, the configuration of Nginx load balancing application File is the shared configuration file of all Nginx containers, only restarted more live load equilibriums applications load balancing service it Afterwards, LVS container just can obtain modified configuration file into LVS container in corresponding data volume automatically, and Nginx container is Modified configuration file can be obtained automatically into Nginx container in corresponding data volume.
The port that more live load equilibrium applications are realized in above method embodiment is deleted, so can be according to the need of enterprise It asks and deletes port, provide flexible service for enterprise, meet the demand of enterprise;Configuration file is locally downloading, without stepping on It modifies on land to host to configuration file, improves safety, accelerating will match corresponding to port numbers to be deleted Confidence ceases the speed and efficiency deleted;And the process that the port of more live load equilibrium applications is deleted executes automatically, improves The speed and efficiency that the port of more live load equilibriums applications is deleted;Due to being to execute automatically, there is no need to professionals to log in It is operated on to corresponding host, reduces cost of labor and time cost, also reduce the probability that error is deleted in port.
In one embodiment, as shown in figure 4, the port delet method of more live load equilibrium applications further includes S201- S205.It should be noted that the description for not having the part being described in detail to please refer to Fig. 1 embodiment in step in the present embodiment, Details are not described herein.
S201 obtains the port and deletes if receiving the port removal request of the backend application of more live load equilibrium applications The port numbers deleted except the need in request.
S202, judges whether the port numbers that need to be deleted have existed.
If the port numbers that need to be deleted are not present, step S203 is executed;If the port numbers that need to be deleted have existed, Execute step S204.
S203 is prompted.
S204 is positioned described in the configuration file that the Nginx load balancing is applied according to the port numbers that need to be deleted Configuration information corresponding to the port numbers that need to be deleted, and configuration information corresponding to the port numbers that need to be deleted is deleted It removes.
In more live load equilibrium applications, including LVS load balancing is applied and the application of Nginx load balancing, for side Just understand, the backend application that the application of Nginx load balancing can be regarded as the application of LVS load balancing, and more live load equilibriums are answered Backend application can regard the backend application of Nginx load balancing application as.In this way, if what more live load equilibriums were applied Backend application deletes port, it is only necessary to modify the configuration file of the Nginx load balancing application in more live load equilibrium applications .
In one embodiment, as shown in figure 5, step S204 includes the following steps S2041-S2044.
S2041 determines the configuration text for saving the application of Nginx load balancing according to the information of more live load equilibrium applications The host of part, using the host as the second host.
S2042, the configuration file that the Nginx load balancing is applied are locally downloading from second host.
S2043 is positioned described in the configuration file that the Nginx load balancing is applied according to the port numbers that need to be deleted Configuration information corresponding to the port numbers that need to be deleted.
The port that need to be deleted such as is positioned in the configuration file that Nginx load balancing is applied according to the port numbers that need to be deleted Number, using configuration information corresponding to upstream node corresponding to the port numbers that need to be deleted as the port numbers institute that need to be deleted Corresponding first configuration information;Or the upstream node in the configuration file of positioning Nginx load balancing application, if it exists Port numbers in upstream node are matched with the port numbers that need to be deleted, then are made code segment corresponding to the upstream node For the first configuration information corresponding to the port numbers that need to delete.Wherein, upstream node is matching for Nginx load balancing application It sets under the http node in file, including the container instance IP and port information of backend application in upstream node, and Health examination parameter information of container instance etc..The upstream title in the first configuration information is obtained, in Nginx load balancing Positioned in proxy_pass parameter and the proxy_pass parameter value in the configuration file of application includes that upstream title institute is right The location code segment answered, using the location code end positioned as the second configuration corresponding to the port numbers that need to be deleted Information.Location node is location node under the server node in the configuration file of Nginx load balancing application In include request backend application the information such as path setting, to be forwarded for agent data.Match confidence for positioned first Breath and the second configuration information are as configuration information corresponding to the port numbers that need to be deleted.
As in one embodiment, upstream node may include the following contents:
Wherein, appid is upstream title;Sticky indicates that session is kept, it is a kind of Nginx based on cookie Load Balancing Solution;Server 192.168.1.101:8080 indicates the letter of real server (real server) Breath, i.e. the container instance IP and port numbers of backend application, wherein 192.168.1.101 indicates the container instance IP of backend application, 8080 indicate the port numbers that need to be deleted;Check interval=5000 rise=2 fall=3 timeout=1000, table Show and all real server in upstream are detected, every five seconds checks that once, request 2 is subnormal, marks real Server is that up (available mode) is otherwise down (down state), and time-out time is 1 second.
It should be noted that in the first configuration information corresponding to the port numbers that above-mentioned positioning need to delete, one Upstream node only corresponds to the container instance content of backend application corresponding to a port.In some embodiments, if It include the container instance content of backend application corresponding to all of the port in upstream node (corresponding to server field Content), then the container for only needing to position backend application corresponding to port numbers to be deleted in the upstream node is real The content of example, regardless of the container instance of backend application corresponding to other port numbers.
In one embodiment, the location node for agent data forwarding may include the following contents:
This section of location node section is related to agent data and forwards relevant information, and proxy_set_header parameter is used In modification http header header information, such as insertion X-Forwarded-For parameter etc..It should be noted that proxy_ Http in pass parameter: // subsequent upstream title (http: //+upstream title) must be with upstream node In upstream title it is consistent.
It should be noted that location node content and upstream node content are intended merely to illustrate, for side Just understand and illustrate, do not constitute the limitation to this, in other embodiments, including other contents or institute can also be less than The content enumerated.
S2044 deletes configuration information corresponding to the port numbers that need to be deleted, to form the configuration of third target File.
The third target configuration file is pushed in second host by S2045.
It should be noted that S2041, S2042, S2044, S2045 step corresponding with Fig. 2 embodiment in this implementation It is similar, the description in Fig. 2 embodiment is specifically please referred to, details are not described herein.
S205, the port numbers that backend application is deleted are updated to database.
In one embodiment, the method also includes:
S206 restarts more live load balancing services of more live load equilibrium applications, so that LVS load balancing application Configuration file and the modification of configuration file of Nginx load balancing application come into force.
The port that the embodiment is related to the backend application of more live load equilibrium applications is deleted, and service interface is so realized Diversity;And the process that the port of the backend application of more live load equilibrium applications is deleted executes automatically, improves how living negative Carry speed and efficiency that the port of the backend application of balanced application is deleted;Due to being to execute automatically, there is no need to professionals to step on It is operated on land to corresponding container, reduces cost of labor and time cost, the port for also reducing backend application is deleted out Wrong probability.
It should be noted that in above method embodiment, the configuration of the LVS load balancing application of more live load equilibrium applications File and the configuration file of Nginx load balancing application may be on the same hosts, then the first host and the second place Host refers to identical host.If the configuration file and Nginx of the LVS load balancing application of more live load equilibrium applications are negative The configuration file of balanced application is carried not on the same host, then the first host and the second host refer to it is different Host.
Fig. 6 is that the schematic block diagram of device is deleted in the port of more live load equilibrium applications provided by the embodiments of the present application.It should Device includes for executing unit corresponding to the port delet method of more live load equilibrium applications described in above-mentioned Fig. 1.Such as Fig. 6 It is shown, the port of more live load equilibriums application delete device 100 include first acquisition unit 101, there are judging unit 102, Prompt unit 103, first deletes unit 104, second and deletes unit 105, data updating unit 106.
First acquisition unit 101, if the port for receiving the LVS load balancing application in more live load equilibrium applications Removal request obtains the port numbers to be deleted in the port removal request.
There are judging units 102, for judging whether the port numbers to be deleted have existed.
Prompt unit 103 is prompted if being not present for the port numbers to be deleted.
First deletes unit 104, if having existed for the port numbers to be deleted, according to the port to be deleted Configuration information corresponding to port numbers to be deleted described in the configuration file of number positioning LVS load balancing application, and will Configuration information corresponding to the port numbers to be deleted is deleted.
In one embodiment, as shown in fig. 7, the first deletion unit 104 includes the first host determination unit 1041, first Download unit 1042, the first positioning unit 1043, first delete unit 1044, the first push unit 1045.Wherein, the first host Machine determination unit 1041 saves matching for LVS load balancing application for determining according to the information of more live load equilibrium applications The host for setting file, using the host as the first host.First download unit 1042, for loading the LVS The configuration file of equilibrium application is locally downloading from first host.First positioning unit 1043, for according to Port numbers to be deleted position matches corresponding to port numbers to be deleted described in the configuration file of the LVS load balancing application Confidence breath.First deletes unit 1044, for configuration information corresponding to the port numbers to be deleted to be deleted, with To first object configuration file.First push unit 1045, for the first object configuration file to be pushed to described first In host.
Second deletes unit 105, for positioning the Nginx load balancing application according to the port numbers to be deleted The configuration information of the port numbers to be deleted is monitored in configuration file, and monitors matching for the port numbers to be deleted for described Confidence breath is deleted.
In one embodiment, as shown in figure 8, second deletes unit 105, including the second host determination unit 1051, the Two download units 1052, the second positioning unit 1053, second delete unit 1054, the second push unit 1055.Wherein, the second place Host determination unit 1051 saves the application of Nginx load balancing for determining according to the information of more live load equilibrium applications Configuration file host, using the host as the second host.Second download unit 1052, being used for will be described The configuration file of Nginx load balancing application is locally downloading from second host.Second positioning unit 1053, is used for It is positioned according to the port numbers to be deleted in the configuration file of the Nginx load balancing application and monitors the end to be deleted The configuration information of slogan.Second deletes unit 1054, for by the configuration information for monitoring the port numbers to be deleted into Row is deleted, to form the second target configuration file.Second push unit 1055, for pushing second target configuration file Into second host.
Data updating unit 106, for the port numbers deleted to be updated to database.
In one embodiment, it further includes restarting unit 107 that device is deleted in the port of more live load equilibrium applications.Restart Unit 107, for restarting more live load balancing services of more live load equilibrium applications, so that LVS load balancing application Configuration file and the modification of configuration file of Nginx load balancing application come into force.
Fig. 9 is that the schematic frame of device is deleted in the port for more live load equilibriums application that another embodiment of the application provides Figure.As shown in figure 9, the port of more live load equilibrium applications deletes device 200 and includes first acquisition unit 201, there is judgement Unit 202, prompt unit 203, first delete unit 204, second and delete unit 205, the acquisition of data updating unit 206, second Unit 207, third delete unit 208.Wherein, first acquisition unit 201, there are judging units 202, prompt unit 203, first Delete the deletion of unit 204, second unit 205, data updating unit 206 please refers to the first acquisition unit in Fig. 6 embodiment 101, unit 104, second is deleted there are judging unit 102, prompt unit 103, first delete unit 105, data updating unit 106 description.In addition, the difference of the embodiment and embodiment shown in fig. 6 also resides in:
The second acquisition unit 207, if the port of the backend application for receiving more live load equilibrium applications is deleted Request obtains the port numbers that the need in the port removal request are deleted.
It is described there are judging unit 202, be also used to judge whether the port numbers that need to be deleted have existed.
The prompt unit 203 is not present if being also used to the port numbers that need to be deleted, is prompted.
Third deletes unit 208, if having existed for the port numbers that need to be deleted, according to the port that need to be deleted Configuration information corresponding to the port numbers deleted is needed described in the configuration file of number positioning Nginx load balancing application, and Configuration information corresponding to the port numbers that need to be deleted is deleted.
In one embodiment, as shown in Figure 10, it includes third host determination unit 2081, that third, which deletes unit 208, Three download units 2082, third positioning unit 2083, third delete unit 2084, third push unit 2085.Wherein, third place Host determination unit 2081 saves the application of Nginx load balancing for determining according to the information of more live load equilibrium applications Configuration file host, using the host as the second host.Third download unit 2082, being used for will be described The configuration file of Nginx load balancing application is locally downloading from second host.Third positioning unit 2083, is used for The port numbers for needing to delete described in the configuration file that the Nginx load balancing is applied are positioned according to the port numbers that need to be deleted Corresponding configuration information.Third delete unit 2084, for by configuration information corresponding to the port numbers that need to be deleted into Row is deleted, to form third target configuration file.Third push unit 2085, for pushing the third target configuration file Into second host.
Data updating unit 206, the port numbers for being also used to be deleted backend application are updated to database.
In one embodiment, it further includes restarting unit 209 that device 200 is deleted in the port of more live load equilibrium applications. Unit 209 is restarted, for restarting more live load balancing services of more live load equilibrium applications, so that LVS load balancing The modification of the configuration file of configuration file and Nginx the load balancing application of application comes into force.
It should be noted that it is apparent to those skilled in the art that, the tool of above-mentioned apparatus and each unit Body realizes process, can be no longer superfluous herein with reference to the corresponding description in preceding method embodiment, for convenience of description and succinctly It states.
Above-mentioned apparatus can be implemented as a kind of form of computer program, and computer program can be in meter as shown in figure 11 It calculates and is run on machine equipment.
Figure 11 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.The equipment is that terminal etc. is set It is standby, such as the server in PaaS platform.The equipment 100 includes processor 102, the memory connected by system bus 101 With network interface 103, wherein memory may include non-volatile memory medium 104 and built-in storage 105.
The non-volatile memory medium 104 can storage program area 1041 and computer program 1042.This is non-volatile to deposit It is when the computer program 1042 stored in storage media is executed by processor 102, it can be achieved that mostly living described in above-mentioned server The port delet method of load balancing application.The processor 102 supports whole equipment 100 for providing calculating and control ability Operation.The built-in storage 105 provides environment for the operation of the computer program in non-volatile memory medium, the computer journey When sequence is executed by processor 102, processor 102 may make to execute the end of more live load equilibrium applications described in above-mentioned server Mouth delet method.The network interface 103 is for carrying out network communication.It will be understood by those skilled in the art that being tied shown in figure Structure, the only block diagram of part-structure relevant to application scheme are not constituted and are applied thereon to application scheme The restriction of equipment, specific equipment may include than more or fewer components as shown in the figure, perhaps combine certain components or With different component layouts.
Wherein, the processor 102 is above-mentioned how living negative to realize for running computer program stored in memory Carry any embodiment of the port delet method of balanced application.
It should be appreciated that in the embodiment of the present application, alleged processor 102 can be central processing unit (Central Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (application program lication Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other can Programmed logic device, discrete gate or transistor logic, discrete hardware components etc..General processor can be microprocessor Or the processor is also possible to any conventional processor etc..
Those of ordinary skill in the art will appreciate that be realize above-described embodiment method in all or part of the process, It is that relevant hardware can be instructed to complete by computer program.The computer program can be stored in a storage medium, The storage medium can be computer readable storage medium.The computer program is by the processing of at least one of the computer system Device executes, to realize the process step of the embodiment of the above method.
Therefore, present invention also provides a kind of storage mediums.The storage medium can be computer readable storage medium, should Computer readable storage medium includes non-volatile computer readable storage medium storing program for executing.The storage medium is stored with computer program, The computer program realizes any implementation of the port delet method of above-mentioned more live load equilibrium applications when being executed by a processor Example.
The storage medium can be USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk Or the various computer readable storage mediums that can store program code such as CD.
In several embodiments provided herein, it should be understood that disclosed device, device and method, it can be with It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, the division of the unit, Only a kind of logical function partition, there may be another division manner in actual implementation.Those skilled in the art can be with It is well understood, for convenience of description and succinctly, the specific work process of the device of foregoing description, equipment and unit can With with reference to the corresponding process in preceding method embodiment, details are not described herein.The above, the only specific embodiment party of the application Formula, but the protection scope of the application is not limited thereto, and anyone skilled in the art discloses in the application In technical scope, various equivalent modifications or substitutions can be readily occurred in, these modifications or substitutions should all cover the guarantor in the application Within the scope of shield.Therefore, the protection scope of the application should be subject to the protection scope in claims.

Claims (10)

1. a kind of port delet method of more live load equilibriums application, which is characterized in that more live load equilibriums apply including LVS load balancing is applied and the application of Nginx load balancing, which comprises
If receiving the port removal request of the LVS load balancing application in more live load equilibrium applications, obtains the port and delete Except the port numbers to be deleted in request;
Judge whether the port numbers to be deleted have existed;
If the port numbers to be deleted have existed, the LVS load balancing is positioned according to the port numbers to be deleted and is answered Configuration information corresponding to port numbers to be deleted described in configuration file, and will be corresponding to the port numbers to be deleted Configuration information deleted;
Positioned according to the port numbers to be deleted monitored in the configuration file of Nginx load balancing application it is described to be deleted Port numbers configuration information, and the configuration information for monitoring the port numbers to be deleted is deleted;
The port numbers deleted are updated to database.
2. the method according to claim 1, wherein described according to the port numbers positioning to be deleted Configuration information corresponding to port numbers to be deleted described in the configuration file of LVS load balancing application, and will be described to be deleted Port numbers corresponding to configuration information deleted, comprising:
The host for saving the configuration file of LVS load balancing application is determined according to the information of more live load equilibrium applications, Using the host as the first host;
The configuration file that the LVS load balancing is applied is locally downloading from first host;
Port to be deleted described in the configuration file that the LVS load balancing is applied is positioned according to the port numbers to be deleted Configuration information corresponding to number;
Configuration information corresponding to the port numbers to be deleted is deleted, to obtain first object configuration file;
The first object configuration file is pushed in first host.
3. according to the method described in claim 2, it is characterized in that, described according to the port numbers positioning to be deleted Configuration information corresponding to port numbers to be deleted described in the configuration file of LVS load balancing application, comprising:
The port numbers to be deleted are searched in the configuration file of LVS load balancing application, and are positioned described to be deleted Port numbers where initial row and end row, by matching between the initial row and end row where the port numbers to be deleted Confidence is ceased as configuration information corresponding to the port numbers to be deleted.
4. the method according to claim 1, wherein described according to the port numbers positioning to be deleted Monitor the configuration informations of the port numbers to be deleted in the configuration file of Nginx load balancing application, and by the monitoring institute The configuration information for stating port numbers to be deleted is deleted, comprising:
The host for saving the configuration file of Nginx load balancing application is determined according to the information of more live load equilibrium applications Machine, using the host as the second host;
The configuration file that the Nginx load balancing is applied is locally downloading from second host;
Positioned according to the port numbers to be deleted monitored in the configuration file of Nginx load balancing application it is described to be deleted Port numbers configuration information;
The configuration information for monitoring the port numbers to be deleted is deleted, to form the second target configuration file;
Second target configuration file is pushed in second host.
5. the method according to claim 1, wherein the method also includes:
If receiving the port removal request of the backend application of more live load equilibrium applications, obtain in the port removal request The port numbers that need to be deleted;
Judge whether the port numbers that need to be deleted have existed;
If the port numbers that need to be deleted have existed, the Nginx load balancing is positioned according to the port numbers that need to be deleted Configuration information corresponding to the port numbers deleted is needed described in the configuration file of application, and the port numbers institute that need to be deleted is right The configuration information answered is deleted;
The port numbers that backend application is deleted are updated to database.
6. according to the method described in claim 5, it is characterized in that, described according to the port numbers positioning that need to be deleted Configuration information corresponding to the port numbers deleted is needed described in the configuration file of Nginx load balancing application, and need to be deleted described Configuration information corresponding to the port numbers removed is deleted, comprising:
The host for saving the configuration file of Nginx load balancing application is determined according to the information of more live load equilibrium applications Machine, using the host as the second host;
The configuration file that the Nginx load balancing is applied is locally downloading from second host;
The end for needing to delete described in the configuration file that the Nginx load balancing is applied is positioned according to the port numbers that need to be deleted Configuration information corresponding to slogan;
Configuration information corresponding to the port numbers that need to be deleted is deleted, to form third target configuration file;
The third target configuration file is pushed in second host.
7. method according to claim 1 or 5, which is characterized in that the method also includes:
More live load balancing services of more live load equilibrium applications are restarted, so that the configuration text of LVS load balancing application The modification of part and the configuration file of Nginx load balancing application comes into force.
8. device is deleted in a kind of port of more live load equilibrium applications, which is characterized in that the end of more live load equilibrium applications Mouth deletes device
First acquisition unit is asked if the port for receiving the LVS load balancing application in more live load equilibrium applications is deleted It asks, obtains the port numbers to be deleted in the port removal request;
There are judging units, for judging whether the port numbers to be deleted have existed;
First deletes unit, if having existed for the port numbers to be deleted, is positioned according to the port numbers to be deleted Configuration information corresponding to port numbers to be deleted described in the configuration file of LVS load balancing application, and will it is described to Configuration information corresponding to the port numbers of deletion is deleted;
Second deletes unit, for positioning the configuration text of the Nginx load balancing application according to the port numbers to be deleted Monitor the configuration information of the port numbers to be deleted in part, and by the configuration information for monitoring the port numbers to be deleted It is deleted;
Data updating unit, for the port numbers deleted to be updated to database.
9. a kind of computer equipment, which is characterized in that the computer equipment includes memory, and is connected with the memory Processor;
The memory is for storing computer program;The processor is for running the computer journey stored in the memory Sequence, to execute the method according to claim 1 to 7.
10. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer journey Sequence when the computer program is executed by processor, realizes the method according to claim 1 to 7.
CN201910527674.XA 2019-06-18 Port deletion method, device, equipment and storage medium for multi-live load balancing application Active CN110399137B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910527674.XA CN110399137B (en) 2019-06-18 Port deletion method, device, equipment and storage medium for multi-live load balancing application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910527674.XA CN110399137B (en) 2019-06-18 Port deletion method, device, equipment and storage medium for multi-live load balancing application

Publications (2)

Publication Number Publication Date
CN110399137A true CN110399137A (en) 2019-11-01
CN110399137B CN110399137B (en) 2024-05-31

Family

ID=

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988423A (en) * 2020-08-31 2020-11-24 浪潮云信息技术股份公司 Nginx-based network four-layer and seven-layer load balancing method and system
CN112988373A (en) * 2019-12-16 2021-06-18 上海亲平信息科技股份有限公司 Service load balancing system for server optimization and balancing method thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023942A (en) * 2011-09-27 2013-04-03 奇智软件(北京)有限公司 Load balancing method, device and system of server
CN107579923A (en) * 2017-09-18 2018-01-12 迈普通信技术股份有限公司 The balancing link load method and SDN controllers of a kind of SDN
CN108920157A (en) * 2018-06-13 2018-11-30 平安科技(深圳)有限公司 Installation method, device, computer equipment and the storage medium of Nginx software
CN109451065A (en) * 2018-12-26 2019-03-08 中电福富信息科技有限公司 A kind of soft load balancing shunts automated system and its operation method
CN109660466A (en) * 2019-02-26 2019-04-19 浪潮软件集团有限公司 A kind of more live load balance realizing methods towards cloud data center tenant
CN109753514A (en) * 2018-12-13 2019-05-14 平安普惠企业管理有限公司 Load balancer selection method, device, computer equipment and storage medium
CN109873776A (en) * 2019-01-30 2019-06-11 新华三技术有限公司 A kind of equalization methods and device of multicast message load balancing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023942A (en) * 2011-09-27 2013-04-03 奇智软件(北京)有限公司 Load balancing method, device and system of server
CN107579923A (en) * 2017-09-18 2018-01-12 迈普通信技术股份有限公司 The balancing link load method and SDN controllers of a kind of SDN
CN108920157A (en) * 2018-06-13 2018-11-30 平安科技(深圳)有限公司 Installation method, device, computer equipment and the storage medium of Nginx software
CN109753514A (en) * 2018-12-13 2019-05-14 平安普惠企业管理有限公司 Load balancer selection method, device, computer equipment and storage medium
CN109451065A (en) * 2018-12-26 2019-03-08 中电福富信息科技有限公司 A kind of soft load balancing shunts automated system and its operation method
CN109873776A (en) * 2019-01-30 2019-06-11 新华三技术有限公司 A kind of equalization methods and device of multicast message load balancing
CN109660466A (en) * 2019-02-26 2019-04-19 浪潮软件集团有限公司 A kind of more live load balance realizing methods towards cloud data center tenant

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
乔梁;许竹霞;孙林花;孔小怡;乔雅敏;: "基于负载均衡的数据库集群对气象数据的共享服务", 干旱气象, no. 03 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112988373A (en) * 2019-12-16 2021-06-18 上海亲平信息科技股份有限公司 Service load balancing system for server optimization and balancing method thereof
CN111988423A (en) * 2020-08-31 2020-11-24 浪潮云信息技术股份公司 Nginx-based network four-layer and seven-layer load balancing method and system

Similar Documents

Publication Publication Date Title
JP6091724B2 (en) Link health check method and apparatus
US11870673B2 (en) Intercepting and examining a packet header or trailer
US11442836B2 (en) Method and system for real-time correlation of disparate sources of topological information to create a unified topological model of a distributed information system
CN106936793B (en) Information interception processing method and terminal
CN107948284A (en) A kind of service inserting method, equipment and system based on micro services framework
CN110601922B (en) Method and device for realizing comparison experiment, electronic equipment and storage medium
CN109586969B (en) Content distribution network disaster tolerance method and device, computer equipment and storage medium
CN112256495A (en) Data transmission method and device, computer equipment and storage medium
CN109587258B (en) Service activity detection method and device
JP4190455B2 (en) Load balancing apparatus and program
JP2017538987A5 (en)
CN110266761B (en) Load balancing application creation method and device, computer equipment and storage medium
CN111953770B (en) Route forwarding method and device, route equipment and readable storage medium
CN111277586A (en) Method and device for adjusting firewall security policy
CN111858083A (en) Remote service calling method and device, electronic equipment and storage medium
CN110225094A (en) Load balancing application virtual IP address switching method, device, computer equipment and storage medium
CN110262872A (en) Load balancing application management method, device, computer equipment and storage medium
CN116431282A (en) Cloud virtual host server management method, device, equipment and storage medium
CN113630464B (en) Distributed speech processing method, system, device and storage medium
CN109842518B (en) Content distribution network disaster tolerance method and device, computer equipment and storage medium
CN110399137A (en) Port delet method, device, equipment and the storage medium of more live load equilibrium applications
CN110417921A (en) A kind of method and load balancing service device of load balancing
CN105897865A (en) Protocol-independent network file service management system and method
CN108900482A (en) Execution method, server management system and the storage medium of script
CN110399137B (en) Port deletion method, device, equipment and storage medium for multi-live load balancing application

Legal Events

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