Redis component high-availability evaluation and high-availability access method, system, equipment and medium

Through Redis cluster deployment, automated backup, performance tuning and fuse mechanisms, the shortcomings of Redis components in high availability evaluation and access are solved, fault prevention and business continuity are achieved, and the stability and efficiency of the system are improved. .

CN119210994APending Publication Date: 2024-12-27INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411219257.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing technology has shortcomings in the high availability evaluation and high availability access of Redis components, resulting in the Redis components running in stand-alone mode, easy to lose cache data, lack of clustered deployment solutions, irregular data backup, insufficient performance tuning, The security configuration does not meet the standards, there are problems with the use of the current limiting mechanism, and the mutex and fuse mechanism are not implemented, resulting in system failures and safety hazards.

Method used

Adopt Redis cluster deployment, automated and timed data backup, rational configuration of performance parameters, achieve uniform settings of data expiration time, support mutex and fuse mechanism, and real-time monitoring of operating status, avoid failures through fuse or current limit mechanisms to ensure business Continuity.

Benefits of technology

Effectively predict and prevent possible Redis failures, avoid system failures, ensure business continuity and high availability, improve the stability and use efficiency of Redis components, and reduce operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119210994A_ABST
    Figure CN119210994A_ABST
Patent Text Reader

Abstract

The invention discloses a Redis component high-availability evaluation and high-availability access method, system and equipment and a medium, belongs to the technical field of Redis components, and aims to solve the technical problems of how to pre-judge related faults possibly occurring in Redis in advance and take corresponding prevention measures so as to avoid system faults as much as possible, and meanwhile, even if the faults occur, the Redis component high-availability evaluation and high-availability access method and system can be used for evaluating the Redis component high-availability evaluation and high-availability access. According to the technical scheme, the method comprises the following steps: Redis clustering deployment: adopting Redis clustering deployment, and providing a deployment source of a document; data backup and recovery: starting automatic and timed backup of Redis, performing backup of Redis cache data through custom time, and persisting the backup data to a disk, so as to facilitate data recovery through system re-backup when a system fault occurs; the performance of the Redis assembly is adjusted and optimized; setting expiration time of Redis related data; a mutual exclusion lock mechanism of Redis is supported; a fusing mechanism of Redis is supported; the running state of the Redis and related index data are monitored in real time, and the continuity of services is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Redis components, and in particular to a method, system, device and medium for high-availability evaluation and high-availability access of Redis components. Background Art

[0002] In today's society, with the advancement of science and technology, the development of human civilization, and the popularization of Integer interconnection and sharing technology, the Internet has penetrated into every corner of today's society and has become an indispensable part of people's daily life. People's lives, the development of enterprises, and the progress of society are inseparable from Internet technology and are closely related to the Internet. The transformation of traditional technologies, the development of paperless technologies, and the mass construction of information systems are in full swing and unstoppable. In order to improve the system response speed, facilitate access, and quickly read and write processed data, the Redis memory database is about to emerge! Redis is an open source memory database that has many functions and uses, with fast reading and writing and rich data structures. The designers of Redis have designed many modes to ensure its stable operation. It can achieve its own high availability and horizontal expansion through master-slave replication, sentinel mode, cluster mode, etc. However, as a highly available component, how to evaluate the high availability of Redis components and how to access them with high availability has become an imminent issue.

[0003] High availability assessment and high availability access of Redis components refer to the scientific and standardized assessment of whether the current status of Redis components involved in the system is highly available in the actual business production system, and the cluster deployment, performance tuning, security access configuration, fuse mechanism, high availability assessment, configuration and access of Redis components when accessing Redis components. When accessing Redis components in the system, focus on all aspects of Redis access, make detailed plans and configurations from aspects such as Redis high availability architecture design, data backup and recovery, performance tuning, and security configuration, and evaluate whether the current Redis components are highly available to avoid system failures caused by access in the traditional stand-alone mode. At present, there are still some deficiencies in the high availability evaluation and high availability access methods of the IT system for Redis components, such as: the Redis component runs on a single machine, cached data is easily lost, there is no complete cluster deployment plan, there is no regular data backup, no data access tuning, security configuration does not meet the standards, there are problems with the use of the Redis current limiting mechanism, the mutual exclusion lock mechanism is not implemented, the data expiration time is not set reasonably, and the fuse mechanism is not supported. All of the above factors will lead to the failure of high availability access to the Redis component, and indirectly leave system security risks.

[0004] Therefore, how to predict possible Redis-related failures in advance and take corresponding preventive measures to avoid system failures as much as possible, while ensuring business continuity even if a failure occurs, is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The technical task of the present invention is to provide a Redis component high-availability evaluation and high-availability access method, system, device and medium to solve the problem of how to predict possible Redis related failures in advance and take corresponding preventive measures to avoid system failures as much as possible, while ensuring business continuity even if a failure occurs.

[0006] The technical task of the present invention is achieved in the following way: a high availability evaluation and high availability access method for Redis components, the method is as follows:

[0007] Redis cluster deployment: Use Redis cluster deployment and provide document deployment source;

[0008] Data backup and recovery: Enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup.

[0009] Redis component performance tuning: By configuring various parameters of Redis in a reasonable and high-performance manner, the access efficiency of Redis cache data can be improved, and high-availability use and high-availability access of Redis can be achieved;

[0010] Implement the expiration time setting for Redis related data: except for the keys of static data and hot data which never expire, the expiration time of the keys of other business data should be evenly distributed to avoid a large number of keys expiring at the same time, which would cause a Redis avalanche;

[0011] Support for Redis's mutex lock mechanism: Although the use of mutex locks can easily solve the cache breakdown problem, requests that do not obtain locks are queued, which affects system performance. Another way to solve cache breakdown is to redundantly add an expiration time to the business data. For example, add an expire_at field to the data to indicate the data expiration time.

[0012] Support for Redis's circuit breaker mechanism: The circuit breaker mechanism is a mechanism used to handle failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response, thereby avoiding cascading failures and resource exhaustion.

[0013] Real-time monitoring of Redis's operating status and related indicator data to ensure business continuity: The system monitors Redis's operating status and performance indicators to promptly detect abnormal situations and predict the possibility of failures. According to the Redis system access requirements, once an abnormality is detected, the system will have a certain self-protection capability to avoid failures through means such as circuit breaking or current limiting to ensure business continuity.

[0014] As a preferred option, the Redis cluster deployment is as follows:

[0015] For related systems that can be moved to the cloud center, the cloud center Redis is preferred;

[0016] For self-built Redis cluster deployment, it is recommended to use cluster deployment, a multi-master and multi-slave distributed deployment with replication, high availability and sharding features; among them, the cluster deployment has at least three master nodes.

[0017] As a preferred option, Redis's automated and scheduled backup includes RDB and AOF. RDB is enabled by default, while AOF is disabled by default. It is recommended that both RDB and AOF be enabled at the same time.

[0018] Among them, RDB is used regularly for full cold backup of data, and AOF is used for data persistence.

[0019] As a preferred option, the parameters involved in Redis component performance tuning are as follows:

[0020] daemonize: Set whether Redis runs as a daemon process. The default value is no, and you can customize it to yes. When Redis runs as a daemon process, it runs in the background for a long time and will not be affected by the terminal session or user logout.

[0021] timeout: The timeout of the client connection. The default value is 0, which means no timeout. You need to confirm with the developer. If the business scenario has lower concurrent requests than the set requirements, the developed code basically has short connections. The timeout value is recommended to be set to 5-15 minutes. If the business scenario has higher concurrent requirements than the set requirements, the code uses a connection pool and the timeout is appropriately increased. 1-2 hours is recommended.

[0022] tcp-keepalive: a heartbeat detection of the access client, which is performed every n seconds. The default value of this configuration item is 300, which means 5 minutes. If the network environment is stable and the real-time and stability requirements of the connection are not high, it is recommended to turn it off. Otherwise, a non-zero positive integer in seconds needs to be set. It is recommended to set it to 5-10 minutes to avoid connection accumulation.

