Intranet Load Balancing Scheduling Method, Device, Storage Medium and Computer Equipment

Through the intranet load balancing scheduling method, standardize the configuration file format and unify the intranet service scheduling, the problems of single load balancing equipment and unstable scheduling are solved, efficient service scheduling and failover are achieved, and frequent failures are reduced.

CN116016534BActive Publication Date: 2025-07-11GUANGZHOU FENGWANG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211689238.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2025-07-11
Estimated Expiration
2042-12-27

AI Technical Summary

Technical Problem

In the prior art, the load balancing equipment in the company's network environment has a single function, and the scheduling methods between each back-end server are not unified, resulting in unstable service scheduling, the service scheduling link becomes longer when the internal and external network environment is isolated, and the request fails when the service is unavailable, and failures occur frequently.

Method used

The intranet load balancing scheduling method is adopted. By detecting the configuration text uploaded by the backend server, the instance parameters are extracted and converted into an instance configuration file that can be recognized by the nginx server, synchronized to the nginx server in the load balancing cluster, generating a business scheduling instance, and parsing the domain name to obtain scheduling information, obtaining and allocating the target service from the target server to the nginx server based on the scheduling information.

Benefits of technology

It realizes the unified and efficient intranet service scheduling, avoids request failure in a single point of failure, improves service scheduling efficiency, and reduces the occurrence of failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016534B_ABST
    Figure CN116016534B_ABST
Patent Text Reader

Abstract

The internal network load balancing scheduling method, device, storage medium and computer equipment provided by this application can, when detecting that any backend server in the internal network receives a configuration text, extract the instance parameters in the configuration text and convert them into an instance configuration file, so as to standardize the format of the instance configuration file and avoid the file being unable to be loaded due to syntax or format errors in the configuration text. Then, the instance configuration file can be synchronized to each nginx server, so that each server can load the instance configuration file to generate a service scheduling instance. Then, by parsing each domain name in the service scheduling instance, the corresponding scheduling information can be obtained, and according to each scheduling information, the corresponding target service can be obtained from the target server and allocated to each server in turn. Through each server, the target service is sent to the request server. Through this scheduling method, the service call method in the internal network can be unified, thereby improving the service scheduling efficiency and reducing the generation of call failures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and in particular, to an intranet load balancing scheduling method, device, storage medium, and computer device. Background Art

[0002] With the continuous development of the company's business and public cloud technologies, the company has migrated some key services to public clouds, different cloud providers, and different data center computer rooms, forming a hybrid cloud scenario with multiple computer rooms and multiple clouds. Moreover, more and more company website applications are launched, and the interface calls between various applications have changed from the original single-computer-room call mode to calls between multiple computer rooms and multiple clouds.

[0003] Currently, the business call mode adopted by the company's network environment still has problems such as a single function of the load balancing device and inconsistent scheduling methods between each backend server, resulting in instability during internal business scheduling. For example, when there is an isolation between the internal and external network environments in the company's network, the service needs to be forwarded through the public network during internal scheduling, resulting in a longer service scheduling link and reduced service scheduling efficiency. If only a single-node intranet RIP is used for scheduling, requests will fail and fault transfer cannot be performed when the service is unavailable, resulting in frequent faults in service scheduling. Summary of the Invention

[0004] The purpose of this application aims to solve at least one of the above technical defects, especially the technical defect that the business call mode in the prior art has a single function of the load balancing device and inconsistent scheduling methods between each backend server, resulting in frequent faults in service scheduling.

[0005] This application provides an intranet load balancing scheduling method, and the method includes:

[0006] When it is detected that any one of the backend servers in the intranet receives a configuration text uploaded by a user, use this backend server as the request server, extract the instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the nginx server;

[0007] Synchronize the instance configuration file to each nginx server in the load balancing cluster, and trigger each nginx server to load the instance configuration file to generate a corresponding service scheduling instance;

[0008] Obtain all domain names of the service scheduling instances generated by any one nginx server, resolve each domain name to obtain the IP addresses of each domain name and the scheduling information corresponding to the IP addresses, where the scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server;

[0009] According to the service identifier of the target service in each scheduling information and the machine identifier of the target server to be scheduled, obtain the corresponding target service from the corresponding target server, and sequentially allocate the obtained multiple target services and the machine identifier of the request server to each nginx server in the load balancing cluster, and send the corresponding target service to the request server through each nginx server.

[0010] Optionally, the extracting the instance parameters of the configuration text includes:

[0011] Parse the configuration information of the configuration text according to a preset keyword list to determine each keyword field in the configuration information and the parameter position corresponding to each keyword field;

[0012] Based on each parameter position, cut the configuration information to obtain each parameter in the configuration text and form instance parameters.

[0013] Optionally, the converting the instance parameters into an instance configuration file recognizable by the nginx server includes:

