CN112100005A - Redis copy set implementation method and device - Google Patents

Redis copy set implementation method and device Download PDF

Info

Publication number
CN112100005A
CN112100005A CN202010842617.3A CN202010842617A CN112100005A CN 112100005 A CN112100005 A CN 112100005A CN 202010842617 A CN202010842617 A CN 202010842617A CN 112100005 A CN112100005 A CN 112100005A
Authority
CN
China
Prior art keywords
agent
sentinel
redis
configuration file
switching
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.)
Granted
Application number
CN202010842617.3A
Other languages
Chinese (zh)
Other versions
CN112100005B (en
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.)
Unicloud Nanjing Digital Technology Co Ltd
Original Assignee
Unicloud Nanjing Digital Technology 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 Unicloud Nanjing Digital Technology Co Ltd filed Critical Unicloud Nanjing Digital Technology Co Ltd
Priority to CN202010842617.3A priority Critical patent/CN112100005B/en
Priority to PCT/CN2020/130220 priority patent/WO2022036901A1/en
Publication of CN112100005A publication Critical patent/CN112100005A/en
Application granted granted Critical
Publication of CN112100005B publication Critical patent/CN112100005B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available

Abstract

The invention discloses a method and a device for realizing a Redis copy set, wherein the method comprises the following steps: s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent; s2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule; and S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request. Has the advantages that: through the matching use of the components Proxy, keepalive, Redis-server, Redis-sentinel and Check-sentinel scripts, the invention can adopt the lowest matching Redis to realize a high availability scheme, thereby not only effectively solving the problems of split brain and failure in switching virtual machine downtime, but also effectively solving the multi-main problem after the virtual machine is started, and simultaneously, the addition of the Proxy can provide a protection for the Redis, such as shielding of performance loss commands and abnormal exit of the Redis caused by full Redis connection of the client.

Description

