Method and system for dynamically setting service parameters based on CLI
Through CLI, the service parameter modification instructions are entered on the service deployment device and communicated with the server, which solves the problem of restarting and polling configuration files to waste memory when modifying service parameter, and realizes no restart modification and security guarantee.
Patent Information
- Application Number
- CN202111347231.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-15
AI Technical Summary
In the prior art, service parameters modification requires restarting, resulting in the system being unable to run 24 hours a day; polling the configuration file is wasted memory resources; remote modification of the configuration file poses security risks.
Enter the service parameter modification instructions on the service deployment device through CLI, establish a communication link with the server, execute the modification instructions and receive feedback, avoid restarting the service, and limit the modification permissions on the deployment device to ensure security.
It realizes no restart modification of service parameters, saves memory resources, improves efficiency, and ensures data security.
Smart Images

Figure CN114095226B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information engineering, and in particular to a method and system for dynamically setting service parameters based on CLI. Background Art
[0002] Generally speaking, the configurable parameters of a service are maintained in the configuration file. Remote dynamic setting of service parameters means remotely accessing the service deployment device and modifying the configurable parameters in the configuration file to meet the needs of testing or actual use.
[0003] During testing or actual use, some service parameters need to be frequently modified. The existing modification method is to modify the configurable parameters in the configuration file. However, the use of configuration files to maintain service parameters has the following problems: 1. Since the service parameters in the configuration file are generally read when the system is initialized, the modification of the parameters requires restarting the entire service to take effect. However, some systems need to run 24 hours a day and cannot be restarted. In this way, the method of completing parameter configuration by restarting is not applicable. 2. The solution of polling the configuration file will waste running memory resources and its application scope is also limited. 3. Providing permissions to remotely modify the configuration file will cause certain security risks. Summary of the invention
[0004] The purpose of the present invention is to overcome the defects of the prior art and provide a method and system for dynamically setting service parameters based on CLI, so as to solve the problems that the service parameters need to be modified through configuration files in the prior art to be restarted for the service to take effect, the polling of configuration files will waste the running memory resources, and the remote modification of configuration file permissions will cause security risks.
[0005] The technical solution to achieve the above purpose is:
[0006] The present invention provides a method for dynamically setting service parameters based on CLI, comprising the following steps:
[0007] Access service deployment equipment;
[0008] Running the CLI on the service deployment device and inputting a service parameter modification instruction; and
[0009] The service parameter modification instruction is sent to the server on the service deployment device so that the server executes the service parameter modification instruction, and a feedback result from the server is received.
[0010] The present invention provides a method for dynamically setting service parameters based on CLI, which is to run CLI, i.e. command line interface, on a service deployment device, input a service parameter modification instruction in the command line interface, and realize the modification of service parameters without restarting the service, thereby improving efficiency and avoiding the waste of resources caused by polling configuration files. When modifying service parameters, it is realized by accessing the service deployment device, and the modification authority can be limited to the service deployment device, thereby ensuring the security of data.
[0011] A further improvement of the method for dynamically setting service parameters based on CLI of the present invention is that a communication link is established between the CLI and the server;
[0012] The service parameter modification instruction is sent to the server through the CLI.
[0013] A further improvement of the method for dynamically setting service parameters based on CLI of the present invention is that after receiving the service parameter modification instruction, the server parses the service parameter modification instruction, obtains the corresponding service parameters and commands, and executes them.
[0014] A further improvement of the method for dynamically setting service parameters based on CLI of the present invention is that, when the server obtains the corresponding service parameters and commands, it registers the service modules corresponding to the obtained service parameters and commands;
[0015] Modify the service parameters of the registered service model and return the feedback result to the CLI.
[0016] A further improvement of the method for dynamically setting service parameters based on CLI of the present invention is that it also includes:
[0017] Setting access permissions on the service deployment device;
[0018] When receiving an access request, the service deployment device determines the access permission of the received access request, and allows access when it is determined that the access permission is granted.
[0019] The present invention also provides a system for dynamically setting service parameters based on CLI, comprising:
[0020] A CLI installed on the service deployment device, used to receive input service parameter modification instructions; and
[0021] A command processing module installed on the server side of the service deployment device, the command processing module is used to receive and execute the service parameter modification instructions sent by the CLI, and then form a feedback result to the CLI.
[0022] A further improvement of the system for dynamically setting service parameters based on CLI of the present invention is that a communication link is established between the CLI and the server.
[0023] A further improvement of the system for dynamically setting service parameters based on CLI of the present invention is that it also includes a protocol parsing module installed on the server side, the protocol parsing module is connected to the command processing module, and the protocol parsing module is used to parse the service parameter modification instruction and obtain corresponding service parameters and commands, and then send the obtained service parameters and commands to the command processing module.
[0024] A further improvement of the system for dynamically setting service parameters based on CLI of the present invention is that it also includes a registration callback module, which is connected to the protocol parsing module and the command processing module, and is used to register the acquired service parameters and the service module in the command, so that the command processing module can modify the service parameters of the registered service module.
[0025] A further improvement of the system for dynamically setting service parameters based on CLI of the present invention is that it also includes an access permission judgment module installed on the service deployment device, which is used to judge the access permission of the access request and allow access when it is judged that the access permission is available. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a system diagram of the system for dynamically setting service parameters based on CLI in the present invention.
[0027] Figure 2 The present invention is a flowchart of a method for dynamically setting service parameters based on CLI. DETAILED DESCRIPTION
[0028] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0029] See also Figure 1The present invention provides a method and system for dynamically setting service parameters based on CLI, which is used to solve the problem that modifying service parameters requires restarting the service and the security problem of remotely setting service parameters. The method and system for setting service parameters provided by the present invention are implemented through CLI (Command-Line Interface), and the service parameter modification instruction is input into the CLI interface, and then the service parameter modification instruction is sent to the server of the service deployment device. The server executes the command and returns the feedback result, so that the service deployment device can modify the service parameters without restarting or shutting down, which can ensure the uninterrupted operation of the service. In addition, the authority to modify the service parameters is limited to the service deployment device, and the service parameters can only be modified using the CLI on the service deployment device, which can ensure the security of the data. The method and system for dynamically setting service parameters based on CLI of the present invention are described below in conjunction with the accompanying drawings.
[0030] See also Figure 1 , showing the system diagram of the system for dynamically setting service parameters based on CLI of the present invention. Figure 1 , the system for dynamically setting service parameters based on CLI of the present invention is described.
[0031] like Figure 1 As shown, the system package CLI21 and command processing module 22 for dynamically setting service parameters based on CLI of the present invention are installed on the service deployment device, which can be an industrial computer or a server. A corresponding service system is arranged on the service deployment device to provide corresponding services to corresponding users. CLI21 is used to receive input service parameter modification instructions. Specifically, the operator needs to access the service deployment device, and then run the CLI21 on the service deployment device, and then input the corresponding service parameter modification instructions to CLI21 through the keyboard, and the input service parameter modification instructions are received by CLI21. The command processing module 22 is installed on the service end of the service deployment device, which is the service system installed on the service deployment device, and is used to provide corresponding services to users. The command processing module 22 is used to receive and execute the service parameter modification instructions sent by CLI, and then form a feedback result to CLI21, so that the modification operation of the service parameters is completed.
[0032] Specifically, CLI21 is a command line interface, which is installed on the service deployment device in the form of software. After running CLI21 on the service deployment device, the corresponding instruction code can be input through the keyboard in the interface of CLI21, that is, the instruction code for the service parameter to be modified can be input to form a service parameter modification instruction. A command processing module is set on the server side to execute the modification of the service parameters, so that the service parameter modification instruction can be directly input on the service deployment device and the modification is executed to complete the modification of the service parameters, avoiding the problem of restarting the service to take effect, ensuring that the service can run uninterruptedly, and improving the efficiency of service parameter modification, which is particularly suitable for situations where service parameters need to be modified frequently.
[0033] In a specific embodiment of the present invention, a communication link is established between CLI21 and the server to enable data transmission and reception, so that CLI21 can send the received service parameter modification instruction to the server for modification, and also enable the server to send feedback results to CLI21.
[0034] Preferably, the CLI 21 and the server use http protocol or websocket protocol for communication link.
[0035] In a specific embodiment of the present invention, the system for dynamically setting service parameters based on CLI of the present invention also includes a protocol parsing module 23 installed on the server side, and the protocol parsing module 23 is connected to the command processing module 22. The protocol parsing module 23 is used to parse the service parameter modification instructions and obtain the corresponding service parameters and commands, and then send the obtained service parameters and commands to the command processing module 22 for execution by the command processing module 22.
[0036] Specifically, the service parameter modification instruction sent by CLI21 is received by the protocol parsing module 23 and the protocol is parsed to obtain the corresponding service parameters and commands. The service parameters and commands include the specific service modules and specific parameter values that need to be configured. After parsing, the command processing module 22 can execute the service parameters and commands obtained by parsing.
[0037] In a specific embodiment of the present invention, the system for dynamically setting service parameters based on CLI of the present invention also includes a registration callback module 24, which is connected to the protocol parsing module 23 and the command processing module 22, and is used to register the acquired service parameters and the service module in the command, so that the command processing module 22 modifies the service parameters of the registered service module.
[0038] Specifically, the service end of the service deployment device includes multiple service modules, each of which provides a corresponding service, and the modification of service parameters may be for one service module or two or more service modules at a time, that is, the service parameters will not be modified for all service modules. By setting the registration callback module 24, the service modules that need to be modified can be registered, so that the command processing module 22 knows which service modules need to be modified.
[0039] Furthermore, the registration callback module 24 receives the corresponding service parameters and commands parsed by the protocol parsing module 23, and then searches for the corresponding execution command and callback function according to the service parameters and commands, and registers the found execution command and callback function in the command processing module 22, so that the command processing module 22 executes parameter modification in the callback function and obtains the processing result as a feedback result.
[0040] Furthermore, a command lookup table is pre-stored on the service deployment device, and the command lookup table includes the correspondence between the service module, service parameters, execution command and callback function. The category of the service parameter is designed according to the modifiable service parameter item set by the server, and the category of the service parameter is associated with the service module, and then associated with the corresponding execution command and callback function. In this way, when the service parameters need to be modified, the corresponding service parameter modification instruction is input based on the set instruction format. The registration callback module 24 of the server can find the matching execution command and callback function from the command lookup table based on the service module and service parameters in the service parameter modification instruction, and then send the execution command and callback function to the command processing module for registration and recording, and the command processing module executes the parameter modification.
[0041] In a specific embodiment of the present invention, the system for dynamically setting service parameters based on CLI of the present invention also includes an access permission judgment module installed on the service deployment device, which is used to judge the access permission of the access request, and allow access when it is judged that there is access permission.
[0042] When users modify service parameters, they need to access the service deployment device and send an access request to the service deployment device. The access permission judgment module on the service deployment device can judge the permission of the access request and allow authorized users to access. For users without permission, access is denied. In this way, the modification permission is limited to the local machine (service deployment device), and only the local machine can be used to modify the service parameters, which can ensure the security of data.
[0043] Preferably, an access-allowed account table is provided on the service deployment device, and the access request sent by the user includes the user's account. The service deployment device determines whether the user's account is in the access-allowed account table. If so, it indicates that the user has permission, and if not, it indicates that the user does not have permission.
[0044] In a specific implementation of the present invention, a user accesses the service deployment device by remote login, and can then perform corresponding manipulations on the service deployment device to modify service parameters.
[0045] In a specific implementation of the present invention, the command processing module 22 sends the feedback result to the CLI 21, and the CLI 21 displays the feedback result on the interface, so that the user can easily know whether the service parameters are modified successfully.
[0046] In a specific embodiment of the present invention, when CLI21 is installed on a service deployment device, a command completion function key is configured for CLI21. The command completion function key is associated with the Tab key on the keyboard. When the user enters a command, if he does not remember the entire content of the command, he can first enter part of the command and then press the Tab key. A list of available commands will be displayed on the interface of CLI21 to help the user complete the command.
[0047] Specifically, a command list is pre-stored in the CLI 21, and the command list includes all modification commands. After the user presses the Tab key, the command completion function key searches the command list using the partial command input by the user, and displays the relevant commands in the command list for the user to select.
[0048] Furthermore, CLI21 is also equipped with a history command switching function key, which is associated with the up and down keys on the keyboard. When the user presses the up key or the down key, a history command list is displayed, and then the corresponding history command is selected by the up and down keys. The history command is the command input by the user. Specifically, the command input by the user is recorded and stored to form a history command list, and the history command list is called by the up and down keys to realize the rapid selection of history commands as new command input.
[0049] The present invention also provides a method for dynamically setting service parameters based on CLI, which is described below.
[0050] like Figure 2 As shown, the method for dynamically setting service parameters based on CLI of the present invention comprises the following steps:
[0051] Execute step S11 to access the service deployment device; then execute step S12;
[0052] Execute step S12, run the CLI on the service deployment device and input the service parameter modification instruction; then execute step S13;
[0053] Step S13 is executed to send the service parameter modification instruction to the server on the service deployment device so that the server executes the service parameter modification instruction, and receive feedback results from the server.
[0054] The present invention runs a CLI on a service deployment device, inputs a service parameter modification instruction in the CLI interface, realizes the modification of service parameters without restarting the service, improves efficiency, and also avoids the waste of resources generated by polling configuration files. When modifying service parameters, it is achieved by accessing the service deployment device, and the modification authority can be limited to the service deployment device, which can ensure the security of data.
[0055] In a specific implementation of the present invention, a communication link is established between the CLI and the server; and a service parameter modification instruction is sent to the server via the CLI.
[0056] Preferably, the CLI 21 and the server use http protocol or websocket protocol for communication link.
[0057] In a specific implementation of the present invention, after receiving the service parameter modification instruction, the server parses the service parameter modification instruction, obtains the corresponding service parameters and commands, and executes them.
[0058] In a specific implementation of the present invention, when the server obtains the corresponding service parameters and commands, it registers the service module corresponding to the obtained service parameters and commands;
[0059] Modify the service parameters of the registered service model and return the feedback results to the CLI.
[0060] In a specific embodiment of the present invention, it also includes:
[0061] Set access permissions on the service deployment device;
[0062] When receiving an access request, the service deployment device determines the access permission of the received access request, and allows access when it is determined that the access permission is granted.
[0063] Specifically, an access-allowed account table is set on the service deployment device. The access request sent by the user includes the user's account. The service deployment device determines whether the user's account is in the access-allowed account table. If it is, it indicates that the user has permission. If not, it indicates that the user does not have permission.
[0064] The present invention is described in detail above in conjunction with the embodiments of the accompanying drawings. A person skilled in the art can make various variations of the present invention according to the above description. Therefore, certain details in the embodiments should not constitute a limitation of the present invention, and the scope of protection of the present invention shall be defined by the scope of the attached claims.
Claims
1. A method for dynamically setting service parameters based on CLI, characterized in that: The steps include: Access service deployment equipment; Run the CLI on the service deployment device and enter a service parameter modification instruction, and enter a corresponding instruction code through a keyboard in the CLI interface to form a service parameter modification instruction; as well as Sending the service parameter modification instruction to the server on the service deployment device so that the server executes the service parameter modification instruction, and receiving feedback results from the server; Establishing a communication link between the CLI and the server; Sending the service parameter modification instruction to the server through the CLI; After receiving the service parameter modification instruction, the server parses the service parameter modification instruction, obtains corresponding service parameters and commands, and executes them; When the server obtains the corresponding service parameters and commands, it registers the service modules corresponding to the obtained service parameters and commands; Modify the service parameters of the registered service model and return the feedback result to the CLI; When obtaining the corresponding service parameters and commands, the corresponding execution command and callback function are searched according to the service parameters and commands, and the found execution command and callback function are registered, so that the parameter modification is executed in the callback function and the processing result is obtained as the feedback result; A command lookup table is pre-stored on the service deployment device, and the command lookup table includes the correspondence between the service module, the service parameter, the execution command and the callback function. The category of the service parameter is designed according to the modifiable service parameter items set by the server, and the category of the service parameter is associated with the service module, and then associated with the corresponding execution command and callback function; When installing the CLI on the service deployment device, configure a command completion function key for the CLI. The command completion function key is associated with the Tab key on the keyboard. A command list is pre-stored in the CLI, and the command list includes all modification commands; The CLI is also configured with a history command switching function key, which is associated with the up and down keys on the keyboard. When the user presses the up or down key, the history command list is displayed, and then the corresponding history command is selected through the up and down keys.
2. The method for dynamically setting service parameters based on CLI according to claim 1, characterized in that: Also includes: Setting access permissions on the service deployment device; When receiving an access request, the service deployment device determines the access permission of the received access request, and allows access when it is determined that the access permission is granted.
3. A system for dynamically setting service parameters based on CLI, characterized in that: include: The CLI installed on the service deployment device is used to receive input service parameter modification instructions; as well as A command processing module installed on the server side of the service deployment device, the command processing module is used to receive and execute the service parameter modification instruction sent by the CLI, and then form a feedback result to the CLI; Establishing a communication link between the CLI and the server; It also includes a protocol parsing module installed on the server, the protocol parsing module is connected to the command processing module, and the protocol parsing module is used to parse the service parameter modification instruction and obtain corresponding service parameters and commands, and then send the obtained service parameters and commands to the command processing module; It also includes a registration callback module, which is connected to the protocol parsing module and the command processing module and is used to register the acquired service parameters and the service module in the command, so that the command processing module modifies the service parameters of the registered service module; The registration callback module receives the corresponding service parameters and commands parsed by the protocol parsing module, and then searches for the corresponding execution command and callback function according to the service parameters and commands, and registers the found execution command and callback function to the command processing module, so that the command processing module executes parameter modification in the callback function and obtains the processing result as the feedback result; A command lookup table is pre-stored on the service deployment device, and the command lookup table includes the correspondence between the service module, the service parameter, the execution command and the callback function. The category of the service parameter is designed according to the modifiable service parameter items set by the server, and the category of the service parameter is associated with the service module, and then associated with the corresponding execution command and callback function; When installing the CLI on the service deployment device, configure a command completion function key for the CLI. The command completion function key is associated with the Tab key on the keyboard. A command list is pre-stored in the CLI, and the command list includes all modification commands; The CLI is also configured with a history command switching function key, which is associated with the up and down keys on the keyboard. When the user presses the up or down key, the history command list is displayed, and then the corresponding history command is selected through the up and down keys.
4. The system for dynamically setting service parameters based on CLI as claimed in claim 3, characterized in that: It also includes an access permission judgment module installed on the service deployment device, which is used to judge the access permission of the access request, and allow access when it is judged that the access permission is granted.
