Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What do you mean by downtime in redis

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what the meaning of downtime in redis means, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Downtime is a computer term. In spoken language, we simply call the shutdown machine downmachine, and the conversion to Chinese characters is "downtime", but many people call it "crash" / "crash". Although it is not standard, it is popular.

Downtime refers to the phenomenon that the operating system is unable to recover from a serious system error, or there is a problem at the system hardware level, so that the system does not respond for a long time and has to restart the computer. It is a normal phenomenon of computer operation, which can happen to any computer.

A redis cluster has many redis working together, so it is necessary that the cluster is not so easy to hang up, so in theory, at least one backup redis service should be given to each node in the cluster. This standby redis is called a slave node (slave).

The first thing to say is that each node has information about all the master nodes and slave nodes of the cluster. The ping-pong of each other is used to determine whether the nodes can be connected. If more than half of the nodes go to ping a node and do not respond, the cluster thinks that the node is down and then connects to its backup node.

In the master-slave mode, the mechanism can be divided into two categories:

Slave downtime from redis

After the slave library is restarted in Redis, it will be automatically added to the master-slave architecture, and the data synchronization will be completed automatically.

If persistence is implemented from the database, incremental synchronization will be achieved as long as it is re-entered into the master-slave schema.

Master downtime

If the master and slave do not have data persistence, do not restart the service immediately, otherwise data may be lost. The correct actions are as follows:

-execute SLAVEOF ON ONE on slave data to break the master-slave relationship and upgrade slave to master database

-restart the master database at this time, execute SLAVEOF, set it as a slave database, and back up the data automatically.

Necessary conditions for a cluster to enter the fail state

When a master node and all slave nodes are dead, our cluster enters the faill state.

If more than half of the cluster master is down, with or without slave, the cluster will enter the fail state.

If any master of the cluster is down, and the current master has no slave. The cluster enters the fail state

During the voting process, all master in the cluster participate. If more than half of the master nodes time out to communicate with the master node (cluster-node-timeout), the current master node is considered to be dead.

The election is based on the following order: normal network connection-> reply to INFO command within 5 seconds-> connection with master within 10*down-after-milliseconds-> priority of slave server-> replication offset-> run id is small. After selection, the slave server will be promoted to the new master server through slaveif no ont.

Ask others to copy the master server from the slave server through the slaveof ip port command.

Finally, when the old master reconnects, it becomes the slave server of the new master. Note that if the client is separated from the old master server, the written data will be lost because the old master replicates the new master's data after recovery.

The above is what downtime in redis means all the content, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report