Redis copy set implementation method and device
Technical Field
The invention relates to the technical field of databases, in particular to a method and a device for realizing a Redis copy set.
Background
In the application of network blogs or many projects, Redis copies are mostly built by one master-two slave-three sentinels, multiple sentinels or one master-one slave-two sentinels, and the building mode of lowest matching of one master-one slave-one sentinels is rarely mentioned. A common protocol is as follows: scheme one (as shown in figure 1) is a master sentinel and a slave sentinel, M1 and R1 are respectively a master sentinel and a slave sentinel, and S1 and S2 are high-availability sentinels; scheme two (as shown in fig. 2) is a master-slave three sentinels, and if the scheme is deployed independently, 3 sentinels occupy more resources; with Redis deployment, the same failover problems are encountered; a third scheme (as shown in fig. 3) is a master-slave-two-slave 3 sentinel which is still not the lowest allocation and consumes more resources; in addition, no agent exists, a user needs to sense all node information such as IP, PORT and the like, all administrator operations such as FLUSH and the like can be executed through a client, and potential safety hazards are brought.
However, for the first solution described above, there are the following drawbacks: 1) the problem of split brain after network failure cannot be solved; 2) if a certain sentinel progress is crashed or a certain virtual machine is crashed, the fault switching can not be smoothly carried out; 3) the client needs to make explicit the underlying deployment architecture information such as IP, PORT, etc., and can perform all administrator operations such as FLUSH, etc.
For the second scheme, a sentinel is added; if three sentinels are separately deployed, extra resource consumption is brought, and the sentinel process is just fault switching, so that too many resources are not occupied; as the sentinel process is deployed with Redis, there are two significant drawbacks as well: 1) if one of the sentry is down, the fault switching can not be smoothly carried out; 2) the client needs to make explicit the underlying deployment architecture information such as IP, PORT, etc., and can perform all administrator operations such as FLUSH, etc.
For the third scheme, a main sentry, a secondary sentry and a third sentry are additionally provided with one physical resource, which is not the lowest allocation.
An effective solution to the problems in the related art has not been proposed yet.
Disclosure of Invention
Aiming at the problems in the related art, the invention provides a method and a device for realizing a Redis copy set, so as to overcome the technical problems in the prior related art.
Therefore, the invention adopts the following specific technical scheme:
according to one aspect of the invention, an implementation method of a Redis copy set is provided, which comprises the following steps:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent;
s2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule;
and S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
Further, the step of performing activity detection on the agent by using a preset method in S1 to realize high availability of the agent specifically includes the following steps: and controlling VIP deviation by detecting the activity of the agent by adopting preset software KeepAlived to realize high availability of the agent.
Further, the proxy in S1 is an open source proxy Predixy, which can shield some commands of password resetting and parameter modification, and a user does not need to perceive the deployment information of the underlying architecture, and connects the proxy as if connecting a single database Redis, so that subsequent expansion of the copy set can be realized.
Further, the implementation of automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection through a preset rule in S2 specifically includes the following steps:
s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server;
s22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
Further, the step of periodically triggering the Check-sentinel script in S22 specifically includes the following steps:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an error, the PING command is regarded as a slave node server, the PING command is accumulated once per period, and if the PING command still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
Further, the preset rule that the agent obtains the latest structure information of the database Redis in S3 means that the agent periodically obtains from a sentinel.
According to another aspect of the present invention, there is also provided an electronic apparatus, including a memory and a processor, where the memory stores an implementation program of a Redis copy set executable on the processor, and the implementation program of the Redis copy set implements the following steps when executed by the processor:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent;
s2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule;
and S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
Further, the step of performing activity detection on the agent by using a preset method in S1 to realize high availability of the agent specifically includes the following steps: and controlling VIP deviation by detecting the activity of the agent by adopting preset software KeepAlived to realize high availability of the agent.
Further, the implementation of automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection through a preset rule in S2 specifically includes the following steps:
s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server;
s22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
Further, the step of periodically triggering the Check-sentinel script in S22 specifically includes the following steps:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an error, the PING command is regarded as a slave node server, the PING command is accumulated once per period, and if the PING command still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
The invention has the beneficial effects that: through the matching use of the components Proxy, keepalive, Redis-server, Redis-sentinel and Check-sentinel scripts, the invention can adopt the lowest matching Redis to realize a high availability scheme, thereby not only effectively solving the problems of split brain and failure in switching virtual machine downtime, but also effectively solving the multi-main problem after the virtual machine is started, and simultaneously, the addition of the Proxy can provide a protection for the Redis, such as shielding of performance loss commands and abnormal exit of the Redis caused by full Redis connection of the client.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic diagram of a first construction method of a Redis copy set scheme in the prior art;
FIG. 2 is a schematic diagram of a construction mode of a Redis copy set scheme II in the prior art;
FIG. 3 is a schematic diagram of a building manner of a Redis copy set scheme III in the prior art;
FIG. 4 is a flowchart illustrating a method for implementing a Redis copy set according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a principle framework in an implementation method of a Redis copy set according to an embodiment of the present invention.
Detailed Description
For further explanation of the various embodiments, the drawings which form a part of the disclosure and which are incorporated in and constitute a part of this specification, illustrate embodiments and, together with the description, serve to explain the principles of operation of the embodiments, and to enable others of ordinary skill in the art to understand the various embodiments and advantages of the invention, and, by reference to these figures, reference is made to the accompanying drawings, which are not to scale and wherein like reference numerals generally refer to like elements.
According to the embodiment of the invention, a method and a device for realizing a Redis copy set are provided.
Referring now to the drawings and the detailed description, as shown in fig. 4-5, according to an embodiment of the present invention, there is provided a method for implementing a Redis copy set, including the following steps:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent;
wherein, the S1 specifically includes the following steps: the VIP offset is controlled by detecting Proxy (Proxy) activity using a pre-set software KeepAlived to achieve high availability of the Proxy.
Specifically, the agent in S1 is an open source agent Predixy, which can shield some commands such as SCAN, KEYS, etc. for password resetting, parameter modification and wear-out performance, and the user does not need to sense the deployment information of the underlying architecture, and connects the agent as if connecting a single database Redis, so that the subsequent expansion of the copy set can be realized.
S2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule;
wherein, the S2 specifically includes the following steps:
s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server;
specifically, the failover in S21 includes the following steps:
selecting one slave node server from all slave node servers of the offline master node server, and converting the slave node server into the master node server; preferably, the election principle of converting the slave node server into the master node server is as follows: firstly, deleting slave node servers in an offline or offline state in a list, and ensuring that all the servers are in an online state; then, deleting the servers which do not reply to the sentinel in the last 5 seconds in the list, and ensuring that all the servers can normally communicate; and finally, deleting the slave node servers which are disconnected with the offline master node server for more than the preset time, so as to screen out the slave databases with new data. After the deletion, the slave node server with high priority and the maximum copy offset is set, and if the slave node server cannot be selected, the slave node server with the minimum running ID is selected; when a new master node server is elected, the sentinel will send INFO commands at a frequency of once per second, and when the upgraded role attribute is upgraded from slave to master, the sentinel is considered to have upgraded to the master node server. When detecting that the selected slave node server is upgraded to the master node server, continuously sending SLAVEOF commands to other slave node servers to change the setting of the master node server.
Copying a new main node server by other slave node servers of the offline main node server;
and setting the offline master node server as a slave node server of a new master node server, and when the offline master node server is online again, the offline master node server becomes a slave node server of the new master node server.
Specifically, the old master node server is offline, so the setting is configured in the old master node server object of the leading sentinel, and after the old master node server is online, the sentinel performs the supplementary issue of the slave command.
S22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
Specifically, the Check-sentinel script in S22 is triggered periodically, for example, every 3 seconds, as follows:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an Error (Error), the PING command is regarded as a slave node server, the Error is accumulated once per period, and if the Error still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
In addition, the S22 includes the steps of achieving automatic switching of sentinels (the sentinels need to be switched because the faulty sentinels are responsible for switching, and the Redis roles are not consistent with the conditions that the sentinels only operate in the slave nodes after switching, the sentinels are switched because the master nodes are down, the sentinels operate in the slave nodes and can still be switched), if the fault node self-rescue still fails to start the service after trying for 3 times, an alarm mail is sent, and the multiple brainstors generate the Redis process which can correspondingly kill the process and has long running time.
And S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
The preset rule for the agent to acquire the latest structure information of the database Redis in S3 means that the agent periodically acquires the latest structure information from a sentinel, and the information includes information such as state/role.
According to another embodiment of the invention, an electronic device is also provided.
In this embodiment, the electronic device may be a computer or a server. The electronic device includes at least a memory, a processor, a communication bus, and a network interface.
Wherein the memory includes at least one type of readable storage medium including flash memory, hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory may in some embodiments be an internal storage unit of the electronic device, for example a hard disk of the electronic device. The memory may also be an external storage device of the electronic apparatus in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic apparatus. Further, the memory may also include both an internal storage unit and an external storage device of the electronic apparatus. The memory may be used not only to store application software installed in the electronic device and various types of data, such as code of an implementation program of a Redis copy set, etc., but also to temporarily store data that has been output or is to be output.
The processor may be, in some embodiments, a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip that executes program code stored in memory or processes data.
The communication bus is used to enable connection communication between these components.
The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), and is typically used to establish a communication link between the electronic apparatus and other electronic devices.
Optionally, the electronic device may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device and for displaying a visualized user interface.
The electronic device comprises a memory and a processor, wherein the memory stores an implementation program of a Redis copy set which can run on the processor, and the implementation program of the Redis copy set realizes the following steps when being executed by the processor:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent; wherein, the S1 specifically includes the following steps: and controlling VIP deviation by detecting the activity of the agent by adopting preset software KeepAlived to realize high availability of the agent.
S2, automatic fault transfer, manual master-slave node switching, automatic sentinel switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule; wherein, the S2 specifically includes the following steps: s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server; s22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
Specifically, the periodically triggering the Check-sentinel script in S22 specifically includes the following steps:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an error, the PING command is regarded as a slave node server, the PING command is accumulated once per period, and if the PING command still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
And S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
In summary, according to the technical scheme of the present invention, by using the components Proxy, KeepAlived (which can implement highly available and reliable software), Redis-server (node), Redis-sentinel (sentinel) and Check-sentinel script in a matching manner, the present invention can implement a highly available scheme by using the lowest-configuration Redis, which not only effectively solves the problem that the split brain and the downtime of the virtual machine cannot be switched, but also effectively solves the multi-main problem after the virtual machine is started, and meanwhile, the addition of the Proxy can provide a shield for protecting the Redis, such as performance loss commands, abnormal exit of the Redis caused by full Redis connection of the client, and the like.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for realizing a Redis copy set is characterized by comprising the following steps:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent;
s2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule;
and S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
2. The method for implementing a Redis copy set according to claim 1, wherein a preset method is adopted in S1 to perform activity detection on an agent, and implementing high availability of the agent specifically includes the following steps: and controlling VIP deviation by detecting the activity of the agent by adopting preset software KeepAlived to realize high availability of the agent.
3. The method as claimed in claim 1, wherein the agent in S1 is an open source agent Predixy, the open source agent Predixy can mask some commands of password resetting and parameter modification, and a user can connect the agent as if connecting a single database Redis without sensing underlying architecture deployment information, so as to implement subsequent replica set extension.
4. The method for implementing a Redis copy set according to claim 1, wherein the implementation of automatic failover, manual master-slave node switching, sentinel automatic switching, failed node self-rescue and split brain multi-master detection in S2 by a preset rule specifically comprises the following steps:
s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server;
s22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
5. The method for implementing a Redis copy set according to claim 4, wherein the periodically triggering a Check-sentinel script in S22 specifically includes the following steps:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an error, the PING command is regarded as a slave node server, the PING command is accumulated once per period, and if the PING command still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
6. The method for implementing Redis copy set of claim 1, wherein the preset rule in the S3 that the agent obtains the latest structure information of the Redis database refers to that the agent periodically obtains from a sentinel.
7. An electronic device, comprising a memory and a processor, wherein the memory stores an implementation program of a Redis copy set executable on the processor, and the implementation program of the Redis copy set implements the following steps when executed by the processor:
s1, performing activity detection on the agent by adopting a preset method to realize high availability of the agent;
s2, automatic fault transfer, manual master-slave node switching, sentinel automatic switching, fault node self-rescue and split brain multi-master detection are realized through a preset rule;
and S3, the agent acquires the latest structure information of the Redis database by adopting a preset rule and correctly routes the request.
8. The electronic device according to claim 7, wherein the step of performing activity detection on the agent by using a preset method in S1 specifically includes the following steps: and controlling VIP deviation by detecting the activity of the agent by adopting preset software KeepAlived to realize high availability of the agent.
9. The electronic device according to claim 7, wherein the implementation of automatic failover, manual master-slave node switching, sentinel automatic switching, failed node self-rescue and split brain multi-master detection through a preset rule in S2 specifically includes the following steps:
s21, when the copy set is initialized, the sentinel operates in the slave node, and periodically acquires the state of the database Redis and is responsible for automatic fault transfer of the database Redis and switching of a manual master-slave node server;
s22, when the master-slave switching is completed, the Check-sentinel script is triggered periodically, the fact that the sentinel operating node is not matched with the database Redis role is detected, and then the sentinel is switched into the current slave node server by the Check-sentinel script correspondingly.
10. The electronic device according to claim 9, wherein the periodically triggering the Check-sentinel script in S22 specifically comprises the following steps:
when the server is a main node server and a sentinel exists, stopping the sentinel process, enabling the agent process configuration file to point to the local in a soft connection mode, modifying the soft connection mode to point to a remote agent configuration file, and restarting an agent;
when the server is a slave node server and a sentinel does not exist, starting a sentinel process, wherein the agent process configuration file is in a soft connection direction to a far end, the agent process configuration file is modified to be in a soft connection direction to a local agent configuration file, and the agent is restarted;
and when the PING command returns an error, the PING command is regarded as a slave node server, the PING command is accumulated once per period, and if the PING command still fails for 5 times, the proxy configuration file soft connection is modified to point to a local configuration file.
CN202010842617.3A 2020-08-20 2020-08-20 Redis copy set implementation method and device Active CN112100005B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010842617.3A CN112100005B (en) 2020-08-20 2020-08-20 Redis copy set implementation method and device
PCT/CN2020/130220 WO2022036901A1 (en) 2020-08-20 2020-11-19 Implementation method and apparatus for redis replica set

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010842617.3A CN112100005B (en) 2020-08-20 2020-08-20 Redis copy set implementation method and device

