Configuration file generation method and device, storage medium and electronic equipment

Through the automated configuration file conversion method, the problem of low efficiency of manual cross-platform load balancer configuration conversion is solved, efficient and accurate configuration conversion is achieved, and manual intervention is reduced.

CN119520258APending Publication Date: 2025-02-25QINGDAO HAIER TECH +2
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411611685.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

During business architecture adjustment, manual cross-platform load balancer configuration conversion is performed, resulting in low conversion efficiency.

Method used

By obtaining the configuration file of the source load balancer, reading the configuration information according to its configuration rules, converting it into configuration information in a common format, determining the configuration rules of the target load balancer, and converting the configuration information in the general format into configuration information corresponding to the target configuration rules, to generate a configuration file suitable for the target load balancer.

Benefits of technology

It realizes automatic conversion of the configuration information of the source load balancer into a configuration file suitable for the target load balancer, which greatly reduces the workload of manual configuration and improves the accuracy and efficiency of configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520258A_ABST
    Figure CN119520258A_ABST
Patent Text Reader

Abstract

The invention discloses a configuration file generation method and device, a storage medium and electronic equipment, and relates to the field of automation, the configuration file generation method comprises the following steps: obtaining a first configuration file of a source load balancer, and reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file; converting the first configuration information into configuration information in a general format; and determining a second configuration rule of a target load balancer, and converting the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file. And manual cross-platform load balancer configuration conversion results in low conversion efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automation, and in particular to a method and device for generating a configuration file, a storage medium, and an electronic device. Background Art

[0002] As an indispensable cornerstone in the business deployment architecture, the core function of the load balancer is to intelligently distribute network traffic or work tasks to multiple servers, thereby effectively reducing the burden of a single server and ensuring high availability and excellent performance of services. However, with the continuous evolution of today's business environment and the innovation of IT architecture, enterprises are facing a series of challenges, such as migrating from private cloud to public cloud or hybrid cloud, transforming from traditional deployment mode to containerized cluster, and changing the type of load balancer from open source nginx to commercial hardware F5 and cloud native ELB / NLB. Every architectural adjustment is accompanied by complex changes in the configuration of the load balancer. There are many brands of load balancers on the market, and the configuration methods, command syntax and parameter settings are different. This undoubtedly puts higher requirements on operation and maintenance engineers. Therefore, operation and maintenance engineers need to master the configuration knowledge of load balancers of multiple brands. In the scenario of business migration, manually converting the configuration of cross-platform load balancers is time-consuming and labor-intensive, usually taking days or even weeks, which has become a major bottleneck restricting efficient deployment.

[0003] In the related technology, when the business architecture is adjusted, manual cross-platform load balancer configuration conversion leads to low conversion efficiency, and no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a method and device for generating a configuration file, a storage medium, and an electronic device, so as to at least solve the problem in the related art that, when the business architecture is adjusted, the cross-platform load balancer configuration conversion is manually performed, resulting in low conversion efficiency.

[0005] According to an embodiment of the present application, a method for generating a configuration file is provided, including: obtaining a first configuration file of a source load balancer, and reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file; converting the first configuration information into configuration information in a general format; determining a second configuration rule of a target load balancer, and converting the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule, so as to generate a second configuration file.

[0006] In an exemplary embodiment, reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file includes: identifying a first keyword in the first configuration file based on keyword recognition technology, wherein the first keyword is used to indicate a first attribute name corresponding to attribute information in the first configuration file; extracting a value corresponding to the first keyword in the first configuration file according to the first configuration rule, wherein the value corresponding to the first keyword is used to indicate attribute information corresponding to the first attribute name, and the first configuration information includes: the first attribute name and attribute information corresponding to the first attribute name.

[0007] In an exemplary embodiment, the configuration information in the general format is converted into third configuration information corresponding to the second configuration rule according to the second configuration rule, including: identifying a second keyword and a value corresponding to the second keyword in the configuration information in the general format based on keyword recognition technology, wherein the value corresponding to the second keyword is used to indicate attribute information, and the second keyword is used to indicate a second attribute name corresponding to the attribute information; converting the second attribute name into a third attribute name according to the second configuration rule, and determining the attribute information corresponding to the second attribute name as the attribute information corresponding to the third attribute name, wherein the second configuration information includes: the third attribute name and the attribute information corresponding to the third attribute name.

[0008] In an exemplary embodiment, obtaining a first configuration file of a source load balancer includes: determining a first type of the source load balancer, and determining a first connection mode with the source load balancer according to the first type; establishing a connection relationship with the source load balancer according to the first connection mode; and obtaining the first configuration file of the source load balancer through the connection relationship with the source load balancer.