[0023] maxmemory: Set the maximum memory of Redis. The maximum memory of Redis is unlimited by default. When the memory is insufficient, it is easy to block the Redis process, thus affecting the overall performance. Therefore, a fixed value is configured according to the server configuration. The corresponding configuration item should not be configured too large. It is recommended to set maxmemory to about 70-80% of the available memory to leave some buffer space and memory for processing Redis internal operations;

[0024] lazy free: A new feature added in version 4.0, which provides asynchronous deletion function when deleting a key.

[0025] Preferably, the asynchronous deletion function corresponds to four scenarios and is disabled by default. The four scenarios are lazyfree-lazy-eviction no, lazyfree-lazy-expire no, lazyfree-lazy-server-del no, and replica-lazy-flush no.

[0026] Among them, lazyfree-lazy-eviction no: when the Redis running memory exceeds maxmemory, whether to enable the lazy free mechanism to delete;

[0027] lazyfree-lazy-expire no: Set the expiration time of the key, whether to enable the lazy free mechanism to delete;

[0028] lazyfree-lazy-server-del no: Whether to enable lazy free mechanism to delete when the command operates on an existing key. For commands containing del and rename keywords, if the target key is a big key, it will cause deletion blocking;

[0029] replica-lazy-flush no: When performing full data synchronization on the slave node, flushall is used to clean up the data before loading the RDB on the master node. The corresponding configuration is used to set whether to enable the lazy free mechanism to delete data in the corresponding scenario;

[0030] It is recommended to enable lazyfree-lazy-eviction no, lazyfree-lazy-expire no, and lazyfree-lazy-server-del no to effectively improve the execution efficiency of the main thread.

[0031] As a preferred method, the specific method for setting the expiration time of Redis related data is as follows:

[0032] On the basis of the original expiration time, a random expiration time is added, such as a random expiration time between 1 and 5 minutes, so as to avoid a large amount of cached data expiring at the same time.

[0033] Preferably, the specific steps to implement the expiration time setting of Redis related data are as follows:

[0034] First enter redis-cli. If a password is set, execute the command: redis-cli-ayourpassword;

[0035] Then execute the command: EXPIRE key_name randomNumber.

[0036] A Redis component high availability evaluation and high availability access system, the system is used to implement the Redis component high availability evaluation and high availability access method as described above; the system includes:

[0037] The deployment module is used to deploy using Redis clustering and provide the deployment source of the document;

[0038] The data backup and recovery module is used to enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup.

[0039] The tuning module is used to improve the access efficiency of Redis cache data by configuring various parameters of Redis in a reasonable and high-performance manner, so as to achieve high-availability use and high-availability access of Redis;

[0040] The setting module is used to set the expiration time of Redis related data. In addition to the keys of static data and hot data that never expire, the expiration time of the keys of other business data should be evenly distributed to avoid a large number of keys expiring at the same time, causing Redis avalanche;

[0041] Mutex mechanism module, used to support Redis's mutex mechanism: Although mutex can easily solve the cache breakdown problem, requests that do not obtain locks are queued, which affects the system performance. Another way to solve cache breakdown is to add an expiration time to the business data. For example, add an expire_at field to the data to indicate the data expiration time.

[0042] Circuit breaker mechanism, used to support Redis's circuit breaker mechanism. The circuit breaker mechanism is a mechanism for handling failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response, thereby avoiding cascading failures and resource exhaustion;

[0043] The real-time monitoring module is used to monitor the operating status of Redis and related indicator data in real time to ensure the continuity of business. That is, the system monitors the operating status and performance indicators of Redis to promptly detect abnormal situations and predict the possibility of failures. According to the access requirements of the Redis system, once an abnormality is detected, the system will have a certain self-protection capability to avoid failures through means such as fuses or current limiting to ensure business continuity.

[0044] An electronic device comprising: a memory and at least one processor;

[0045] Wherein, the memory stores a computer program;

[0046] The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the above-mentioned Redis component high availability evaluation and high availability access method.

[0047] A computer-readable storage medium stores a computer program, which can be executed by a processor to implement the high-availability evaluation and high-availability access method of Redis components as described above.