Publications (2)

Publication Number Publication Date
CN112100005A true CN112100005A (en) 2020-12-18
CN112100005B CN112100005B (en) 2022-11-25

Family

ID=73753084

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010842617.3A Active CN112100005B (en) 2020-08-20 2020-08-20 Redis copy set implementation method and device

Country Status (2)

Country Link
CN (1) CN112100005B (en)
WO (1) WO2022036901A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783611A (en) * 2021-01-29 2021-05-11 紫光云技术有限公司 Universal configurable method for preparing cloud database Redis instance resources
CN112866035A (en) * 2021-02-24 2021-05-28 紫光云技术有限公司 Method for switching specified slave node into master node of redis service on cloud platform
CN114785713A (en) * 2022-03-31 2022-07-22 度小满科技(北京)有限公司 Method and proxy middleware for realizing high availability of Redis cluster
CN115190005A (en) * 2022-06-30 2022-10-14 南京信息工程大学 High-availability method of double-host system based on Redis

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115426249B (en) * 2022-11-02 2023-03-24 飞天诚信科技股份有限公司 High-availability solution method and device for Redis master-slave architecture
CN116303364B (en) * 2023-03-28 2023-12-15 云启智慧科技有限公司 Redis high-availability and high-expansibility installation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199957A (en) * 2014-09-17 2014-12-10 合一网络技术(北京)有限公司 Redis universal agent implementation method
CN107343034A (en) * 2017-06-26 2017-11-10 杭州铭师堂教育科技发展有限公司 Redis high-availability systems and method based on QConf
CN109656753A (en) * 2018-12-03 2019-04-19 上海电科智能系统股份有限公司 A kind of Redundant backup system applied to track traffic synthetic monitoring system
CN110140119A (en) * 2016-10-27 2019-08-16 Mz知识产权控股有限责任公司 System and method for managing cache server cluster

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9086812B2 (en) * 2010-02-19 2015-07-21 Tokyo Institute Of Technology Storage device, control method for same and system management program
CN103207841B (en) * 2013-03-06 2016-01-20 青岛海信传媒网络技术有限公司 Based on data read-write method and the device of key-value pair buffer memory
CN106209447B (en) * 2016-07-07 2019-11-15 深圳市创梦天地科技有限公司 The fault handling method and device of distributed caching

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199957A (en) * 2014-09-17 2014-12-10 合一网络技术(北京)有限公司 Redis universal agent implementation method
CN110140119A (en) * 2016-10-27 2019-08-16 Mz知识产权控股有限责任公司 System and method for managing cache server cluster
CN107343034A (en) * 2017-06-26 2017-11-10 杭州铭师堂教育科技发展有限公司 Redis high-availability systems and method based on QConf
CN109656753A (en) * 2018-12-03 2019-04-19 上海电科智能系统股份有限公司 A kind of Redundant backup system applied to track traffic synthetic monitoring system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783611A (en) * 2021-01-29 2021-05-11 紫光云技术有限公司 Universal configurable method for preparing cloud database Redis instance resources
CN112866035A (en) * 2021-02-24 2021-05-28 紫光云技术有限公司 Method for switching specified slave node into master node of redis service on cloud platform
CN114785713A (en) * 2022-03-31 2022-07-22 度小满科技(北京)有限公司 Method and proxy middleware for realizing high availability of Redis cluster
CN114785713B (en) * 2022-03-31 2024-02-23 度小满科技(北京)有限公司 Method and proxy middleware for realizing high availability of Redis cluster
CN115190005A (en) * 2022-06-30 2022-10-14 南京信息工程大学 High-availability method of double-host system based on Redis
CN115190005B (en) * 2022-06-30 2023-05-16 南京信息工程大学 Redis-based high availability method of double-host system