[0009] In an exemplary embodiment, determining the first type of the source load balancer includes: sending a query message to a target terminal, wherein the query message is used to request basic information of the source load balancer, and the basic information includes at least one of the following: brand information of the source load balancer, the IP address of the source load balancer, the connection method of the source load balancer, and the account password of the source load balancer; determining the first type of the source load balancer according to a response message sent by the target terminal, wherein the response message includes: the basic information.

[0010] In an exemplary embodiment, after generating the second configuration file, the method further includes: determining a second type of the target load balancer, and determining a second connection mode with the target load balancer according to the second type; establishing a connection relationship with the target load balancer according to the second connection mode; and writing the second configuration file into the target load balancer through the connection relationship with the target load balancer.

[0011] In an exemplary embodiment, the method further includes: monitoring whether there is an abnormal execution operation; if there is an abnormal execution operation, determining the abnormal cause corresponding to the abnormal execution operation; generating a monitoring report based on the abnormal execution operation and the abnormal cause, and sending the monitoring report to the target terminal.

[0012] According to another embodiment of the embodiment of the present application, a configuration file generation device is also provided, including: an acquisition module, used to obtain a first configuration file of a source load balancer, and read the first configuration information in the first configuration file according to the first configuration rule of the first configuration file; a first conversion module, used to convert the first configuration information into configuration information in a general format; a second conversion module, used to determine a second configuration rule of a target load balancer, and convert the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule, so as to generate a second configuration file.

[0013] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned configuration file generation method when running.

[0014] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the configuration file generation method through the computer program.

[0015] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method for generating the configuration file is implemented.

[0016] In an embodiment of the present application, a first configuration file of a source load balancer is obtained, and first configuration information in the first configuration file is read according to a first configuration rule of the first configuration file; the first configuration information is converted into configuration information in a general format; a second configuration rule of a target load balancer is determined, and according to the second configuration rule, the configuration information in the general format is converted into second configuration information corresponding to the second configuration rule to generate a second configuration file; that is, the configuration information of the source load balancer can be automatically converted into a configuration file suitable for the target load balancer, which greatly reduces the workload of manual configuration, improves the accuracy and efficiency of configuration, and thus solves the problem of low conversion efficiency caused by manual cross-platform load balancer configuration conversion when the business architecture is adjusted. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0019] Figure 1 It is a hardware environment diagram of a method for generating a configuration file according to an embodiment of the present application;

[0020] Figure 2 is a flowchart of a method for generating a configuration file according to an embodiment of the present application;

[0021] Figure 3 is a structural block diagram of a configuration file generation device according to an optional embodiment of the present application;

[0022] Figure 4 is a schematic diagram of a general configuration file according to an embodiment of the present application;

[0023] Figure 5 It is a structural block diagram of a configuration file generation device according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] According to one aspect of an embodiment of the present application, a method for generating a configuration file is provided. The method for generating the configuration file is widely used in smart home, smart home, smart home device ecology, smart house ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the method for generating the configuration file can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.

[0027] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.

[0028] In this embodiment, a method for generating a configuration file is provided, which is applied to the above terminal device. Figure 2 : is a flowchart of a method for generating a configuration file according to an embodiment of the present application, the process comprising the following steps:

[0029] Step S202, obtaining a first configuration file of the source load balancer, and reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file;

[0030] In an embodiment of the present application, the current configuration file is obtained from the source load balancer through SSH, API or other network protocols. After obtaining the configuration file, the tool or method will parse the file according to the configuration rules unique to the source load balancer. For example, for nginx, the tool will identify the "listen" and "server_name" keywords to determine the port and address that the service listens on. That is, in the nginx configuration file, the keyword "listen" is followed by the port number, and "server_name" is followed by the service address or domain name.

[0031] Step S204, converting the first configuration information into configuration information in a universal format;

[0032] After parsing the key configuration information of the source load balancer, it will be converted into an intermediate, universal configuration format, such as JSON or YAML. The universal format provides a standard, easy-to-process configuration representation method, so that subsequent conversion steps can be adjusted accordingly based on this universal configuration regardless of the type of target load balancer.

[0033] Step S206: determine a second configuration rule of the target load balancer, and convert the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file.