[0014] According to a preset keyword list, write each parameter in the instance parameters into the corresponding database table in the database, and the database table is a form with each keyword field in the preset keyword list as the table header;

[0015] Output each parameter in the instance parameters of the database table in a data conversion format through an interface to obtain a data conversion file, and convert the data conversion file into an instance configuration file recognizable by the nginx server.

[0016] Optionally, the converting the data conversion file into an instance configuration file recognizable by the nginx server includes:

[0017] Obtain a custom template, where the custom template is a configuration file containing multiple variables, and any variable defines a parameter corresponding to the variable;

[0018] According to the correspondence between the variable and the parameter, write each parameter in the data conversion file into the custom template to generate an instance configuration file recognizable by the nginx server.

[0019] Optionally, the synchronizing the instance configuration file to each nginx server in the load balancing cluster includes:

[0020] Establish an encrypted connection with each nginx server in the load balancing cluster through the SSH protocol to generate an SSH key;

[0021] Log in to the corresponding nginx server using each SSH key, and copy the instance configuration file to the corresponding nginx server in the load balancing cluster.

[0022] Optionally, triggering each nginx server to load the instance configuration file to generate a corresponding service scheduling instance includes:

[0023] Perform syntax detection on the instance configuration file in each nginx server based on nginx syntax;

[0024] If the detection is successful, make the instance configuration file take effect through the nginx server to generate a corresponding service scheduling instance;

[0025] If the detection fails, roll back the process of the corresponding nginx server and return to the running state before the instance configuration file is synchronized.

[0026] Optionally, the method further includes:

[0027] During the intranet load balancing scheduling process, if any nginx server instance configuration file synchronization fails or taking effect fails, roll back the process of the nginx server and return to the running state before the instance configuration file is synchronized.

[0028] The present application also provides an intranet load balancing scheduling device, including:

[0029] A data acquisition module, configured to, when detecting that any backend server in the intranet receives a configuration text uploaded by a user, use the backend server as a request server, extract instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the nginx server;

[0030] A file synchronization module, configured to synchronize the instance configuration file to each nginx server in the load balancing cluster, and trigger each nginx server to load the instance configuration file to generate a corresponding service scheduling instance;

[0031] A domain name resolution module, configured to obtain all domain names of the service scheduling instances generated by any nginx server, resolve each domain name to obtain the IP addresses of each domain name and the scheduling information corresponding to the IP addresses, where the scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server;

[0032] The service scheduling module is used to obtain the corresponding target service from the corresponding target server according to the service identifier of the target service in each scheduling information and the machine identifier of the target server to be scheduled, and sequentially allocate the obtained multiple target services and the machine identifier of the request server to each nginx server in the load balancing cluster, and send the corresponding target service to the request server through each nginx server.

[0033] The present application also provides a storage medium in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the intranet load balancing scheduling method as described in any one of the above embodiments.

[0034] The present application also provides a computer device, including: one or more processors, and a memory;

[0035] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the intranet load balancing scheduling method as described in any one of the above embodiments are executed.

[0036] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0037] The internal network load balancing scheduling method, device, storage medium and computer device provided by this application, when performing load balancing scheduling in the internal network, if it is detected that any one of the backend servers in the internal network receives the configuration text uploaded by the user, then this backend server is used as the request server, and the instance parameters included in the configuration text are extracted, so as to convert the instance parameters into an instance configuration file recognizable by the nginx server. This can standardize the format of the instance configuration file, avoid problems such as non-standard string writing format or syntax errors in the configuration text affecting the loading of the instance configuration file by the server, and at the same time simplify the configuration process. Then, the instance configuration file can be synchronized to each nginx server in the load balancing cluster to trigger each nginx server to load the instance configuration file and generate a service scheduling instance. Then, the scheduling information can be obtained by parsing each domain name in the service scheduling instance. The scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server, so as to obtain the corresponding target service from the corresponding target server according to each scheduling information, and sequentially allocate the obtained multiple target services and the machine identifier of the request server to each nginx server in the load balancing cluster. Each nginx server sends the corresponding target service to the request server respectively. Through this scheduling method, the call methods of each service inside the internal network can be unified, and at the same time, the problems of single point of load balancing target service and inability to perform failover when a failure occurs can be solved, thereby improving the service scheduling efficiency and reducing the generation of failures during calls. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to these drawings.

[0039] Figure 1 It is a schematic flowchart of an internal network load balancing scheduling method provided by an embodiment of the present application;

[0040] Figure 2 It is a schematic structural diagram of an internal network load balancing architecture provided by an embodiment of the present application;

[0041] Figure 3 It is a schematic flowchart of the synchronization process of the instance configuration file in the nginx server provided by an embodiment of the present application;

[0042] Figure 4 It is a schematic structural diagram of an internal network load balancing scheduling device provided by an embodiment of the present application;