Also Published As

Publication number Publication date
WO2022036901A1 (en) 2022-02-24
CN112100005B (en) 2022-11-25

Similar Documents

Publication Publication Date Title
CN112100005B (en) Redis copy set implementation method and device
US9311199B2 (en) Replaying jobs at a secondary location of a service
JP6556851B2 (en) Database system, server device, program, and information processing method
WO2014076838A1 (en) Virtual machine synchronization system
CN113656147B (en) Cluster deployment method, device, equipment and storage medium
CN111478796B (en) Cluster capacity expansion exception handling method for AI platform
CN108737153B (en) Block chain disaster recovery system, method, server and computer-readable storage medium
CN113051110A (en) Cluster switching method, device and equipment
CN111752488B (en) Management method and device of storage cluster, management node and storage medium
CN111666134A (en) Method and system for scheduling distributed tasks
CN111752962B (en) System and method for guaranteeing high availability and consistency of MHA cluster
CN116149713B (en) Program upgrading method and device for all-level equipment under tree-type heterogeneous network
CN111708668A (en) Cluster fault processing method and device and electronic equipment
CN103888283A (en) SCTP communication method and device
CN111324632B (en) Transparent database session restoration with client-side caching
US9880855B2 (en) Start-up control program, device, and method
CN112751693B (en) Data processing method and device of distributed storage system and electronic equipment
JP5670935B2 (en) Distributed data management system and operation method thereof
JP2016200961A (en) Server failure monitoring system
CN111125001A (en) Snap copy method, electronic device, and computer program product
CN114915545B (en) Application scheduling deployment management method based on DHCP network cluster
CN113138722B (en) Replication snapshot method, system and medium for distributed block storage system
CN117609194A (en) Cloud database processing method and device, electronic equipment and storage medium
CN116009891A (en) Method for managing operating system, electronic device and computer program product
JP2016225943A (en) System for restoring device status and restoration method of device status in system

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
GR01 Patent grant
GR01 Patent grant