[0034] It should be noted that during the conversion process, it is necessary to understand the configuration rules and syntax of the target load balancer. This includes how the target load balancer defines the service address, port, backend server, load balancing strategy, etc. These rules may be completely different from those of the source load balancer. Then, the configuration information in the general format is converted into configuration information applicable to the target load balancer according to the configuration rules of the target load balancer, and a second configuration file is generated.

[0035] Through the above steps, the first configuration file of the source load balancer is obtained, and the first configuration information in the first configuration file is read according to the first configuration rule of the first configuration file; the first configuration information is converted into configuration information in a general format; the second configuration rule of the target load balancer is determined, and the configuration information in the general format is converted into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file; that is, the configuration information of the source load balancer can be automatically converted into a configuration file suitable for the target load balancer, which greatly reduces the workload of manual configuration, improves the accuracy and efficiency of configuration, and further solves the problem of low conversion efficiency caused by manual cross-platform load balancer configuration conversion when the business architecture is adjusted.

[0036] Optionally, in order to better understand the above step S202, the above step S202 can be implemented through the following steps: identifying a first keyword in the first configuration file based on keyword recognition technology, wherein the first keyword is used to indicate a first attribute name corresponding to the attribute information in the first configuration file; extracting a value corresponding to the first keyword in the first configuration file according to the first configuration rule, wherein the value corresponding to the first keyword is used to indicate the attribute information corresponding to the first attribute name, and the first configuration information includes: the first attribute name and the attribute information corresponding to the first attribute name.

[0037] It should be noted that keyword spotting technology is a text analysis method used to locate and identify words or phrases with specific meanings in configuration files. These words represent attribute names or control instructions in the configuration files.

[0038] In this technical solution, configuration attributes and their corresponding values ​​are determined by identifying specific keywords in the first configuration file of the source load balancer.

[0039] In the source configuration file, certain words such as "listen" and "server_name" are considered keywords, which indicate the location of specific attribute information in the configuration file. For example, in the nginx configuration file, the "listen" keyword indicates the port number that the service listens on, and "server_name" indicates the service address or domain name. That is, in the nginx configuration file, "listen" as a keyword indicates that the following value is the name of the port attribute information; "server_name" as a keyword indicates that the following value is the attribute information of the service address / domain name, that is, the attribute name.

[0040] After the keyword is identified, the value corresponding to the keyword is extracted from the configuration file according to the specific configuration rules of the source load balancer. These values ​​are actual configuration information, such as port number, service address, server weight, etc. For example, in the nginx configuration file, the keyword "listen" is found, and the value immediately following it (such as "80") is the attribute information corresponding to the first attribute name (service port); the value immediately following it (such as "192.168.1.100") is found. It is the attribute information corresponding to the first attribute name (service address / domain name).

[0041] Through the embodiments of the present application, the tool can systematically parse the configuration file of the source load balancer, identify and extract key configuration attributes and their values, and lay the foundation for subsequent universal format conversion and configuration conversion of the target load balancer. It not only improves the accuracy and efficiency of configuration conversion, but also reduces human errors.

[0042] Optionally, in order to better understand the above step S206, the above step S206 can be implemented through the following steps: based on keyword recognition technology, identifying a second keyword and a value corresponding to the second keyword in the configuration information of the general format, wherein the value corresponding to the second keyword is used to indicate attribute information, and the second keyword is used to indicate a second attribute name corresponding to the attribute information; converting the second attribute name into a third attribute name according to the second configuration rule, and determining the attribute information corresponding to the second attribute name as the attribute information corresponding to the third attribute name, wherein the second configuration information includes: the third attribute name and the attribute information corresponding to the third attribute name.

[0043] After converting the source configuration to a common format (such as JSON or YAML), the tool uses keyword recognition technology again, but this time to identify the second keyword and its corresponding value in the common configuration information. These keywords and values ​​constitute the structure of the common configuration file. For example, the common configuration file may contain the second keyword "Virtual_Server" with a value of "192.168.1.100", indicating the IP address information of the service. "Port" as the second keyword, its value is "80", indicating the service port information; "Weight" as the second keyword, its value is "100", indicating the weight information of the backend server.

[0044] The value corresponding to the second keyword is used to indicate attribute information, that is, specific configuration parameters, such as the service's IP address, port, server weight, etc. This information is standardized in the common configuration file, which is convenient for subsequent conversion. For example, in the common configuration file, the value "192.168.1.100" corresponding to "Virtual_Server" indicates the service's IP address attribute information; the value "80" corresponding to "Port" indicates the service port attribute information; the value "100" corresponding to "Weight" indicates the backend server weight attribute information.