[0043] Figure 5 This is a schematic internal structure diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0045] With the continuous development of the company's business and public cloud technology, the company has migrated some key businesses to public clouds, different cloud providers, and different data center computer rooms, forming a hybrid cloud scenario with multiple computer rooms and multiple clouds. Moreover, more and more company website applications are launched, and the interface calls between various applications have changed from the original single-computer-room internal call method to calls between multiple computer rooms and multiple clouds.

[0046] Currently, the business call method adopted by the company's network environment still has problems such as a single function of the load balancing device and inconsistent scheduling methods between each backend server, resulting in instability during internal business scheduling. For example, when there is an isolation between the internal and external network environments in the company's network, the business needs to be forwarded through the public network for scheduling during internal scheduling, resulting in a longer link for business scheduling and reducing the business scheduling efficiency. If only the single-node internal network RIP is used for scheduling, requests will fail and fault transfer cannot be performed when the service is unavailable, resulting in frequent failures in business scheduling.

[0047] Based on this, the present application proposes the following technical solutions. For details, please refer to the following text:

[0048] In one embodiment, as Figure 1 shown, Figure 1 This is a schematic flowchart of internal network load balancing scheduling provided by an embodiment of the present application; the present application provides an internal network load balancing scheduling method, which specifically includes the following:

[0049] S110: When it is detected that any one of the backend servers in the internal network receives a configuration text uploaded by a user, take this backend server as the request server, extract the instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the nginx server.

[0050] In this step, when a user needs to call a service from a backend server in another computer room within the intranet, the target service to be called can be uploaded to the management and control terminal in the form of a configuration text, and the backend server that uploads the configuration text is used as the request server. After the management and control terminal receives the configuration text uploaded by the request server, the instance parameters in the configuration text can be extracted to uniformly convert the instance parameters into an instance configuration file recognizable by the nginx server.

[0051] It should be noted that in this application, multiple nginx servers are used to build a load balancing cluster for load balancing service scheduling in the intranet. By increasing the number of nginx servers and then distributing requests to each server, the situation where requests were originally concentrated on a single server is changed to distributing requests to multiple servers and distributing the load to different nginx servers. Therefore, it is necessary to extract the instance parameters from the configuration text uploaded by the user and uniformly convert them into an instance configuration file recognizable by the nginx server.

[0052] Specifically, there are two types of configuration texts uploaded by users. One is the automatic type. The configuration parameters of this type of configuration text are concise, and the implemented instance functions are relatively single. Therefore, the instance parameters in the configuration text can be directly obtained and converted into an instance configuration file recognizable by the nginx server. The other type is the custom type. This type of configuration text is more complex than the automatic type. When performing service scheduling, users can customize the configuration text according to specific scenarios and service scheduling requirements and upload it. After the management and control terminal receives the custom configuration text, nginx can be used to extract information from the submitted configuration and convert it into an instance configuration file recognizable by the nginx server.

[0053] For example, in the same application, there are multiple domain names and different URL (Uniform Resource Locator) paths, and each URL path points to a different backend server. Or when custom functions such as health detection of the backend server, custom variables, custom response headers, request headers, or URL path rewriting need to be used in the same application, users can customize the configuration through an editor or in text format and then upload the configuration text. After the management terminal detects the upload of the configuration file, it will extract information from the submitted configuration through nginx and convert it into an instance configuration file recognizable by the nginx server.

[0054] S120: Synchronize the instance configuration file to each nginx server in the load balancing cluster and trigger each nginx server to load the instance configuration file to generate corresponding service scheduling instances.

[0055] In this step, after obtaining the instance configuration file recognizable by the Nginx server through step S110, the instance configuration file can be synchronized to each Nginx server in the load balancing cluster according to the configuration path of each Nginx server, and each Nginx server is triggered to load the instance configuration file to generate the corresponding business scheduling instance.

[0056] Specifically, after generating the instance configuration file, the instance configuration file generated in the control terminal can be copied to each Nginx server by using SCP (Secure Copy) through the SSH (Secure Shell) protocol, and a HUB signal is sent to Nginx to load the new configuration.

[0057] It can be understood that SSH is a security protocol based on the application layer, a protocol dedicated to providing security for remote login sessions and other network services, and SCP is implemented based on SSH. The underlying layer of SCP is the SSH protocol. During use, first log in to each Nginx server with SSH, and then copy the instance configuration file in the encrypted connection. After the instance configuration file is copied, a HUB signal can be sent to the Nginx server. After receiving the signal, the Nginx server will close the original process and start a new working process to load the instance configuration file and generate the business scheduling instance.

[0058] S130: Obtain all domain names of the business scheduling instance generated by any one Nginx server, and resolve each domain name to obtain the IP address of each domain name and the scheduling information corresponding to the IP address.

