CN117692500A - Operation method, device, equipment and storage medium - Google Patents

Operation method, device, equipment and storage medium Download PDF

Info

Publication number
CN117692500A
CN117692500A CN202311693430.1A CN202311693430A CN117692500A CN 117692500 A CN117692500 A CN 117692500A CN 202311693430 A CN202311693430 A CN 202311693430A CN 117692500 A CN117692500 A CN 117692500A
Authority
CN
China
Prior art keywords
cluster
redis
client
configuration information
standby
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311693430.1A
Other languages
Chinese (zh)
Inventor
林锐明
王浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Bank Co Ltd
Original Assignee
China Merchants Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Merchants Bank Co Ltd filed Critical China Merchants Bank Co Ltd
Priority to CN202311693430.1A priority Critical patent/CN117692500A/en
Publication of CN117692500A publication Critical patent/CN117692500A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses an operation method, a device, equipment and a storage medium, wherein the operation method comprises the following steps: responding to a starting instruction, and acquiring configuration information; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. According to the method and the system, multiple different client types are provided, the Redis clients of the corresponding types are registered according to the data guarantee levels in the configuration information, and the Redis clients are operated according to the main and standby cluster information, so that a user can obtain the Redis high-guarantee clients of different guarantee levels through simple configuration, and the requirements of different use scenes can be met more flexibly.

Description