[0045] According to the configuration rules of the target load balancer, the tool converts the second attribute name in the common format to the third attribute name in the target load balancer configuration, keeping the semantics of the configuration information unchanged. For example, taking Alibaba Cloud's NLB as an example, the second attribute name "Virtual_Server" may need to be converted to "ServerIp" in the target configuration; the second attribute name "Port" may directly correspond to "Port" in the target configuration; the second attribute name "Weight" may need to be converted to "ServerWeight" in the target configuration.

[0046] The third configuration information consists of the converted third attribute name and its corresponding attribute information, which is the content of the target load balancer configuration file. For example, after conversion to the Alibaba Cloud NLB configuration file, the third configuration information may include: third attribute name: ServerIp, attribute information: 192.168.1.100; third attribute name: Port, attribute information: 80; third attribute name: ServerWeight, attribute information: 100.

[0047] Through the embodiments of the present application, the source load balancer configuration is converted into the configuration rules of the target load balancer through the intermediate conversion of the common format, thereby realizing the cross-platform migration of configuration information, which not only simplifies the complexity of configuration conversion, but also enhances the accuracy and efficiency of configuration migration.

[0048] Optionally, "obtaining a first configuration file of the source load balancer" in step S202 includes: determining a first type of the source load balancer, and determining a first connection method with the source load balancer based on the first type; establishing a connection relationship with the source load balancer based on the first connection method; and obtaining the first configuration file of the source load balancer through the connection relationship with the source load balancer.

[0049] It should be noted that before starting the configuration conversion, you must first identify the type of the source load balancer, because different types may have completely different configuration file formats and management interfaces. For example, if the source load balancer is nginx, then its type is defined as "open source software load balancer".

[0050] Depending on the type of source load balancer, select the appropriate connection method to read the configuration file. Different load balancers may support different connection methods, such as SSH, API, or Web interface. For example, for nginx load balancer, the common first connection method is through SSH connection, because nginx usually runs on Linux servers and can be remotely accessed and managed through SSH.

[0051] After the connection method is determined, a connection to the source load balancer will be established. This may involve steps such as verifying identity, providing login credentials, or calling an API interface. For example, if the SSH connection method is selected, the tool will use the username, password, or key file to establish an SSH connection to the nginx load balancer.

[0052] After the connection is established, the tool can read the configuration file from the source load balancer. The specific method of reading the configuration file may vary for different load balancer types, but the ultimate goal is to obtain the raw data of the configuration information. For example, after the SSH connection is successful, the tool will read the nginx configuration file, usually the configuration file in the ` / etc / nginx / nginx.conf` or ` / etc / nginx / conf.d / ` directory. These files contain all the configuration details of nginx, such as listening ports, service domain names, backend server lists, etc.

[0053] The above steps ensure that the tool can accurately read the configuration information of the source load balancer, regardless of the type of source load balancer or the platform it runs on. By automating the acquisition of configuration files, work efficiency can be significantly improved and human errors can be reduced.

[0054] Optionally, the first type of the source load balancer can be determined in the following manner: sending a query message to the target terminal, wherein the query message is used to request basic information of the source load balancer, and the basic information includes at least one of the following: brand information of the source load balancer, the IP address of the source load balancer, the connection method of the source load balancer, and the account password of the source load balancer; determining the first type of the source load balancer based on response information sent by the target terminal, wherein the response information includes: the basic information.

[0055] In the embodiment of the present application, in order to determine the specific type of the source load balancer, the tool will send a query message to the target terminal (which may be a terminal operated by an operation and maintenance engineer or an automated operation and maintenance system). For example, the tool may ask the operation and maintenance engineer through a command line interface or a web interface to provide basic information about the source load balancer, such as brand information, IP address, connection method, and account password.

[0056] After receiving the response information from the target terminal, the tool will analyze the information, especially the brand information, to determine the type of the source load balancer. For example, if the operation and maintenance engineer responds that the brand of the source load balancer is "nginx", running on the IP address "192.168.1.100", the connection method is "SSH", and the account password has been provided, then the tool will determine that the first type of the source load balancer is "open source software load balancer nginx".

[0057] By interacting with the target terminal, it ensures that the tool can obtain accurate source load balancer information and correctly identify its type.

[0058] In actual operation, this process may be implemented through the interaction of a graphical user interface, command line interface, or automated script with operation and maintenance engineers or operation and maintenance systems, ensuring that the type of source load balancer can be determined efficiently and accurately in different scenarios, providing a solid foundation for the subsequent configuration conversion process.