[0048] The Redis component high availability evaluation and high availability access method, system, device and medium of the present invention have the following advantages:

[0049] (1) The present invention ensures the stability and high availability of the business system using Redis middleware, and provides detailed specifications from aspects such as Redis high-availability architecture design, data backup and recovery, performance tuning, and security configuration;

[0050] (ii) The present invention predicts possible related failures of Redis in advance and takes corresponding preventive measures to avoid system failures as much as possible; at the same time, when a failure actually occurs, the document also provides rapid recovery tools and methods to minimize the impact of the failure on the business and ensure business continuity;

[0051] (III) High availability evaluation of various aspects of IT systems, including IaaS layer, DaaS layer, PaaS layer, SaaS layer, etc., involved in the present invention, and realizing high availability access from aspects such as Redis high availability architecture design, data backup and recovery, performance tuning, and security configuration;

[0052] (iv) The present invention is applicable to the access of Redis components of various systems and businesses, and this evaluation method can be used to perform standardized evaluation on the current usage status of Redis components, whether they are highly available, etc.;

[0053] (V) The present invention forms standardized access guidance for the access of Redis components, which can greatly improve the use efficiency of the Redis components involved in the system, perfectly abandon the various defects of the traditional stand-alone mode, help customers save related operation and maintenance costs, prevent and avoid system-related failures, ensure the continuity of business data, keep up with the development trend of Internet technology, and improve the quality and efficiency of IT systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The present invention is further described below in conjunction with the accompanying drawings.

[0055] Attached Figure 1 This is a schematic diagram of the overall architecture of Redis cluster deployment;

[0056] Attached Figure 2 A scenario for using the Redis component. DETAILED DESCRIPTION

[0057] The Redis component high availability evaluation and high availability access method, system, device and medium of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.

[0058] Embodiment 1:

[0059] This embodiment provides a method for high availability evaluation and high availability access of a Redis component, which is specifically as follows:

[0060] S1. Redis cluster deployment: Use Redis cluster deployment to provide the deployment source of the document;

[0061] S2, data backup and recovery: Enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup.

[0062] S3 and Redis component performance tuning: By configuring various parameters of Redis in a reasonable and high-performance manner, the access efficiency of Redis cache data can be improved, and high-availability use and high-availability access of Redis can be achieved;

[0063] S4. Set the expiration time of Redis related data: except for the keys of static data and hot data that never expire, the expiration time of the keys of other business data should be evenly distributed to avoid a large number of keys expiring at the same time, which would cause a Redis avalanche.

[0064] S5. Support for Redis's mutex lock mechanism: Although the use of mutex locks can easily solve the cache breakdown problem, requests that do not obtain locks are queued, which affects system performance. Another way to solve cache breakdown is to add an expiration time to the business data. For example, add an expire_at field to the data to indicate the data expiration time.

[0065] S6. Support for Redis's circuit breaker mechanism: The circuit breaker mechanism is a mechanism used to handle failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response, thereby avoiding cascading failures and resource exhaustion.

[0066] S7. Real-time monitoring of Redis's operating status and related indicator data to ensure business continuity: The system monitors Redis's operating status and performance indicators to promptly detect abnormal situations and predict the possibility of failures. According to the Redis system access requirements, once an abnormality is detected, the system will have a certain self-protection capability to avoid failures through means such as circuit breaking or current limiting to ensure business continuity.

[0067] As attached Figure 1 As shown, the Redis cluster deployment in step S1 of this embodiment is as follows:

[0068] For related systems that can be moved to the cloud center, the cloud center Redis is preferred;

[0069] For self-built Redis cluster deployment, it is recommended to use cluster deployment, multi-master and multi-slave distributed deployment, with replication, high availability and sharding features; among them, cluster deployment has at least three master nodes.

[0070] The automated and scheduled backup of Redis in step S2 of this embodiment includes two modes: RDB and AOF. RDB is started by default, and AOF is not started by default. It is recommended to start both RDB and AOF at the same time.

[0071] Among them, RDB is used regularly for full cold backup of data, and AOF is used for data persistence.

[0072] The parameters involved in the performance tuning of the Redis component in step S3 of this embodiment are as follows:

[0073] daemonize: Set whether Redis runs as a daemon process. The default value is no, and you can customize it to yes. When Redis runs as a daemon process, it runs in the background for a long time and will not be affected by the terminal session or user logout.

[0074] timeout: The timeout of the client connection. The default value is 0, which means no timeout. You need to confirm with the developer. If the business scenario has lower concurrent requests than the set requirements, the developed code basically has short connections. The timeout value is recommended to be set to 5-15 minutes. If the business scenario has higher concurrent requirements than the set requirements, the code uses a connection pool and the timeout is appropriately increased. 1-2 hours is recommended.

[0075] tcp-keepalive: a heartbeat detection of the access client, which is performed every n seconds. The default value of this configuration item is 300, which means 5 minutes. If the network environment is stable and the real-time and stability requirements of the connection are not high, it is recommended to turn it off. Otherwise, a non-zero positive integer in seconds needs to be set. It is recommended to set it to 5-10 minutes to avoid connection accumulation.

[0076] maxmemory: Set the maximum memory of Redis. The maximum memory of Redis is unlimited by default. When the memory is insufficient, it is easy to block the Redis process, thus affecting the overall performance. Therefore, a fixed value is configured according to the server configuration. The corresponding configuration item should not be configured too large. It is recommended to set maxmemory to about 70-80% of the available memory to leave some buffer space and memory for processing Redis internal operations;

[0077] lazy free: A new feature added in version 4.0, which provides asynchronous deletion function when deleting a key.

[0078] The asynchronous deletion function in this embodiment corresponds to four scenarios and is disabled by default. The four scenarios are lazyfree-lazy-eviction no, lazyfree-lazy-expire no, lazyfree-lazy-server-del no, and replica-lazy-flush no.

[0079] Among them, lazyfree-lazy-eviction no: when the Redis running memory exceeds maxmemory, whether to enable the lazy free mechanism to delete;

[0080] lazyfree-lazy-expire no: Set the expiration time of the key, whether to enable the lazy free mechanism to delete;

[0081] lazyfree-lazy-server-del no: Whether to enable lazy free mechanism to delete when the command operates on an existing key. For commands containing del and rename keywords, if the target key is a big key, it will cause deletion blocking;

[0082] replica-lazy-flush no: When performing full data synchronization on the slave node, flushall is used to clean up the data before loading the RDB on the master node. The corresponding configuration is used to set whether to enable the lazy free mechanism to delete data in the corresponding scenario;

[0083] It is recommended to enable lazyfree-lazy-eviction no, lazyfree-lazy-expire no, and lazyfree-lazy-server-del no to effectively improve the execution efficiency of the main thread.

[0084] The specific method for setting the expiration time of Redis related data in step S4 of this embodiment is as follows:

[0085] On the basis of the original expiration time, a random expiration time is added, such as a random expiration time between 1 and 5 minutes, so as to avoid a large amount of cached data expiring at the same time.

[0086] The specific steps for setting the expiration time of Redis related data in step S4 of this embodiment are as follows:

[0087] First enter redis-cli. If a password is set, the command to execute is: redis-cli-ayourpassword;

[0088] Then execute the command: EXPIRE key_name randomNumber.

[0089] Embodiment 2:

[0090] This embodiment provides a Redis component high availability evaluation and high availability access system, which is used to implement the Redis component high availability evaluation and high availability access method in Embodiment 1; the system includes:

[0091] The deployment module is used to deploy using Redis clustering and provide the deployment source of the document;

[0092] The data backup and recovery module is used to enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup.

[0093] The tuning module is used to improve the access efficiency of Redis cache data by configuring various parameters of Redis in a reasonable and high-performance manner, so as to achieve high-availability use and high-availability access of Redis;

[0094] The setting module is used to set the expiration time of Redis related data. In addition to the keys of static data and hot data that never expire, the expiration time of the keys of other business data should be evenly distributed to avoid a large number of keys expiring at the same time, causing Redis avalanche;

[0095] Mutex mechanism module, used to support Redis's mutex mechanism: Although mutex can easily solve the cache breakdown problem, requests that do not obtain locks are queued, which affects the system performance. Another way to solve cache breakdown is to add an expiration time to the business data. For example, add an expire_at field to the data to indicate the data expiration time.

[0096] Circuit breaker mechanism, used to support Redis's circuit breaker mechanism. The circuit breaker mechanism is a mechanism for handling failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response, thereby avoiding cascading failures and resource exhaustion;

[0097] The real-time monitoring module is used to monitor the operating status of Redis and related indicator data in real time to ensure the continuity of business. That is, the system monitors the operating status and performance indicators of Redis to promptly detect abnormal situations and predict the possibility of failures. According to the access requirements of the Redis system, once an abnormality is detected, the system will have a certain self-protection capability to avoid failures through means such as fuses or current limiting to ensure business continuity.

[0098] As attached Figure 2 As shown in the figure, a scenario in which the Redis component is used, the working process is as follows:

[0099] ① Use packet capture tools to collect switch mirror data;

[0100] ②Original collection data queue;

[0101] ③Analysis of original collected data;

[0102] ④Collect data queue after analysis;

[0103] ⑤After analysis, the data is uploaded to the statistical collection CT data collection layer.

[0104] Embodiment 3:

[0105] This embodiment also provides an electronic device, including: a memory and a processor;

[0106] Wherein, the memory stores computer-executable instructions;

[0107] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the Redis component high-availability evaluation and high-availability access method in any embodiment of the present invention.

[0108] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0109] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.

[0110] Embodiment 4:

[0111] This embodiment also provides a computer-readable storage medium, which stores a plurality of instructions, which are loaded by a processor, so that the processor executes the Redis component high availability evaluation and high availability access method in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0112] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0113] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0114] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0115] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A Redis component high availability evaluation and high availability access method, characterized in that: The method is as follows: Redis cluster deployment: Use Redis cluster deployment and provide document deployment source; Data backup and recovery: Enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup. Redis component performance tuning: By configuring various parameters of Redis in a reasonable and high-performance manner, the access efficiency of Redis cache data can be improved, and high-availability use and high-availability access of Redis can be achieved; Implement the expiration time setting for Redis related data: except for the keys of static data and hot data which never expire, the expiration time of the keys of other business data should be evenly distributed; Support Redis's mutex lock mechanism; Support for Redis's circuit breaker mechanism: The circuit breaker mechanism is a mechanism used to handle failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response. Real-time monitoring of Redis's operating status and related indicator data to ensure business continuity: The system monitors Redis's operating status and performance indicators to promptly detect abnormal situations and predict the possibility of failures.

2. According to claim 1, the Redis component high availability evaluation and high availability access method is characterized in that: The Redis cluster deployment is as follows: For related systems that can be moved to the cloud center, the cloud center Redis is preferred; For self-built Redis cluster deployment, it is recommended to use cluster deployment, a multi-master and multi-slave distributed deployment with replication, high availability and sharding features; among them, the cluster deployment has at least three master nodes.

3. The Redis component high availability evaluation and high availability access method according to claim 1, characterized in that: Redis's automatic and scheduled backup includes two methods: RDB and AOF. RDB is enabled by default, while AOF is disabled by default. It is recommended to enable both RDB and AOF at the same time. Among them, RDB is used regularly for full cold backup of data, and AOF is used for data persistence.