Operation method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an operation method, an apparatus, a device, and a storage medium.
Background
"cloud-up" refers to the migration of enterprise applications, data, and IT resources from a traditional local server or data center onto a cloud computing platform. With the continued maturation and popularity of cloud computing technologies, more and more enterprises are beginning to migrate applications, data, and IT resources onto cloud computing platforms. In the distributed deployment situation, in order to ensure the consistency and expandability of system data, a Redis component is introduced as a caching system of user session and information. However, redis positioning is a cache system, and part of the scenes do not allow users to start persistence, so that when abnormality such as Redis cluster node abnormality or network blocking abnormality occurs, higher use risks still face.
In order to provide a high-guarantee scheme, the reliability and availability of the network are improved by the existing method for modifying the service end route based on the underley network through modes such as multi-route, load balancing, fault-tolerant mechanism and the like, and meanwhile, nodes can be dynamically added or deleted according to requirements, so that the expansion and the reduction of the network are realized. However, the routing transformation of the Redis server needs to consider how to design and implement the underley network, and meanwhile, the characteristic routing transformation of the server does not have good portability, so that the routing transformation of the Redis server cannot be well applied to various Redis use scenes.
Therefore, in order to solve the problems existing in the prior art, it is necessary to propose an operation scheme suitable for various Redis use scenarios.
Disclosure of Invention
The main purpose of the application is to provide an operation method, an operation device and a storage medium, and aims to solve the problem that the prior art is difficult to flexibly adapt to various Redis use scenes.
To achieve the above object, the present application provides an operation method, including:
responding to a starting instruction, and acquiring configuration information;
registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and operating the Redis client according to the main and standby cluster information in the configuration information.
Optionally, the type of the Redis client includes a distributed session client, and the step of running the Redis client according to the primary and backup cluster information in the configuration information includes:
judging the type of an operation instruction when the distributed session client receives the operation instruction of a Redis cluster;
and if the operation instruction is a write instruction, writing the data into the current main cluster and all the standby clusters.
Optionally, after the step of determining the type of the operation instruction, the method further includes:
if the operation instruction is a read instruction, determining whether the current main cluster has a fault or not;
returning a query result of the current main cluster according to the read instruction under the condition that the current main cluster does not have a fault;
and returning the query result of the standby cluster according to the read instruction under the condition that the current main cluster fails.
Optionally, the type of the Redis client includes a distributed lock client, and the step of running the Redis client according to the primary and backup cluster information in the configuration information includes:
and when the distributed lock client receives an operation instruction of the Redis cluster, executing data reading and writing of the current main cluster according to the operation instruction.
Optionally, after the step of running the Redis client according to the active-standby cluster information in the configuration information, the method further includes:
monitoring the main and standby cluster states of the Redis client;
and under the condition that the cluster state is changed, switching the Redis client to the redefined main cluster to operate.
Optionally, the step of switching the Redis client to operate in the redefined main cluster when the cluster state is changed includes:
triggering a fusing strategy and adding the current main cluster into a failure cluster list when the current main cluster is monitored to be faulty;
and competing from the standby cluster list to obtain the redetermined main cluster, executing a write instruction flow based on the redetermined main cluster, and returning a main cluster result.
Optionally, the type of the Redis client includes a message interception client, and the step of running the Redis client according to the primary and backup cluster information in the configuration information includes:
when the message interception client receives a delivery message of a message producer, the delivery message is sent to a current main cluster, and cluster states of the current main cluster and the standby cluster are monitored;
and when the current main cluster is monitored to fail to receive the delivery message, the delivery message is sent to the standby cluster.
The embodiment of the application also provides an operation device, which comprises:
the acquisition module is used for responding to the starting instruction and acquiring configuration information;
the registration module is used for registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and the operation module is used for operating the Redis client according to the main and standby cluster information in the configuration information.
The embodiment of the application also provides an operation device, which comprises a memory, a processor and an operation program stored on the memory and capable of being operated on the processor, wherein the operation program realizes the steps of the operation method when being executed by the processor.
The embodiments of the present application also propose a computer-readable storage medium, on which an operating program is stored, which when executed by a processor implements the steps of the operating method as described above.
The running method, the running device, the running equipment and the storage medium provided by the embodiment of the application acquire the configuration information by responding to the starting instruction; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. Different data guarantee levels and main and standby cluster information can be flexibly selected through configuration information so as to adapt to the requirements of different use scenes. By providing a plurality of different client types, registering the Redis clients of the corresponding types according to the data security levels in the configuration information, and operating the Redis clients according to the main and standby cluster information, a user can obtain the Redis high security clients of different security levels through simple configuration, complex command operation of a bottom layer is shielded, and the implementation details of the bottom layer do not need to be concerned, so that the configurability and high flexibility are effectively realized.
Drawings
FIG. 1 is a schematic diagram of functional modules of a terminal device to which an operation device of the present application belongs;
FIG. 2 is a flow chart of a first exemplary embodiment of a method of operation of the present application;
FIG. 3 is a flow chart of a second exemplary embodiment of a method of operation of the present application;
FIG. 4 is a flow chart of a third exemplary embodiment of a method of operation of the present application;
FIG. 5 is a flow chart of a fourth exemplary embodiment of a method of operation of the present application;
fig. 6 is a flow chart of a fifth exemplary embodiment of the method of operation of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The main solutions of the embodiments of the present application are: responding to a starting instruction, and acquiring configuration information; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. Different data guarantee levels and main and standby cluster information can be flexibly selected through configuration information so as to adapt to the requirements of different use scenes. By providing a plurality of different client types, registering the Redis clients of the corresponding types according to the data security levels in the configuration information, and operating the Redis clients according to the main and standby cluster information, a user can obtain the Redis high security clients of different security levels through simple configuration, complex command operation of a bottom layer is shielded, and the implementation details of the bottom layer do not need to be concerned, so that the configurability and high flexibility are effectively realized.
Background information to which embodiments of the present application relate:
"cloud-up" refers to the migration of enterprise applications, data, and IT resources from a traditional local server or data center onto a cloud computing platform. With the continued maturation and popularity of cloud computing technologies, more and more enterprises are beginning to migrate applications, data, and IT resources onto cloud computing platforms. In the distributed deployment situation, in order to ensure the consistency and expandability of system data, a Redis component is introduced as a caching system of user session and information. The Redis component is introduced, so that the distributed system can be stateless, and when a user accesses the system, a consistent service can be obtained no matter the request reaches any node. Because the data is stored on the Redis with the master-slave structure, dirty data or data loss can not be caused by the up-down line of the application node, and the reliability of the system is greatly improved.
The distributed Redis architecture deployment approach typically includes a master-slave mode, a Sentinel cluster mode, and a cluster mode. The master-slave mode does not have the functions of automatic fault tolerance and recovery, and when the master node fails, the Redis cluster cannot continue to work. Therefore, the master-slave mode requires manual intervention, and the availability is low. The core of the Sentinel cluster mode is a master-slave mode, and one to a plurality of Sentinel nodes are added on the basis of the master-slave mode. When the master node is down, the Sentinel node competes and selects a new master node from all slave nodes. The slave node is responsible for synchronizing the data of the master node, so that only the master node always processes the read-write request, and the Redis cluster is limited by a stand-alone performance bottleneck. Cluster Cluster is a decentralised multi-master multi-slave mode Cluster and is generally applicable to systems with larger data sizes and need to support lateral expansion capability. The pattern cluster distributes keys storing data in 16384 hash slots according to hash values. 16384 hash slots should be evenly distributed across multiple master nodes, with each master node's data being a subset of 16384 hash slots. To guarantee the reliability of the cluster, each master node needs to have one or more slave nodes as its copies. When 16384 hash slots are allocated at each node, the Redis cluster is in an on-line state (OK). If any one of the hash slots is not allocated, then the Redis cluster is in a down state (FAIL). Although the Sentinel Cluster mode and the Cluster Cluster mode provide a high-guarantee scheme, redis positioning is a cache system, partial scenes do not allow users to start persistence, and when anomalies such as Redis Cluster node anomalies or network blocking occur, the Redis Cluster mode and the Cluster Cluster mode still face higher use risks.
The existing Redis high-guarantee technical scheme mainly comprises a double-write technical transformation method based on Redis and MySQL and a server-side route transformation method based on an underley network.
(1) For the double-writing technology transformation method based on Redis and MySQL, taking a Spring application program as an example, a Redis data source and a MySQL data source are dynamically set through a configuration file, a tangent plane for operating data is added in a data persistence layer, and an annotation is created to realize data read-write operation through Spring AOP. In the data operation section, the data source needs to be judged and verified, so that data reading and writing are completed, and the Redis is subjected to spam by using a MySQL database. However, this approach suffers from a number of drawbacks: (1) The read-write performance of the database is greatly different from that of the Redis, if the Redis cannot be recovered for a long time, the influence on the service system is greatly influenced; (2) Double writing data to Redis and MySQL requires increasing the cost of the system, and the hardware and software costs of Redis and MySQL need to be considered. Both Redis and MySQL require a certain amount of computing resources and memory space, which can result in increased system costs if the amount of data is large. In addition, maintenance costs of Redis and MySQL are also required to be considered simultaneously, including data backup, recovery, server upgrade, and the like. (3) The data in Redis and the database are difficult to ensure strong consistency, mySQL is directly used as a spam to realize, and serious consistency problems possibly exist in a fault stage to influence user experience.
(2) For the server-side route transformation method based on the underlay network, the underlay network can improve the reliability and availability of the network through multipath routing, load balancing, fault tolerance mechanism and other modes, and meanwhile, nodes can be dynamically added or deleted according to the needs, so that the expansion and the reduction of the network are realized. The server-side route transformation method based on the underley network uses the underley network to connect the Redis servers together, thereby realizing the automatic management and load balancing of the Redis clusters. In this scheme, the active-standby clusters should be distributed in different AZs (Availability Zone, available areas), all nodes of a single cluster should be distributed in multiple FDs (Fault Domain), and Master nodes and Slave nodes of a single cluster should be distributed on different FDs. However, this method has the following disadvantages: (1) The use of an underly network increases the complexity of the system, and consideration needs to be given to how the underly network is designed and implemented, and how the availability and reliability of the underly network are guaranteed. (2) The basic platform side is required to be subjected to characteristic transformation, and good portability is not achieved. (3) The master-slave architecture cannot guarantee strong consistency, and data replication across machine rooms further exacerbates this problem. (4) Aiming at the system application with large user flow, the slight faults can be perceived by the user obviously, and a set of higher-guarantee scheme is needed to further ensure the stability of the system.
Based on the problem that the prior art cannot solve the problem that the method is difficult to flexibly adapt to various Redis use scenes, the embodiment of the application provides an operation method, device, equipment and storage medium.
Specifically, referring to fig. 1, fig. 1 is a schematic diagram of functional modules of a terminal device to which an operating device of the present application belongs. The operating device may be a device independent of the terminal device, which is capable of operating, and which may be carried on the terminal device in the form of hardware or software. The terminal equipment can be an intelligent mobile terminal with an operation function such as a mobile phone and a tablet personal computer, and also can be a fixed terminal equipment or a server with an operation function.
In this embodiment, the terminal device to which the running apparatus belongs includes at least an output module 110, a processor 120, a memory 130, and a communication module 140.
The memory 130 stores an operating system and an operating program, and the operating device can store the received start instruction, the acquired configuration information, the corresponding type of Redis client registered according to the data security level in the configuration information, and information such as main and standby cluster information in the configuration information in the memory 130; the output module 110 may be a display screen or the like. The communication module 140 may include a WIFI module, a mobile communication module, a bluetooth module, and the like, and communicates with an external device or a server through the communication module 140.
Wherein the execution program in the memory 130 when executed by the processor performs the steps of:
responding to a starting instruction, and acquiring configuration information;
registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and operating the Redis client according to the main and standby cluster information in the configuration information.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
judging the type of an operation instruction when the distributed session client receives the operation instruction of a Redis cluster;
and if the operation instruction is a write instruction, writing the data into the current main cluster and all the standby clusters.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
if the operation instruction is a read instruction, determining whether the current main cluster has a fault or not;
returning a query result of the current main cluster according to the read instruction under the condition that the current main cluster does not have a fault;
and returning the query result of the standby cluster according to the read instruction under the condition that the current main cluster fails.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
and when the distributed lock client receives an operation instruction of the Redis cluster, executing data reading and writing of the current main cluster according to the operation instruction.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
monitoring the main and standby cluster states of the Redis client;
and under the condition that the cluster state is changed, switching the Redis client to the redefined main cluster to operate.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
triggering a fusing strategy and adding the current main cluster into a failure cluster list when the current main cluster is monitored to be faulty;
and competing from the standby cluster list to obtain the redetermined main cluster, executing a write instruction flow based on the redetermined main cluster, and returning a main cluster result.
Further, the running program in the memory 130 when executed by the processor also implements the steps of:
when the message interception client receives a delivery message of a message producer, the delivery message is sent to a current main cluster, and cluster states of the current main cluster and the standby cluster are monitored;
and when the current main cluster is monitored to fail to receive the delivery message, the delivery message is sent to the standby cluster.
According to the scheme, the configuration information is obtained specifically by responding to the starting instruction; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. Different data guarantee levels and main and standby cluster information can be flexibly selected through configuration information so as to adapt to the requirements of different use scenes. By providing a plurality of different client types, registering the Redis clients of the corresponding types according to the data security levels in the configuration information, and operating the Redis clients according to the main and standby cluster information, a user can obtain the Redis high security clients of different security levels through simple configuration, complex command operation of a bottom layer is shielded, and the implementation details of the bottom layer do not need to be concerned, so that the configurability and high flexibility are effectively realized.
Based on the above device architecture, but not limited to the above architecture, the method embodiments of the present application are presented.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first exemplary embodiment of the operation method of the present application. The operation method comprises the following steps:
step S10, responding to the starting instruction and acquiring configuration information.
The execution main body of the method of the embodiment may be an operation device, or may be an operation apparatus or a server, and the embodiment uses the operation device as an example, where the operation device may be integrated on a smart phone, a computer, or other devices with an operation function.
It should be noted that, when the system operates in different working scenarios, the system needs to conform to the corresponding data security level. Therefore, different data guarantee levels are set according to the characteristics of the processed data in the face of the data to be processed in different working scenes, and the operation requirements of the system in the different working scenes can be met.
In this embodiment, the running device is provided with a configuration service, and is used for implementing personalized configuration and storage of configuration information through the configuration service. The configuration service provides different strategy configurations such as single write (SingleWrite), synchronous double write (double write), asynchronous double write (double write asyn) and the like, and can be used for personalized configuration of configuration information aiming at data guarantee levels required by different working scenes.
In addition, the configuration information can also include relevant configuration information of remote dictionary service Redis active and standby clusters and nodes, and the like.
Specifically, when the running device receives a start-up instruction, the embodiment responds to the start-up instruction and obtains configuration information provided by the configuration service based on the received start-up instruction.
And step S20, registering the remote dictionary service Redis client of the corresponding type according to the data guarantee level in the configuration information.
Specifically, according to the acquired data guarantee level in the configuration information, registering the Redis client of the corresponding type. If the configuration information comprises a plurality of data guarantee levels, registering a plurality of Redis clients of different types correspondingly according to the data guarantee levels. Types of Redis clients may include, but are not limited to, a variety of Redis clients such as RedisTemplate, j2chae, redisson, redisAccess, redisLock and MessageListener.
For example, different data security levels are configured according to the data characteristics required to be processed in different working scenes, for example, data with long timeliness and high importance are correspondingly set as the highest data security level; correspondingly setting the data needing to ensure the thread safety as a medium data guarantee level; the message type data correspondence is set to a low data assurance level. According to different data security levels, correspondingly configuring different types of Redis clients, for example, configuring a Redis Access client for the highest data security level, wherein the Redis Access client is used for providing the highest security level for data with long timeliness and high importance, can be used for executing a conventional Redis instruction, supports a plurality of different storage strategy modes such as SingleWrite, doubleWrite, doubleWriteAsyn and the like, and is suitable for most working scenes; a Redis Lock client is configured for the medium data security level, wherein the Redis Lock client can be used for adding a distributed lock to a business process, only a single write mode is supported, and the thread security of data can be ensured by realizing the distributed lock through the Redis Lock client; the low data security level is configured as a messageListener client for ensuring reliable delivery of the message, wherein the messageListener client is used as a key listener of Redis and only supports a double write mode.
Generating corresponding configuration information based on the configuration scheme, acquiring the configuration information based on the starting instruction when responding to the starting instruction, and registering a corresponding Redis Access client, a Redis Lock client and/or a MessageListener client according to the data guarantee level in the configuration information.
And step S30, operating the Redis client according to the main and standby cluster information in the configuration information.
Specifically, after the Redis client is successfully registered, the registered Redis client is operated according to the acquired main and standby cluster information in the configuration information. The primary and backup cluster information may include, but is not limited to, information of a current primary cluster, all backup clusters, and failure clusters. Failure clusters refer to the primary clusters that are running abnormally or running failed, and all the primary clusters that are running abnormally or running failed are stored in a failure cluster list (failiedlist).
According to the scheme, the configuration information is obtained specifically by responding to the starting instruction; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. Different data guarantee levels and main and standby cluster information can be flexibly selected through configuration information so as to adapt to the requirements of different use scenes. By providing a plurality of different client types, registering the Redis clients of the corresponding types according to the data security levels in the configuration information, and operating the Redis clients according to the main and standby cluster information, a user can obtain the Redis high security clients of different security levels through simple configuration, complex command operation of a bottom layer is shielded, and the implementation details of the bottom layer do not need to be concerned, so that the configurability and high flexibility are effectively realized.
Further, referring to fig. 3, fig. 3 is a schematic flow chart of a second exemplary embodiment of the operation method of the present application. In this embodiment, after the Redis client is operated according to the active-standby cluster information in the configuration information in step S30, the operation method may further include:
step S40, monitoring the main and standby cluster states of the Redis client;
and S50, switching the Redis client to the redefined main cluster to run under the condition that the cluster state is changed.
Specifically, the running device is further provided with a monitoring function, and is used for monitoring the remote master-slave cluster of the Redis client. The monitoring function monitors the states of the main clusters and the standby clusters of the Redis client, such as whether the main clusters, the standby clusters and/or the failure cluster list are changed. And when the cluster state is monitored to be changed, the Redis client is switched to the redetermined main cluster to run.
More specifically, when the change of the cluster state is monitored, judging whether the cluster is a main cluster or a failure cluster list is changed; when the primary cluster or the failure cluster list is determined to be changed, competing out the next primary cluster from all the standby clusters, namely, the primary cluster which is determined again; and switching the Redis client to run in the redefined main cluster. Meanwhile, the related failure nodes are shielded according to the main cluster or failure cluster list with changed states, and the cluster states of the main cluster and other standby clusters which are redetermined are continuously monitored.
Further, in an embodiment, the Redis client also provides a monitoring function for the configuration service, for monitoring the configuration states of the Redis primary and standby clusters and the nodes thereof. After monitoring that Redis master and slave cluster information and/or node configuration and other information are changed, the running device acquires the latest configuration information, and corresponding master and slave cluster switching and abnormal node isolation are realized based on the latest configuration information.
According to the scheme, the monitoring function of the Redis cluster is provided for monitoring the main and standby clusters, and when the monitoring function detects that the Redis cluster fails, the monitoring function can be automatically switched to the standby cluster, so that the usability of the system is guaranteed to the greatest extent and is not influenced.
Further, referring to fig. 4, fig. 4 is a schematic flow chart of a third exemplary embodiment of the operation method of the present application. Based on the embodiment shown in fig. 2 or fig. 3, in this embodiment, the type of the Redis client may include a distributed session client, i.e., a RedisAccess client; the step S30 may include running the Redis client according to the active-standby cluster information in the configuration information:
step S301, judging the type of an operation instruction of a Redis cluster when the distributed session client receives the operation instruction;
in step S302, if the operation instruction is a write instruction, the data is written into the current main cluster and all the standby clusters.
Specifically, in the running process of the Redis Access client, when the Redis Access client receives an operation instruction of the Redis cluster, the type of the operation instruction is firstly judged. If the operation instruction is a write instruction, writing the data corresponding to the write instruction into the current main cluster and all standby clusters through a double write mode supported by the Redis Access client.
Further, after the step of determining the type of the operation instruction, the operation method may further include:
step S303, if the operation instruction is a read instruction, determining whether the current main cluster has a fault;
step S304, returning a query result of the current main cluster according to the read instruction under the condition that the current main cluster does not have a fault;
step S305, returning a query result of the backup cluster according to the read instruction when the current main cluster fails.
Specifically, when the received operation instruction of the Redis cluster is a read instruction, it is determined whether the current main cluster fails. And under the condition that the current main cluster does not have a fault, returning a query result of the current main cluster according to the read instruction. And under the condition that the current main cluster fails, returning a query result of the standby cluster according to the read instruction.
Because the Redis Access client adopts the double write mode, the read-write data in the main cluster and the standby cluster can ensure higher consistency.
Further, in this embodiment, in the case where the cluster state is changed, the step S50 may include switching the Redis client to the redefined master cluster to operate.
Step S501, when the current main cluster is monitored to be faulty, triggering a fusing strategy and adding the current main cluster into a failure cluster list;
step S502, performing an election from the standby cluster list to obtain the redetermined main cluster, executing a write instruction flow based on the redetermined main cluster, and returning a main cluster result.
Specifically, the monitoring function of the running device continuously monitors the active-standby cluster state of the Redis client. When the current main cluster is monitored to have faults, such as Redis has faults and overtime, a fusing strategy is triggered and the current main cluster is added into a failure cluster list. And competing from the standby cluster list to obtain the next main cluster, namely the main cluster determined again. Executing a write instruction flow based on the redetermined main cluster, realizing automatic switching between the main cluster and the standby cluster, and returning a main cluster result after successful execution; otherwise, the exception prompt is thrown out after the execution fails.
According to the scheme, the main clusters and the standby clusters are monitored by adopting the monitoring function, the bottom-covering strategy is triggered after the main clusters are failed, the main clusters are added into the failiedList, and new main clusters are reelected, so that high guarantee is provided for the Redis clusters. Meanwhile, in order to ensure the availability of the system in the process from the fault occurrence to the switching of the monitoring function, a bottom-covering and fusing mechanism is introduced, so that no obvious perception is ensured at the application side under the condition of faults of the host machine or the standby machine.
Further, referring to fig. 5, fig. 5 is a schematic flow chart of a fourth exemplary embodiment of the operation method of the present application. Based on the embodiment shown in fig. 2 or fig. 3, in this embodiment, the Redis client may include a distributed lock client, i.e., a RedisLock client; the step S30 may include running the Redis client according to the active-standby cluster information in the configuration information:
step S306, when the distributed lock client receives an operation instruction of the Redis cluster, data reading and writing of the current main cluster are executed according to the operation instruction.
Specifically, in the running process of the Redis Lock client, when the Redis lock client receives an operation instruction of the Redis cluster, the data read-write of the current main cluster is executed according to the operation instruction through a single write mode supported by the Redis lock client.
Further, monitoring the main and standby cluster states of the Redis client; when the current main cluster is monitored to have faults, such as Redis has faults and overtime, a fusing strategy is triggered and the current main cluster is added into a failure cluster list. And competing from the standby cluster list to obtain the next main cluster, namely the main cluster determined again. Based on the redetermined main cluster executing the data read-write flow corresponding to the operation instruction, the automatic switching between the main cluster and the standby cluster is realized, and the main cluster result is returned after the execution is successful; otherwise, the exception prompt is thrown out after the execution fails.
According to the implementation scheme, in the process of reading and writing the distributed lock by the Redis Lock client, the strategy of single write mode and bottom-attached fusing is adopted, so that the atomicity is ensured, the shorter life cycle is met, and meanwhile, high guarantee is provided for the Redis cluster.
Further, referring to fig. 6, fig. 6 is a schematic flow chart of a fifth exemplary embodiment of the operation method of the present application. Based on the embodiment shown above, in this embodiment, the Redis client may include a message interception client, i.e., a MessageListener client; the step S30 may include running the Redis client according to the active-standby cluster information in the configuration information:
step S307, when the message interception client receives a delivery message of a message producer, the delivery message is sent to a current main cluster, and cluster states of the current main cluster and the standby cluster are monitored.
Specifically, during the operation of the messagelist client, the messagelist client receives a delivery message when the message producer sends the delivery message to the cluster. The received delivery message is sent to the current primary cluster based on the SingleWrite mode supported by the messagelist client. Meanwhile, based on the double monitoring strategy, the MessageListener client (also called a message consumer) continuously monitors the current cluster states of the main cluster and the standby cluster so as to ensure that the message is consumed correctly.
Step S308, when it is monitored that the current primary cluster fails to receive the delivery message, the delivery message is sent to the backup cluster.
Specifically, when the current main cluster fails to receive the delivery message, the delivery message is sent to the standby cluster based on the spam policy. And after the delivery message is successfully received, returning a standby cluster result.
According to the scheme, in the process of delivering the message by the MessageListener client, the data is ensured not to be repeated and lost by adopting the single write mode and the double-monitoring spam scheme.
In addition, an embodiment of the present application further provides an operation device, where the operation device includes:
the acquisition module is used for responding to the starting instruction and acquiring configuration information;
the registration module is used for registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and the operation module is used for operating the Redis client according to the main and standby cluster information in the configuration information.
The present embodiment realizes the operation principle and implementation process, please refer to the above embodiments, and the description thereof is omitted herein.
In addition, the embodiment of the application also provides an operation device, which comprises a memory, a processor and an operation program stored on the memory and capable of being operated on the processor, wherein the operation program realizes the steps of the operation method when being executed by the processor.
Because the running program is executed by the processor and adopts all the technical schemes of all the embodiments, the running program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
Furthermore, the embodiments of the present application also propose a computer-readable storage medium, on which an operating program is stored, which when executed by a processor implements the steps of the operating method as described above.
Because the running program is executed by the processor and adopts all the technical schemes of all the embodiments, the running program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
Compared with the prior art, the running method, the running device, the running equipment and the storage medium provided by the embodiment of the application acquire the configuration information by responding to the starting instruction; registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information; and operating the Redis client according to the main and standby cluster information in the configuration information. Different data guarantee levels and main and standby cluster information can be flexibly selected through configuration information so as to adapt to the requirements of different use scenes. By providing a plurality of different client types, registering the Redis clients of the corresponding types according to the data security levels in the configuration information, and operating the Redis clients according to the main and standby cluster information, a user can obtain the Redis high security clients of different security levels through simple configuration, complex command operation of a bottom layer is shielded, and the implementation details of the bottom layer do not need to be concerned, so that the configurability and high flexibility are effectively realized.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to perform the method of each embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A method of operation, the method of operation comprising:
responding to a starting instruction, and acquiring configuration information;
registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and operating the Redis client according to the main and standby cluster information in the configuration information.
2. The method according to claim 1, wherein the type of the dis client includes a distributed session client, and the step of running the dis client according to the active-standby cluster information in the configuration information includes:
judging the type of an operation instruction when the distributed session client receives the operation instruction of a Redis cluster;
and if the operation instruction is a write instruction, writing the data into the current main cluster and all the standby clusters.
3. The method of claim 2, wherein after the step of determining the type of the operation instruction, further comprising:
if the operation instruction is a read instruction, determining whether the current main cluster has a fault or not;
returning a query result of the current main cluster according to the read instruction under the condition that the current main cluster does not have a fault;
and returning the query result of the standby cluster according to the read instruction under the condition that the current main cluster fails.
4. The method of claim 1, wherein the type of the dis client comprises a distributed lock client, and wherein the step of running the dis client according to the active-standby cluster information in the configuration information comprises:
and when the distributed lock client receives an operation instruction of the Redis cluster, executing data reading and writing of the current main cluster according to the operation instruction.
5. The operation method according to claim 1, further comprising, after the step of operating the Redis client according to the active/standby cluster information in the configuration information:
monitoring the main and standby cluster states of the Redis client;
and under the condition that the cluster state is changed, switching the Redis client to the redefined main cluster to operate.
6. The method according to claim 5, wherein the step of switching the Redis client to operate in the redefined master cluster in the event of a change in the cluster state comprises:
triggering a fusing strategy and adding the current main cluster into a failure cluster list when the current main cluster is monitored to be faulty;
and competing from the standby cluster list to obtain the redetermined main cluster, executing a write instruction flow based on the redetermined main cluster, and returning a main cluster result.
7. The method of claim 1, wherein the type of the dis client comprises a message interception client, and wherein the step of running the dis client according to the active-standby cluster information in the configuration information comprises:
when the message interception client receives a delivery message of a message producer, the delivery message is sent to a current main cluster, and cluster states of the current main cluster and the standby cluster are monitored;
and when the current main cluster is monitored to fail to receive the delivery message, the delivery message is sent to the standby cluster.
8. An operation device, characterized in that the operation device comprises:
the acquisition module is used for responding to the starting instruction and acquiring configuration information;
the registration module is used for registering a remote dictionary service Redis client of a corresponding type according to the data guarantee level in the configuration information;
and the operation module is used for operating the Redis client according to the main and standby cluster information in the configuration information.
9. An operating device, characterized in that the terminal device comprises a memory, a processor and an operating program stored on the memory and operable on the processor, which operating program, when executed by the processor, realizes the steps of the operating method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon an operating program which, when executed by a processor, implements the steps of the operating method according to any of claims 1-7.
CN202311693430.1A 2023-12-11 2023-12-11 Operation method, device, equipment and storage medium Pending CN117692500A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311693430.1A CN117692500A (en) 2023-12-11 2023-12-11 Operation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311693430.1A CN117692500A (en) 2023-12-11 2023-12-11 Operation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117692500A true CN117692500A (en) 2024-03-12