[0059] In this step, after generating the business scheduling instance in each Nginx server through step S120, all domain names of the business scheduling instance generated by any one Nginx server can be obtained, and DNS (Domain Name Server) is used to resolve each domain name. The IP address and scheduling information corresponding to each domain name are obtained through the resolution.

[0060] Specifically, when resolving each domain name of the business scheduling instance, the domain name to be resolved can be placed in the DNS request message and sent to the local domain name server deployed in the computer room in the form of a UDP user datagram. After the local domain name server finds the corresponding domain name, the corresponding IP address is placed in the response message and returned to obtain the IP address corresponding to the domain name. Thus, the request server to be scheduled and the target service to be obtained by the request server can be obtained according to the IP address, and the scheduling information corresponding to the domain name request can be obtained.

[0061] It should be noted that the scheduling information in this application includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the requesting server, which is used as the basis for the ngnix server to schedule each target service according to different domain name requests.

[0062] S140: According to the service identifier of the target service and the machine identifier of the target server to be scheduled in each scheduling information, obtain the corresponding target service from the corresponding target server, and sequentially allocate the obtained multiple target services and the machine identifier of the requesting server to each nginx server in the load balancing cluster, and send the corresponding target service to the requesting server through each nginx server respectively.

[0063] In this step, after obtaining the scheduling information corresponding to each domain name through step S130, the corresponding target service can be obtained from the corresponding target server according to the service identifier of the target service in each scheduling information, so as to sequentially allocate the obtained multiple target services and the machine identifier of the requesting server to each nginx server in the load balancing cluster, and determine each corresponding target server according to the machine identifier of each target server to be scheduled, and then send the corresponding target service to the requesting server through each nginx server respectively.

[0064] Furthermore, when there are multiple target services, the target service scheduling requests can be sent to each nginx server by means of round-robin. The target service scheduling request includes the target service and the machine identifier of the corresponding requesting server, so that the nginx server sequentially receives and processes the target service scheduling requests, and schedules the corresponding target services. This application can also weight the nginx servers according to their different performances, so that the nginx servers with better performances undertake more requests. For example, in a load balancing cluster where both 4C8G and 8C16G nginx servers are available, the weight of the 8C16G nginx server can be increased to handle more target service scheduling requests.

[0065] Still further, this application uses nginx to evenly distribute the target services to each nginx server in the load balancing cluster, and nginx distributes service requests based on the Round-Robin or Least-Connected algorithm. Through this method of internal network load balancing scheduling, even if one of the servers fails, it will not affect the processing of service scheduling. With the addition of target services, horizontal expansion can be achieved by adding deployed nginx servers.

[0066] Schematically, as Figure 2 shown, Figure 2Schematic diagram of the internal network load balancing architecture provided by the embodiments of the present application; in Figure 2 In this, in the internal network, by using the load balancing server nginx as the basic load balancing service, combining with four-layer load balancing devices, and binding the internal VIP, the internal network load balancing scheduling is realized. The domain names corresponding to each target service are forwarded to DNS for resolution. Then, according to the resolution results, the target services can be forwarded from the target servers to the nginx server through the internal VIP. Then, nginx distributes the target services to the corresponding request servers according to the scheduling information corresponding to each different domain name.

[0067] In the above embodiment, when performing load balancing scheduling in the internal network, if it is detected that any one of the backend servers in the internal network receives the configuration text uploaded by the user, then this backend server is used as the request server, and the instance parameters included in the configuration text are extracted, so as to convert the instance parameters into an instance configuration file recognizable by the nginx server. This can standardize the format of the instance configuration file, avoid problems such as non-standard string writing format or syntax errors in the configuration text from affecting the loading of the instance configuration file by the server, and at the same time simplify the configuration process. Then, the instance configuration file can be synchronized to each nginx server in the load balancing cluster to trigger each nginx server to load the instance configuration file and generate a service scheduling instance. Then, the scheduling information corresponding to each domain name in the service scheduling instance can be obtained by parsing. The scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server, so as to obtain the corresponding target service from the corresponding target server according to each scheduling information, and sequentially allocate the obtained multiple target services and the machine identifier of the request server to each nginx server in the load balancing cluster. Each nginx server sends the corresponding target service to the request server respectively. Through this scheduling method, the call methods of each service inside the internal network can be unified, and at the same time, the problems of single point of the load balancing target service and inability to perform failover when a failure occurs can be solved, thereby improving the service scheduling efficiency and reducing the occurrence of failures during calls.

[0068] In one embodiment, the step of extracting the instance parameters of the configuration text in step S110 may include:

[0069] S111: Parse the configuration information of the configuration text according to the preset keyword list to determine each keyword in the configuration information and the parameter position corresponding to each keyword.

[0070] S112: Cut the configuration information based on each parameter position to obtain each parameter in the configuration text, and form instance parameters.