4. The Redis component high availability evaluation and high availability access method according to claim 1, characterized in that: The parameters involved in Redis component performance tuning are as follows: daemonize: Set whether Redis runs as a daemon process. The default value is no, and you can customize it to yes. When Redis runs as a daemon process, it runs in the background for a long time and will not be affected by the terminal session or user logout. timeout: The timeout of the client connection. The default value is 0, which means no timeout. If the business scenario has a lower concurrent request requirement than the set requirement, the developed code basically has short connections. The timeout value is recommended to be set to 5-15 minutes. If the business scenario has a higher concurrent request requirement than the set requirement, the code uses a connection pool and the timeout is appropriately increased. 1-2 hours is recommended. tcp-keepalive: a heartbeat detection of the access client, which is performed every n seconds. The default value of this configuration item is 300, which means 5 minutes. If the network environment is stable and the real-time and stability requirements of the connection are not high, it is recommended to turn it off. Otherwise, a non-zero positive integer in seconds needs to be set. It is recommended to set it to 5-10 minutes to avoid connection accumulation. maxmemory: Set the maximum memory of Redis. The maximum memory of Redis is unlimited by default. When the memory is insufficient, it is easy to block the Redis process, thus affecting the overall performance. Therefore, according to the server configuration, configure a fixed value. It is recommended to set maxmemory to 70%-80% of the available memory for the corresponding configuration item; lazy free: A new feature added in version 4.0, which provides asynchronous deletion function when deleting a key.

5. The Redis component high availability evaluation and high availability access method according to claim 4, characterized in that: The asynchronous deletion function corresponds to four scenarios and is disabled by default. The four scenarios are lazyfree-lazy-eviction no, lazyfree-lazy-expire no, lazyfree-lazy-server-del no, and replica-lazy-flush no. Among them, lazyfree-lazy-eviction no: when the Redis running memory exceeds maxmemory, whether to enable the lazy free mechanism to delete; lazyfree-lazy-expire no: Set the expiration time of the key, whether to enable the lazy free mechanism to delete; lazyfree-lazy-server-delno: Whether to enable lazy free mechanism to delete when the command operates on an existing key. For commands containing del and rename keywords, if the target key is a big key, it will cause deletion blocking; replica-lazy-flush no: When performing full data synchronization on the slave node, flushall is used to clean up the slave's own data before loading the RDB on the master node. The corresponding configuration is used to set whether to enable the lazy free mechanism to delete data in the corresponding scenario.

6. The Redis component high availability evaluation and high availability access method according to claim 1, characterized in that: The specific method to implement the expiration time setting of Redis related data is as follows: A random expiration time is added to the original expiration time.

7. The Redis component high availability evaluation and high availability access method according to claim 1 or 6, characterized in that: The specific steps to implement the expiration time setting of Redis related data are as follows: First enter redis-cli. If a password is set, the command to execute is: redis-cli-ayourpassword; Then execute the command: EXPIRE key_name randomNumber.

8. A Redis component high availability evaluation and high availability access system, characterized in that: The system is used to implement the Redis component high availability evaluation and high availability access method as described in any one of claims 1 to 7; the system includes: The deployment module is used to deploy using Redis clustering and provide the deployment source of the document; The data backup and recovery module is used to enable automatic and scheduled backup of Redis, back up Redis cache data at a custom time, and persist the backup data to disk, so that in case of system failure, data can be restored through the system backup. The tuning module is used to improve the access efficiency of Redis cache data by configuring various parameters of Redis in a reasonable and high-performance manner, so as to achieve high-availability use and high-availability access of Redis; The setting module is used to implement the expiration time setting of Redis related data. In addition to the keys of static data and hot data that never expire, the expiration time of the keys of other business data should be evenly distributed; Mutex mechanism module, used to support Redis's mutex mechanism; Circuit breaker mechanism, used to support Redis's circuit breaker mechanism. The circuit breaker mechanism is a mechanism for handling failures and exceptions in distributed systems. By monitoring the status of external dependencies, when an external dependency fails or an exception occurs, the circuit breaker mechanism quickly interrupts the request to the corresponding dependency and returns a preset error response; The real-time monitoring module is used to monitor the operating status of Redis and related indicator data in real time to ensure the continuity of business. That is, the system monitors the operating status and performance indicators of Redis to promptly detect abnormal situations and predict the possibility of failures.

9. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the Redis component high availability evaluation and high availability access method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the Redis component high-availability evaluation and high-availability access method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Information storage method and device, server and medium

    CN112181869A

  • Data backup method and device, storage medium and electronic device

    CN115168101A

  • High-concurrency order ID design method under distributed architecture

    CN116308639A

  • Method for enhancing reliability of redis cluster service

    CN117827498A

  • Data sharing method and system in cluster and server

    CN117851456A