Family

ID=90125904

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311693430.1A Pending CN117692500A (en) 2023-12-11 2023-12-11 Operation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117692500A (en)

Similar Documents

Publication Publication Date Title
US11360854B2 (en) Storage cluster configuration change method, storage cluster, and computer system
US11307943B2 (en) Disaster recovery deployment method, apparatus, and system
EP2281240B1 (en) Maintaining data integrity in data servers across data centers
US5129080A (en) Method and system increasing the operational availability of a system of computer programs operating in a distributed system of computers
CN101136728A (en) Cluster system and method for backing up a replica in a cluster system
CN111290834A (en) Method, device and equipment for realizing high availability of service based on cloud management platform
US20080288812A1 (en) Cluster system and an error recovery method thereof
EP2224341B1 (en) Node system, server switching method, server device, and data transfer method
CN111327467A (en) Server system, disaster recovery backup method thereof and related equipment
CA3162740A1 (en) Traffic switching methods and devices based on multiple active data centers
CN108810150B (en) Data replication method of application-level disaster recovery backup system of cooperative office system
CN104753987B (en) A kind of distributed conversation management method and system
CN110557413A (en) Business service system and method for providing business service
CN115576655B (en) Container data protection system, method, device, equipment and readable storage medium
CN111935244B (en) Service request processing system and super-integration all-in-one machine
CN109324549B (en) Dual-master control equipment configuration method and dual-master control equipment
CN113254275A (en) MySQL high-availability architecture method based on distributed block device
CN115878384A (en) Distributed cluster based on backup disaster recovery system and construction method
CN111858190A (en) Method and system for improving cluster availability
JP5285045B2 (en) Failure recovery method, server and program in virtual environment
CN112732492A (en) Extraction backup method and system based on cloud database
CN117692500A (en) Operation method, device, equipment and storage medium
CN112925612A (en) Monitoring service static configuration management method based on Kubernetes
US20080148023A1 (en) Method and system for synchronous operation of an application by a purality of processing units
CN115510167B (en) Distributed database system and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination