A method for modifying parameter configuration

Through annotations and reflection analysis, Jedis module operation and timing task repair methods, the problem of modifying the Redis cluster parameter configuration on the cloud computing platform is solved, and the parameter matching efficiency and code reuse are improved, ensuring the repair of the parameters and the user of the user Experience.

CN112256323BActive Publication Date: 2025-01-28SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011169760.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-28
Publication Date
2025-01-28
Estimated Expiration
2040-10-28

AI Technical Summary

Technical Problem

There are technical difficulties in modifying the parameter configuration of Redis cluster on cloud computing platforms, especially in the case of multiple nodes, parameter item modification failed due to network partitioning or network, and the existing technology is difficult to efficiently handle the conversion of camel naming and actual parameter item names.

Method used

Through annotations and reflection analysis, the analysis processing of the parameter items is used to operate the Redis instance with the JEDIS module, the timing task module is repaired to modify the parameters of the failure, and the conversion of the hump naming and the actual parameter name of the real parameter item is used to customize the annotation and parser.

Benefits of technology

The matching efficiency of the parameter item and the instance type has been improved, and the problem of dynamic modification configuration items is solved. The timing task system ensures the repair of the parameter items under the condition of multiple Redis nodes, which improves code reuse and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112256323B_ABST
    Figure CN112256323B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of Java / cloud database technology, and specifically provides a method for modifying parameter configuration, which has the following steps: S1, annotation and reflection parsing, to implement parsing processing of parameter items; S2, Jedis module to implement operations on redis instances; S3, timing task module to repair parameter items that failed to be modified. Compared with the prior art, the present invention improves the conversion efficiency between camel case named parameter items and actual parameter item names and solves the matching of modifiable parameters and instance types, and has good promotion value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Java / cloud databases, and specifically provides a method for modifying parameter configuration. Background Art

[0002] Annotations are used to add metadata to Java code, which can be parsed and processed at compile time or runtime. Java code can be package names, classes, methods, member variables, parameters, etc., and the attached metadata will not affect the execution of the source code. Custom annotations, that is, defining annotations and annotation parsers according to your own needs, can achieve functional requirements with a small amount of code. The three elements of annotation implementation are: 1. Annotation declaration, 2. Use of annotation elements, and 3. Operation of annotations to make them work (annotation processor). Among them, the annotation processor is the core.

[0003] The JAVA reflection mechanism is that in the running state, for any class, all the properties and methods of this class can be known; for any object, any of its methods and properties can be called; this function of dynamically obtaining information and dynamically calling object methods is called the reflection mechanism of the Java language.

[0004] Jedis is the Java connection development tool officially recommended by Redis. You can use Jedis to operate Redis. Redis supports many parameters, most of which have default values. By modifying the values ​​of parameter items, you can achieve reasonable configuration of parameters, so that Redis can better meet business needs and perform performance tuning.

[0005] As an in-memory database, Redis has the characteristics of high performance, simple structure, and complete related tools. It is increasingly used in various Internet projects and has become an essential component of major portals and mobile Internet apps. With the rise of cloud computing in recent years, a large number of Redis databases have been migrated from local to cloud computing platforms and become cloud databases. However, due to the special technical architecture of cloud computing platforms, modifying the configuration parameters of cloud database Redis clusters has become a new technical difficulty. Summary of the invention

[0006] The present invention aims at solving the above-mentioned deficiencies of the prior art and provides a method for modifying parameter configuration with strong practicability.

[0007] The technical solution adopted by the present invention to solve the technical problem is:

[0008] A method for modifying parameter configuration, characterized in that it has the following steps:

[0009] S1, annotation and reflection parsing, to achieve parsing of parameter items;

[0010] S2, Jedis module implements the operation of redis instance;

[0011] S3. The scheduled task module repairs the parameter items that failed to be modified.

[0012] Furthermore, in step S1, a redis parameter value annotation is customized, the value of the annotation is the actual value of the parameter item, and the conversion of the name of each parameter item is implemented through the annotation parser.

[0013] Furthermore, by customizing an instance type annotation, the value of this annotation is an array that contains the types supported by this parameter item. If you need to add a new instance type, you only need to modify the value of the annotation, and the business code does not need to be changed.

[0014] Furthermore, when the user modifies the parameters, the backend application sends the modified parameters one by one to the annotation and reflection analysis in step S1 to parse the parameter items. First, it is determined whether the parameter item is modified by the instance type. If it belongs to the instance type, it can be modified; if it does not belong to the instance type, the step of modifying the parameter item is skipped, and each parameter item is parsed through annotation.

[0015] Furthermore, in step S2, when modifying according to the node, the backend application will judge the modification result of each parameter item of each node operated by the jedis module. If the modification of the parameter item of the node fails, a scheduled task will be immediately registered for the parameter item of the node to repair it;

[0016] If the modification is successful, the next parameter item of the node is modified. If all the parameter items of this node have been modified, the parameter items of the next node are modified until all the nodes are modified.

[0017] Furthermore, in step S3, when a node of the instance cannot be connected due to network partition or network reasons, the scheduled task module will register a scheduled task for this parameter item of this node. When the network of the node of this instance returns to normal, it will be repaired through the execution of the scheduled task.

[0018] Furthermore, there is a situation where the user repeatedly modifies the value of the parameter setting within a short period of time. If the modification of the parameter item fails, the user sets it again. If it succeeds, the modification status of the previous parameter of the instance will be changed from failure to success.

[0019] Furthermore, when the redis instances of multiple nodes modify parameter configurations in step S2, each parameter setting record is stored in the database according to the same time, thereby achieving deduplication of parameter modification display records when the parameter configuration items are modified multiple times.

[0020] Compared with the prior art, the method for modifying parameter configuration of the present invention has the following outstanding beneficial effects:

[0021] (1) In terms of practicality, the conversion efficiency between camelCase named parameter items and actual parameter item names is improved, and the matching between modifiable parameters and instance types is solved.

[0022] (2) The problem of dynamically modifying configuration items is solved.

[0023] (3) The scheduled task system is used to solve the problem of how to repair the failure of modifying parameter items in the case of multiple Redis nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0025] Attached Figure 1 It is a flowchart of a method for modifying parameter configuration. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] A best embodiment is given below:

[0028] like Figure 1 As shown, a method for modifying parameter configuration in this embodiment has the following steps:

[0029] S1, annotation and reflection parsing, to achieve parsing of parameter items;

[0030] S2, Jedis module implements the operation of redis instance;

[0031] S3. The scheduled task module repairs the parameter items that failed to be modified.

[0032] There are many parameter items in Redis. For example, hash-max-ziplist-entries, the words are basically separated by "-". The development specifications in JAVA are all camel case naming in the industry, so we name this parameter item hashMaxZiplistEntries in java. Therefore, when modifying the redis parameter item through the jedis module, it is necessary to process the conversion between the java naming and the actual parameter item naming. When users modify parameter items, they often modify multiple parameter items. If the efficiency of processing parameter item name parsing is too low, it will affect the user experience.

[0033] We use annotation and reflection methods to handle this. We customize a redis parameter value annotation, the value of the annotation is the actual value of this parameter item, and the annotation parser is used to implement the conversion of each parameter item name.

[0034] Due to the different instance types, Redis parameter items currently provide three types: stand-alone, master-slave, and cluster. New types may be provided in the future. How to bind parameter items and instance types is also a point that needs to be considered. You cannot change a lot of code just because you add a new instance type. Therefore, by customizing an instance type annotation, the value of this annotation is an array that contains the types supported by this parameter item. If you need to add a new instance type, you only need to modify the value of the annotation, and the business code does not need to change, which greatly improves future response changes and improves code reusability.

[0035] When the user modifies the parameters, the backend application sends the modified parameters one by one to the annotation and reflection template for parameter item parsing. First, it determines whether the parameter item can be modified by the instance type. If it belongs to the instance type, it can be modified. If it does not belong to the instance type, the parameter item modification step is skipped, and then each parameter item is parsed through annotations.

[0036] Modify by node. When all the parameters that need to be modified for a node have been modified, modify the parameters of the second node. During the modification process, the backend application will judge the modification results of each parameter item of each node operated by the jedis module. If the modification of the parameter item of the node fails, a scheduled task will be registered for the parameter item of this node immediately to repair it. If the modification is successful, modify the next parameter item of the node. If all the parameters of this node have been modified, modify the parameters of the next node until all nodes are modified. By looping the redis node and operating the instance through the jedis module, high code execution efficiency is achieved regardless of whether it is one node or multiple nodes.

[0037] Because there may be network partitions or a node of the instance cannot be connected due to network reasons, the scheduled task module will register a scheduled task for this parameter item of this node. When the network of the node of this instance returns to normal, it will be repaired through the execution of the scheduled task, ensuring that the parameter values ​​of multiple nodes of an instance are consistent.

[0038] When setting parameters, users may modify the values ​​repeatedly within a short period of time. If the parameter modification fails and the user sets it again, if it succeeds, the instance's previous parameter modification status will be changed from failure to success, thus preventing the user's latest modification result from being overwritten during the scheduled task repair process.

[0039] When modifying the parameter configuration of a multi-node redis instance, each parameter setting record is stored in the database according to the same time, so that the parameter modification display record can be deduplicated when the parameter configuration items are modified multiple times. The display logic is as follows: if a parameter item of a node fails to be modified in the modification setting, the parameter item of the instance is displayed as failed, otherwise it is displayed as successful. The target value is displayed for successful modification, and the original value is displayed for failed modification.

[0040] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any appropriate changes or substitutions made by any ordinary technician in the technical field that conform to the claims of a method for modifying parameter configuration of the present invention shall fall within the patent protection scope of the present invention.

[0041] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for modifying parameter configuration, characterized in that: The steps are as follows: S1, annotation and reflection parsing, to achieve parsing of parameter items; By customizing a redis parameter value annotation, the value of the annotation is the actual value of this parameter item, and the conversion of each parameter item name is implemented through the annotation parser; By customizing an instance type annotation, the value of this annotation is an array that contains the types supported by this parameter item. If you need to add a new instance type, you only need to modify the value of the annotation without changing the business code; When the user modifies the parameters, the backend application sends the modified parameters one by one to the annotation and reflection parsing to parse the parameter items. First, it determines whether the parameter item is modified by the instance type. If it is, it can be modified. If it is not, the parameter item modification step is skipped and each parameter item is parsed through annotations. S2, Jedis module implements the operation of redis instance; When modifying according to the node, the backend application will judge the modification result of each parameter item of each node operated by the Jedis module. If the modification of the parameter item of the node fails, a scheduled task will be registered immediately for the parameter item of the node to repair it; If the modification is successful, the next parameter item of the node is modified. If all the parameter items of this node have been modified, the parameter items of the next node are modified until all the nodes are modified. When modifying the parameter configuration of multi-node redis instances, each parameter setting record is stored in the database according to the same time, so that when the parameter configuration items are modified multiple times, the parameter modification display records can be deduplicated; S3. The scheduled task module repairs the parameter items that failed to be modified; When a node of an instance cannot be connected due to network partition or network reasons, the scheduled task module will register a scheduled task for this parameter item of this node. When the network of the node of this instance returns to normal, it will be repaired through the execution of the scheduled task. There is a situation where the user repeatedly modifies the parameter value in a short period of time. If the parameter modification fails and the user sets it again, if it succeeds, the modification status of the instance's previous parameter will be changed from failure to success.

Citation Information

Patent Citations

  • Method, device, equipment and storage medium for obtaining parameter name and local variable name

    CN108628635A