[0071] In this embodiment, after detecting a configuration file uploaded by a user in the intranet, each keyword field in the preset keyword field list can be used to retrieve in the configuration information of the configuration text, index each keyword field corresponding to the configuration information, and the parameter position corresponding to each keyword field, so that the control end can use the syntax characteristics of nginx to cut each parameter from the string of the configuration information, thereby obtaining instance parameters.

[0072] It can be understood that in a custom configuration text, problems such as non-standard formats, inconsistent space lengths, syntax errors in strings, and possible conflicts between configurations and existing configurations are likely to occur. Therefore, each parameter can be extracted according to the preset keyword field list, and the meaning of each parameter in the instance parameters corresponding to each configuration file can be determined through the keyword fields. The instance parameters can include parameters such as domain names, backend servers, listened ports, and protocols adopted by the backend.

[0073] For example, when detecting a custom configuration text uploaded by a user in the intranet, obtain the configuration information of the custom configuration text. A part of the code of the configuration information is as follows:

[0074]

[0075]

[0076] According to the preset keyword field list, each parameter in this part of the configuration file can be extracted and formed into corresponding instance parameters. The parameters obtained after extracting this part of the configuration file are specifically as follows:

[0077] Domain name: ks.pcx.com

[0078] Listened port: 80

[0079] Backend protocol: http

[0080] Backend server: 192.168.xx.x1:8080, 192.168.xx.x2:8080,

[0081] 192.168.xx.x3:8080, 192.168.xx.x4:8080

[0082] In one embodiment, the step of converting instance parameters into an instance configuration file recognizable by the nginx server in step S110 may include:

[0083] S113: According to the preset keyword field list, write each parameter in the instance parameters into the corresponding database table in the database. The database table is a form with each keyword field in the preset keyword field list as the table header.

[0084] S114: Output each parameter in the instance parameters of the database table in a data conversion format through the interface to obtain a data conversion file, and convert the data conversion file into an instance configuration file recognizable by the nginx server.

[0085] In this embodiment, after the instance parameters are extracted, each parameter in the instance parameters can be written into the corresponding database table in the database to uniformly generate an instance configuration file with a standardized format. When generating the instance configuration file, each parameter in the instance parameters of the database table can be output in a data conversion format through the interface, and then converted into an instance configuration file recognizable by the nginx server.

[0086] Specifically, in the database table corresponding to the database, the data table is a form with each keyword field in the preset keyword field list as the table header. The data structure table of the database table keyword fields specifically includes the following:

[0087]

[0088]

[0089] Table 1 Data Structure Table of Database Table Keyword Fields

[0090] Through each keyword field in the above table, each parameter in the instance parameters of the database table can be output in a data conversion format through the interface to obtain a data conversion file. When obtaining the data conversion file corresponding to the instance parameters, the instance ID in the instance parameters can be used to query in the database, and other parameters in the instance parameters corresponding to the instance ID can be indexed, and then the data conversion file of the instance parameters is output in a data conversion format.

[0091] For example, when obtaining the instance parameters of the instance ID lb_xw3kpbj6ui7c, it can be read in the database through the interface / slb / intra / v1 / List? id=lb_xw3kpbj6ui7c. The content of the data conversion file returned after the interface reads the instance parameters is specifically as follows:

[0092]

[0093] In one embodiment, the step of converting the data conversion file into an instance configuration file recognizable by the nginx server in step S114 may include:

[0094] S141: Obtain a custom template, which is a configuration file containing multiple variables, and any variable defines a parameter corresponding to the variable.

[0095] S142: Write each parameter in the data conversion file into the custom template according to the correspondence between variables and parameters to generate an instance configuration file recognizable by the nginx server.

[0096] In this embodiment, after obtaining the data conversion file corresponding to the instance parameters, a custom template set in advance can be used, and each parameter in the template is defined as a variable corresponding to the parameter. Then, according to the correspondence between variables and parameters, each parameter in the data conversion file can be written into the custom template, thereby generating an instance configuration file recognizable by the nginx server.

[0097] For example, convert the instance parameters in the data conversion file returned by the interface in the above embodiment into an instance configuration file recognizable by the nginx server. The configuration information in the instance configuration file specifically includes the following:

[0098]

[0099] In one embodiment, the step of synchronizing the instance configuration file to each nginx server in the load balancing cluster in step S120 may include:

[0100] S121: Establish an encrypted connection with each nginx server in the load balancing cluster through the SSH protocol to generate an SSH key.

[0101] S122: Use each SSH key to log in to the corresponding nginx server and copy the instance configuration file to the corresponding nginx server in the load balancing cluster.

[0102] In this embodiment, after the control end converts the data conversion file into an instance configuration file, an encrypted connection can be established with each nginx server in the load balancing cluster through the SSH protocol to generate an SSH key to prevent information leakage during the remote file transfer process. After using each SSH key to log in to the corresponding nginx server, according to the target configuration path of each nginx server, copy the instance configuration file to the corresponding nginx server in the load balancing cluster.

[0103] Specifically, in the process of copying the instance configuration file, the SCP method can be used for copying. SCP can achieve replication between two remote systems. During the replication process, both the file and the password are encrypted to prevent leakage of sensitive information. The file copy is achieved by entering the original path of the instance configuration file at the control end and the target configuration path to be copied in the nginx server at the server command line. Further, if there is already a file with the same name in the target path for the instance configuration file, SCP will overwrite the file with the same name without warning.

[0104] In one embodiment, the step of triggering each Nginx server to load the instance configuration file and generate the corresponding service scheduling instance in step S120 may include:

[0105] S123: Detect the syntax of the instance configuration file in each Nginx server based on the Nginx syntax.

[0106] S124: If the detection is successful, make the instance configuration file take effect through the Nginx server to generate the corresponding service scheduling instance.

[0107] S125: If the detection fails, roll back the corresponding Nginx server process and return to the running state before the instance configuration file synchronization.

[0108] In this step, after the copy of the instance configuration file in each Nginx server is completed, the syntax of the instance configuration file in each Nginx server can be detected using the syntax features of Nginx. If the detection is successful, the instance configuration file can be made to take effect through the Nginx server, thereby generating the corresponding service scheduling instance. If the detection fails, it means that there are syntax or format errors in the configuration information of the instance configuration file and it cannot be loaded. At this time, the Nginx server process corresponding to the failed detection can be rolled back to return to the running state before the instance configuration file synchronization.

[0109] Further, in the load balancing cluster, when any one of the Nginx servers fails the detection and its process is rolled back, the failure status code can be returned to the management control end. When the Nginx server passes the detection and takes effect to generate the service scheduling instance, the success status code can be returned to the management control end. When the management control end receives the status codes returned by each Nginx server in the load balancing cluster, it can record the running state of the corresponding Nginx server in the database according to the status codes.

[0110] In one embodiment, the method may further include:

[0111] S150: During the internal network load balancing scheduling process, if any one of the Nginx server instance configuration file synchronization fails or the effect takes effect fails, roll back the process of the Nginx server and return to the running state before the instance configuration file synchronization.

[0112] In this embodiment, during the intranet load balancing scheduling process, if the configuration file synchronization of any nginx server instance fails or the configuration fails to take effect and cannot proceed, the process of the nginx server can be rolled back to return to the running state before the instance configuration file synchronization, and at the same time, the failure status code is returned to the management and control terminal so that the management and control terminal can record the running state of the nginx server in the database.

[0113] To better explain the instance configuration file synchronization process in the above embodiment, the following will be further described through Figure 3 as follows. As Figure 3 shown, Figure 3 is a schematic diagram of the synchronization process of the instance configuration file in the nginx server provided in the embodiment of the present application.

[0114] Figure 3 In, after the management and control terminal generates the instance configuration file, the instance configuration file can be synchronized to each nginx server in the load balancing cluster. If the synchronization fails, the process of the nginx server corresponding to the synchronization failure is rolled back. If the synchronization is successful, the configuration information of the instance configuration file synchronized to the nginx server is continued to be verified. If the verification fails, the process of the nginx server corresponding to the verification failure is rolled back. If the verification is successful, the instance configuration file that passes the verification is made effective. If the effectiveness fails, the process of the nginx server corresponding to the effectiveness failure is rolled back. If the effectiveness is successful, the success status code of the nginx server corresponding to the successful effectiveness is returned to the management and control terminal, and for the nginx server that performs rollback in the load balancing cluster, the failure status code can be returned to the management and control terminal after rollback. Through this solution, the present application can avoid the situation where a request fails and fault transfer cannot be performed when the server is unavailable.

[0115] The following describes the intranet load balancing scheduling device provided in the embodiment of the present application. The intranet load balancing scheduling device described below can be mutually referred to with the intranet load balancing scheduling method described above.

[0116] In one embodiment, as Figure 4 shown, Figure 4 is a schematic structural diagram of an intranet load balancing scheduling device provided by the present application; the present application also provides an intranet load balancing scheduling device, including a data analysis module 210, a file synchronization module 220, a domain name resolution module 230, and a service scheduling module 240, specifically including the following:

[0117] The data acquisition module 210 is used to, when detecting that any backend server in the intranet receives the configuration text uploaded by the user, use the backend server as the request server, extract the instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the nginx server.

[0118] A file synchronization module 220, configured to synchronize the instance configuration file to each nginx server in the load balancing cluster, and trigger each nginx server to load the instance configuration file to generate corresponding service scheduling instances;

[0119] A domain name resolution module 230, configured to obtain all domain names of the service scheduling instances generated by any one nginx server, and resolve each domain name to obtain the IP addresses of each domain name and the scheduling information corresponding to the IP addresses, where the scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the requesting server;

[0120] A service scheduling module 240, configured to obtain the corresponding target service from the corresponding target server according to the service identifier of the target service and the machine identifier of the target server to be scheduled in each scheduling information, and sequentially allocate the obtained multiple target services and the machine identifier of the requesting server to each nginx server in the load balancing cluster, and each nginx server sends the corresponding target service to the requesting server respectively.

[0121] In the above embodiment, when performing load balancing scheduling in the intranet, if it is detected that any one of the backend servers in the intranet receives the configuration text uploaded by the user, then this backend server is used as the requesting server, and the instance parameters included in the configuration text are extracted, so as to convert the instance parameters into an instance configuration file recognizable by the nginx server. This can standardize the format of the instance configuration file, avoid problems such as unstandardized string writing format or syntax errors in the configuration text from affecting the loading of the instance configuration file by the server, and at the same time simplify the configuration process. Then, the instance configuration file can be synchronized to each nginx server in the load balancing cluster to trigger each nginx server to load the instance configuration file to generate service scheduling instances. Then, the corresponding scheduling information can be obtained by parsing each domain name in the service scheduling instance. The scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the requesting server, so as to obtain the corresponding target service from the corresponding target server according to each scheduling information, and sequentially allocate the obtained multiple target services and the machine identifier of the requesting server to each nginx server in the load balancing cluster, and each nginx server sends the corresponding target service to the requesting server respectively. Through this scheduling method, the calling methods of each service within the intranet can be unified, and at the same time, the problems of single point of the load balancing target service and inability to perform failover when a failure occurs can be solved, thereby improving the service scheduling efficiency and reducing the generation of failures during calling.

[0122] In one embodiment, the data acquisition module 210 may include:

[0123] A data parsing sub-module, configured to parse the configuration information of the configuration text according to a preset keyword field list, and determine each keyword field in the configuration information and the parameter position corresponding to each keyword field.

[0124] A data extraction sub-module, configured to cut the configuration information based on each parameter position to obtain each parameter in the configuration text, and form instance parameters.

[0125] In one embodiment, the data acquisition module 210 may further include:

[0126] A data recording sub-module, configured to write each parameter in the instance parameters into a corresponding database table in the database according to the preset keyword field list, and the database table is a form with each keyword field in the preset keyword field list as the header.

[0127] A file conversion sub-module, configured to output each parameter in the instance parameters of the database table in a data conversion format through an interface to obtain a data conversion file, and convert the data conversion file into an instance configuration file recognizable by the nginx server.

[0128] In one embodiment, the file conversion sub-module may include:

[0129] A variable definition unit, configured to obtain a custom template, where the custom template is a configuration file including multiple variables, and any variable defines a parameter corresponding to the variable.

[0130] A file conversion unit, configured to write each parameter in the data conversion file into the custom template according to the correspondence between the variables and the parameters, and generate an instance configuration file recognizable by the nginx server.

[0131] In one embodiment, the file synchronization module 220 may include:

[0132] A key generation sub-module, configured to establish an encrypted connection with each nginx server in the load balancing cluster through the SSH protocol and generate an SSH key.

[0133] A file copy sub-module, configured to log in to the corresponding nginx server by using each SSH key and copy the instance configuration file to the corresponding nginx server in the load balancing cluster.

[0134] In one embodiment, the file synchronization module 220 may further include:

[0135] A syntax detection sub-module for performing syntax detection on the instance configuration files in each Nginx server based on Nginx syntax.

[0136] A file effectuation sub-module for, if the detection is successful, effectuating the instance configuration file through the Nginx server to generate a corresponding business scheduling instance.

[0137] A process rollback sub-module for, if the detection fails, rolling back the process of the corresponding Nginx server to return to the running state before the instance configuration file synchronization.

[0138] In one embodiment, the apparatus may further include:

[0139] A process rollback module for, during the intranet load balancing scheduling process, if any Nginx server instance configuration file synchronization fails or effectuation fails, rolling back the process of that Nginx server to return to the running state before the instance configuration file synchronization.

[0140] In one embodiment, the present application further provides a storage medium storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to execute the steps of the intranet load balancing scheduling method as described in any one of the above embodiments.

[0141] In one embodiment, the present application further provides a computer device storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to execute the steps of the intranet load balancing scheduling method as described in any one of the above embodiments.

[0142] Schematically, as Figure 5 shown, Figure 5 is an internal structural diagram of a computer device provided by an embodiment of the present application. The computer device 300 can be provided as a server. Referring to Figure 5 , the computer device 300 includes a processing component 302, which further includes one or more processors, and memory resources represented by a memory 301 for storing instructions executable by the processing component 302, such as application programs. The application programs stored in the memory 301 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the intranet load balancing scheduling method of any of the above embodiments.

[0143] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS XTM, Unix TM, Linux TM, Free BSDTM, or the like.

[0144] Those skilled in the art can understand that Figure 5 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0145] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0146] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0147] The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An internal network load balancing scheduling method, characterized in that The method includes: When it is detected that any one of the backend servers in the intranet receives the configuration text uploaded by the user, use this backend server as the request server, extract the instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the nginx server; Synchronize the instance configuration file to each nginx server in the load balancing cluster, and trigger each nginx server to load the instance configuration file to generate corresponding service scheduling instances; Obtain all domain names of the service scheduling instances generated by any one nginx server, resolve each domain name to obtain the IP addresses of each domain name and the scheduling information corresponding to the IP addresses, where the scheduling information includes the service identifier of the target service to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server; According to the service identifier of the target service and the machine identifier of the target server to be scheduled in each scheduling information, obtain the corresponding target service from the corresponding target server, and sequentially allocate the obtained multiple target services and the machine identifier of the request server to each nginx server in the load balancing cluster, and each nginx server sends the corresponding target service to the request server respectively.

2. The internal network load balancing scheduling method according to claim 1, wherein The extraction of the instance parameters of the configuration text includes: Parse the configuration information of the configuration text according to the preset keyword list to determine each keyword field in the configuration information and the parameter position corresponding to each keyword field; Based on each parameter position, cut the configuration information to obtain each parameter in the configuration text and form instance parameters.

3. The internal network load balancing scheduling method according to claim 1, characterized in that The conversion of the instance parameters into an instance configuration file recognizable by the nginx server includes: According to the preset keyword list, write each parameter in the instance parameters into the corresponding database table in the database, and the database table is a form with each keyword field in the preset keyword list as the table header; Output each parameter in the instance parameters of the database table in a data conversion format through an interface to obtain a data conversion file, and convert the data conversion file into an instance configuration file recognizable by the nginx server.

4. The internal network load balancing scheduling method according to claim 3, wherein The conversion of the data conversion file into an instance configuration file recognizable by the nginx server includes: Obtain a custom template, where the custom template is a configuration file containing multiple variables, and any one variable defines a parameter corresponding to the variable; According to the corresponding relationship between the variable and the parameter, write each parameter in the data conversion file into the custom template to generate an instance configuration file recognizable by the nginx server.

5. The internal network load balancing scheduling method according to claim 1, wherein The synchronization of the instance configuration file to each nginx server in the load balancing cluster includes: Establish an encrypted connection with each nginx server in the load balancing cluster through the SSH protocol to generate an SSH key; Log in to the corresponding Nginx server using each SSH key, and copy the instance configuration file to the corresponding Nginx server in the load balancing cluster.

6. The internal network load balancing scheduling method according to claim 1, wherein Trigger each Nginx server to load the instance configuration file to generate corresponding business scheduling instances, including: Perform syntax detection on the instance configuration file in each Nginx server based on Nginx syntax; If the detection is successful, make the instance configuration file take effect through the Nginx server to generate corresponding business scheduling instances; If the detection fails, roll back the process of the corresponding Nginx server and return to the running state before the instance configuration file synchronization.

7. The internal network load balancing scheduling method according to claim 1, characterized in that The method further includes: During the internal network load balancing scheduling process, if any Nginx server instance configuration file fails to be synchronized or takes effect, roll back the process of that Nginx server and return to the running state before the instance configuration file synchronization.

8. An intranet load balancing scheduling device, characterized in that, Including: A data acquisition module, which is used to, when detecting that any backend server in the internal network receives a configuration text uploaded by a user, use that backend server as the request server, extract the instance parameters of the configuration text, and convert the instance parameters into an instance configuration file recognizable by the Nginx server; A file synchronization module, which is used to synchronize the instance configuration file to each Nginx server in the load balancing cluster and trigger each Nginx server to load the instance configuration file to generate corresponding business scheduling instances; A domain name resolution module, which is used to obtain all domain names of the business scheduling instances generated by any Nginx server, resolve each domain name to obtain the IP addresses of each domain name and the scheduling information corresponding to the IP addresses, where the scheduling information includes the business identifier of the target business to be obtained, the machine identifier of the target server to be scheduled, and the machine identifier of the request server; A business scheduling module, which is used to, according to the business identifier of the target business and the machine identifier of the target server to be scheduled in each scheduling information, obtain the corresponding target business from the corresponding target server, and sequentially allocate the obtained multiple target businesses and the machine identifier of the request server to each Nginx server in the load balancing cluster, and send the corresponding target business to the request server through each Nginx server.

9. A storage medium, characterized in that: The computer-readable instructions are stored in the storage medium, and when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the internal network load balancing scheduling method according to any one of claims 1 to 7.

10. A computer device, characterized in that, Including: One or more processors, and a memory; The computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the one or more processors, the steps of the internal network load balancing scheduling method according to any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • Nginx-based load balancing implementation method and apparatus, computer device, and storage medium

    CN108965381A

  • Test data collection method and device, computer equipment and storage medium

    CN110808868A