[0059] Optionally, after generating the second configuration file, it also includes: determining a second type of the target load balancer, and determining a second connection method with the target load balancer based on the second type; establishing a connection relationship with the target load balancer based on the second connection method; and writing the second configuration file into the target load balancer through the connection relationship with the target load balancer.

[0060] It should be noted that after generating the second configuration file in the general format or the target format, the next step is to identify the type of the target load balancer. For example, if the target load balancer is Alibaba Cloud's Network Load Balancer (NLB), then the second type is identified as "Cloud Service Load Balancer".

[0061] Depending on the type of target load balancer, select the appropriate connection method to deploy the configuration file. Different load balancers may support different connection methods, such as SSH, API call, Web interface management, etc. For example, for Alibaba Cloud NLB, the second connection method may be to call the SDK or API interface provided by Alibaba Cloud, because cloud services usually provide a rich set of automated management interfaces for easy remote configuration and management.

[0062] After determining the connection method, the next step is to establish a connection with the target load balancer. Finally, through the established connection, the second configuration file is written to the target load balancer to achieve automatic deployment of the configuration. For example, the tool calls the API interface of Alibaba Cloud NLB, uploads the second configuration file, applies the configuration information to NLB, and completes the configuration update.

[0063] Through automated deployment, enterprises can quickly adapt to changes in business needs, improve service availability and response speed, and reduce operation and maintenance costs.

[0064] In an exemplary embodiment, the method further includes: monitoring whether there is an abnormal execution operation; if there is an abnormal execution operation, determining the abnormal cause corresponding to the abnormal execution operation; generating a monitoring report based on the abnormal execution operation and the abnormal cause, and sending the monitoring report to the target terminal.

[0065] During the execution of each step, the system will monitor in real time whether there are any execution anomalies. The anomaly may be caused by network connection failure, configuration errors of the source or target load balancer, permission issues, internal errors of the tool, etc. For example, the tool is reading the configuration file from the source load balancer (nginx) through SSH, but suddenly the connection is interrupted due to network fluctuations. At this time, the system will immediately detect this anomaly and stop the current operation.

[0066] In the case of abnormal execution, determine the abnormal cause of the abnormal execution: Once the abnormality is detected, the tool will further analyze the abnormal details to determine the specific steps of the abnormal execution and the root cause of the abnormality. For example, in the above SSH connection interruption example, the tool will use network diagnostic tools (such as ping command) or log analysis to determine whether the network interruption is caused by network equipment failure, network configuration error, excessive server load or other reasons.

[0067] The abnormal information, abnormal steps and abnormal reasons are summarized into a monitoring report, and the report is sent to the operation and maintenance engineer or the automated operation and maintenance system, usually in the form of email, instant message, system log or graphical user interface. The monitoring report generated by the tool may look like this: "When reading the configuration file from the source load balancer nginx, an SSH connection abnormality was detected. The reason may be a connection interruption caused by network fluctuations. Please check the status of the network device or the server load and try to reestablish the connection."

[0068] Through the embodiments of the present application, operation and maintenance personnel are helped to find and solve problems in a timely manner, configuration conversion failures caused by unknown anomalies are avoided, and the robustness and operation and maintenance efficiency of the system are improved. Through real-time anomaly monitoring, the tool can ensure that each step of the configuration conversion is executed correctly, and any problems can be quickly identified and handled, thereby improving the reliability of the entire configuration conversion process.

[0069] In addition, the abnormal monitoring and reporting mechanism also enhances the transparency of operation and maintenance work. Operation and maintenance personnel can clearly track the entire process of configuration conversion and understand the deployment status in a timely manner.

[0070] In order to better understand the process of the method for generating the above configuration file, the implementation method flow of generating the above configuration file is described below in combination with an optional embodiment, but it is not intended to limit the technical solution of the embodiment of the present application.

[0071] In this embodiment, a method for generating a configuration file is provided. Figure 3 is a structural block diagram of a configuration file generation device according to an optional embodiment of the present application, such as Figure 3 As shown, the configuration file generation device is composed of a series of highly coordinated modules, including:

[0072] Start module S1, query module A1, connection module A2, analysis module B1, configuration conversion module B2, configuration writing module A3, result output module S2;

[0073] The query module A1 is used to accurately obtain detailed information of the source load balancer before the conversion, including but not limited to its brand type, network identifier (IP address), preferred connection mechanism, and the same attributes of the preset target load balancer, to form a comprehensive conversion preparation list.

[0074] Connection module A2 is used to establish a stable bridge with the source load balancer, paving the way for reading its core configuration files. This process demonstrates the tool's compatibility with multiple connection protocols and ensures secure and fast data reading.

[0075] Analysis module B1 is used to parse each line of the source configuration file, accurately identify key configuration parameters and rules, and convert these unique configuration information into industry-standard common formats such as JSON or YAML, laying a solid foundation for subsequent conversion work.

[0076] The configuration conversion module B2 is used to accurately convert the general representation of the source configuration into a configuration file that matches the target load balancer. This process reflects the tool's high adaptability and accuracy in cross-brand and cross-platform configuration conversion.

[0077] The configuration writing module A3 is used to write the converted configuration file to the target load balancer to complete the configuration deployment and realize the configuration migration from source to target. The accuracy and automation of its operation significantly improve the conversion efficiency and reduce the need for manual intervention.

[0078] The result output module S2 is used to clearly display the results of the entire configuration conversion and deployment process on the user interface, providing immediate feedback to operation and maintenance personnel to confirm whether the configuration migration is successful, thereby enhancing the usability of the solution and user trust.

[0079] Based on the above configuration file generation device, a configuration file generation and sending method is executed, including:

[0080] The embodiment of this application provides two configuration conversion execution methods: one is to automatically obtain the configuration file; the other is to manually import the configuration file, providing solutions for environments that require specific control or do not have automation conditions. Regardless of which path is chosen, the core value of the solution lies in ensuring the accuracy and speed of configuration conversion, while having wide compatibility, covering a variety of load balancer brands and types from open source to commercial, local to cloud.

[0081] When automatically acquiring the configuration file, the query module A1 not only collects the necessary connection information, but also confirms the starting and ending points of the conversion - the detailed properties of the source and target load balancers. The startup of this module requires manual input of a series of key parameters, including the source load balancer's identification (brand, IP, connection method, account password or SDK key), and the corresponding information of the target device. Users who choose to manually import the configuration can skip the query module A1's direct access to the source device and directly submit the exported configuration file to the program.

[0082] The process of automatically obtaining the source configuration file D1 of the source load balancer is as follows:

[0083] When the source load balancer type of the A1 module is nginx, the python paramiko library is called to implement SSH connection and obtain the *.conf configuration files in the / etc / nginx / nginx.conf or / etc / nginx / conf.d / directory;

[0084] When the source load balancer type of the A1 module is cloud NLB / ELB, etc., the corresponding configuration is obtained through the API interface of cloud SLB and written as D1.

[0085] After the source configuration file D1 is obtained, the source configuration file D1 is used as the input of the analysis module B1 to start the configuration analysis process. The execution process of the analysis module B1 is as follows (taking nginx as an example, the same is true for other types):

[0086] 1) Read the source configuration file D1, and obtain the external service address / domain name and port number through keyword recognition according to the configuration rules of the source load balancer. Nginx configuration example: server{listen 80; server_name192.168.11.110};

[0087] 2)According to the configuration rules of the source load balancer, obtain the backend server and port number. Nginx configuration example: upstream backup{server 192.168.199.152:8081};

[0088] 3) Obtain the load mode according to the configuration rules, such as polling, minimum number of connections, IP hash, URI hash, shortest response time, maximum number of connections, etc.

[0089] 4)According to the configuration rules, obtain the health check method, such as icmp, tcp_halfopen, etc.

[0090] 5) Obtain other configuration parameters according to the configuration rules.

[0091] The content analyzed by the analysis module B1 is used to generate a general YAML configuration file D2. The YAML configuration file is as follows: Figure 4 shown.

[0092] After the YAML configuration file D2 is generated, the YAML configuration file D2 is used as the input of the analysis module B2 to start the target load balancer configuration conversion process. The execution process of the analysis module B2 is as follows (taking Alibaba Cloud NLB as an example, the same applies to other types):

[0093] 1) Read the keyword Virtual_Server value in the D2 text and convert it into the NLB value according to the API interface rules. For example: {ServerIp:192.168.11.110};

[0094] 2) Read the keyword Port value in the D2 text and convert it into the NLB value according to the API interface rules.

[0095] For example: {Port:80};

[0096] 3) Read the keyword Weight value in the D2 text and convert it into the NLB value according to the API interface rules, such as {Weight:100};

[0097] The contents of the D2 configuration file are read one by one, and are converted into a target configuration file D3 of the target load balancer using a corresponding configuration conversion method according to the type of the target load balancer through keyword recognition.

[0098] After the target configuration file D3 is generated, the configuration writing module A3 starts to write the configuration (if the export mode is used, the target configuration file D3 is directly generated, and the configuration writing module A3 does not perform any operation).

[0099] The embodiment of the present application discloses a cross-platform load balancer configuration automatic conversion tool and method. In order to avoid the entire conversion process from being wasted due to abnormalities in some submodules during the conversion process, each module in the embodiment of the present application has a result output, and the result output module S2 is used to monitor the configuration conversion process in real time, display the execution process and result records on the screen, and judge whether there is an abnormality in the module execution process according to the real-time monitoring result. If it is abnormal, the corresponding abnormal execution steps and reasons are determined for the user to troubleshoot and solve the error. When the configuration conversion is successful, the result output module S2 will output the execution result on the screen.

[0100] The embodiment of the present application can realize simple and fast automation through tools to easily and quickly complete the cumbersome configuration conversion process of load balancers of different brands and types, greatly reducing the workload and improving efficiency. It also simplifies high-level technical capabilities to junior engineers, greatly improving ease of use.

[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0102] Figure 5 is a structural block diagram of a configuration file generation device according to an embodiment of the present application; Figure 5 As shown, including:

[0103] An acquisition module 52, configured to acquire a first configuration file of the source load balancer, and read first configuration information in the first configuration file according to a first configuration rule of the first configuration file;

[0104] A first conversion module 54, configured to convert the first configuration information into configuration information in a universal format;

[0105] The second conversion module 56 is used to determine a second configuration rule of the target load balancer, and convert the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file.

[0106] Through the above-mentioned device, a first configuration file of the source load balancer is obtained, and the first configuration information in the first configuration file is read according to the first configuration rule of the first configuration file; the first configuration information is converted into configuration information in a general format; the second configuration rule of the target load balancer is determined, and the configuration information in the general format is converted into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file, that is, the configuration information of the source load balancer can be automatically converted into a configuration file suitable for the target load balancer, which greatly reduces the workload of manual configuration, improves the accuracy and efficiency of configuration, and solves the problem of low conversion efficiency caused by manual cross-platform load balancer configuration conversion when the business architecture is adjusted in the related technology.

[0107] In an exemplary embodiment, an acquisition module 52 is used to identify a first keyword in the first configuration file based on keyword recognition technology, wherein the first keyword is used to indicate a first attribute name corresponding to attribute information in the first configuration file; a value corresponding to the first keyword is extracted from the first configuration file according to the first configuration rule, wherein the value corresponding to the first keyword is used to indicate attribute information corresponding to the first attribute name, and the first configuration information includes: the first attribute name and attribute information corresponding to the first attribute name.

[0108] In an exemplary embodiment, the second conversion module 56 is used to identify a second keyword and a value corresponding to the second keyword in the configuration information of the general format based on keyword recognition technology, wherein the value corresponding to the second keyword is used to indicate attribute information, and the second keyword is used to indicate a second attribute name corresponding to the attribute information; convert the second attribute name into a third attribute name according to the second configuration rule, and determine the attribute information corresponding to the second attribute name as the attribute information corresponding to the third attribute name, wherein the second configuration information includes: the third attribute name and the attribute information corresponding to the third attribute name.

[0109] In an exemplary embodiment, the acquisition module 52 is used to determine a first type of the source load balancer, and determine a first connection mode with the source load balancer according to the first type; establish a connection relationship with the source load balancer according to the first connection mode; and obtain a first configuration file of the source load balancer through the connection relationship with the source load balancer.

[0110] In an exemplary embodiment, the acquisition module 52 is used to send an inquiry message to the target terminal, wherein the inquiry message is used to request basic information of the source load balancer, and the basic information includes at least one of the following: brand information of the source load balancer, the IP address of the source load balancer, the connection method of the source load balancer, and the account password of the source load balancer; determine the first type of the source load balancer according to the response information sent by the target terminal, wherein the response information includes: the basic information.

[0111] In an exemplary embodiment, the above-mentioned device also includes: a writing module, used to determine the second type of the target load balancer, and determine a second connection method with the target load balancer according to the second type; establish a connection relationship with the target load balancer according to the second connection method; and write the second configuration file into the target load balancer through the connection relationship with the target load balancer.

[0112] In an exemplary embodiment, the above-mentioned device also includes: a monitoring module for monitoring whether there is an abnormal execution operation; in the case of an abnormal execution operation, determining the abnormal cause corresponding to the abnormal execution operation; generating a monitoring report based on the abnormal execution operation and the abnormal cause, and sending the monitoring report to the target terminal.

[0113] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.

[0114] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0115] S1, obtaining a first configuration file of the source load balancer, and reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file;

[0116] S2, converting the first configuration information into configuration information in a universal format;

[0117] S3, determining a second configuration rule of the target load balancer, and converting the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule, so as to generate a second configuration file.

[0118] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0119] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0120] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0121] S1, obtaining a first configuration file of the source load balancer, and reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file;

[0122] S2, converting the first configuration information into configuration information in a universal format;

[0123] S3, determining a second configuration rule of the target load balancer, and converting the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule, so as to generate a second configuration file.

[0124] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0125] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0126] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0127] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.

[0128] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0129] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0130] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a configuration file, characterized in that: include: Obtain a first configuration file of the source load balancer, and read first configuration information in the first configuration file according to a first configuration rule of the first configuration file; Converting the first configuration information into configuration information in a universal format; A second configuration rule of the target load balancer is determined, and the configuration information in the general format is converted into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file.

2. The method for generating a configuration file according to claim 1, characterized in that: Reading first configuration information in the first configuration file according to a first configuration rule of the first configuration file includes: identifying a first keyword in the first configuration file based on a keyword recognition technology, wherein the first keyword is used to indicate a first attribute name corresponding to the attribute information in the first configuration file; A value corresponding to the first keyword is extracted from the first configuration file according to the first configuration rule, wherein the value corresponding to the first keyword is used to indicate attribute information corresponding to the first attribute name, and the first configuration information includes: the first attribute name and attribute information corresponding to the first attribute name.

3. The method for generating a configuration file according to claim 1, characterized in that: Converting the configuration information in the general format into third configuration information corresponding to the second configuration rule according to the second configuration rule includes: Identify a second keyword and a value corresponding to the second keyword in the configuration information of the general format based on a keyword recognition technology, wherein the value corresponding to the second keyword is used to indicate attribute information, and the second keyword is used to indicate a second attribute name corresponding to the attribute information; The second attribute name is converted into a third attribute name according to the second configuration rule, and the attribute information corresponding to the second attribute name is determined as the attribute information corresponding to the third attribute name, wherein the second configuration information includes: the third attribute name and the attribute information corresponding to the third attribute name.

4. The method for generating a configuration file according to claim 1, characterized in that: Get the first configuration file of the source load balancer, including: Determine a first type of the source load balancer, and determine a first connection mode with the source load balancer according to the first type; Establishing a connection relationship with the source load balancer according to the first connection mode; A first configuration file of the source load balancer is obtained through a connection relationship with the source load balancer.

5. The method for generating a configuration file according to claim 4, characterized in that: Determining a first type of the source load balancer includes: Sending a query message to the target terminal, wherein the query message is used to request to obtain basic information of the source load balancer, and the basic information includes at least one of the following: brand information of the source load balancer, IP address of the source load balancer, connection mode of the source load balancer, and account password of the source load balancer; The first type of the source load balancer is determined according to the response information sent by the target terminal, wherein the response information includes: the basic information.

6. The method for generating a configuration file according to claim 1, characterized in that: After generating the second configuration file, the method further includes: Determine a second type of the target load balancer, and determine a second connection mode with the target load balancer according to the second type; Establishing a connection relationship with the target load balancer according to the second connection mode; The second configuration file is written into the target load balancer through a connection relationship with the target load balancer.

7. The method for generating a configuration file according to claim 1, characterized in that: The method further comprises: monitoring whether there is an abnormal execution operation; In the case of an abnormal execution operation, determining the abnormal cause corresponding to the abnormal execution operation; A monitoring report is generated based on the abnormal execution operation and the abnormal cause, and the monitoring report is sent to a target terminal.

8. A configuration file generating device, characterized in that: include: An acquisition module, used to acquire a first configuration file of the source load balancer, and read first configuration information in the first configuration file according to a first configuration rule of the first configuration file; A first conversion module, used to convert the first configuration information into configuration information in a universal format; The second conversion module is used to determine a second configuration rule of the target load balancer, and convert the configuration information in the general format into second configuration information corresponding to the second configuration rule according to the second configuration rule to generate a second configuration file.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Data migration method and device, electronic equipment and storage medium

    CN114372043A

  • Intranet load balancing scheduling method and device, storage medium and computer equipment

    CN116016534A

  • Middleware deployment method and device, computer equipment and storage medium

    CN118409760A

  • Conversion method and device of configuration file, electronic equipment and storage medium

    CN118838886A

  • Insulin pump programming software for selectively modifying configuration data

    WO2010026202A2