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

Explanation on redis read-write Separation and Sentinel Mechanism configuration

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

Share

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

Today, Xiaobian shared with you the explanation of redis read-write separation and sentinel mechanism configuration. Many people don't know much about it. In order to let you know more about redis read-write separation and sentinel mechanism configuration, Xiaobian summarized the following contents for you. Let's look down together. I'm sure you'll find something.

First, in/etc/redis/use the command cp redis.conf /redis63791.conf, cp redis.conf /redis63792.conf , cp redis.conf /redis63793.conf to prepare the root directory

vim redis63792.conf ---> modify the configuration file daemonize yes daemon port 63792 bind 192.168.0.3 bind intranet addresses databases 16 open 16 databases save ---> save every number of files (the owner does not need the following)slaveof 116.196.107.20 63791 --> master auth '123456789' --> authenticate the owner password----------------appendonly yes turn on security for this enhanced data (The above is the configuration file in the normal redis.conf, all slaves have to connect to the master server, can only read, can not write, automatic synchronization of data, read and write separation can greatly enhance the performance of the server, because in normal data operations, read often more than write, in general, the master and slave machine by 1:3 allocation)

Second, the sentinel configuration, find the sentinel.conf file in/etc/redis,(if you do not find such a configuration file), copy cp sentinel.conf /mysentinel.conf

vim mysentinel.confsentinel monitor mymaster 116.196.107.20 63791 1--> respectively means sentinel monitoring master:116.196.107.20 port:63791 sentinel number 1, under normal circumstances, the more the number of sentinels, the smaller the probability of voting through the election, the more time it takes to vote for a new master, not conducive to rapid switching master-slave mechanism sentinel down-after-milliseconds mymaster 5000 host dropped 5 s after authentication, if unable to connect, then re-selected from the slave by sentinel auth-mymaster 123456789 sentinel password connection master

Third, after the configuration is completed, you can open the master-slave mechanism, read and write separation, and provide a sentry mechanism, in the master down machine 5 seconds after the random selection of a new master, the previous master can only work as a slave!

redis operation command:redis-server redis63791.conf & --> Run server redis-cli -h 116.196.107.20-p 63791 remote connection server auth 123456789 ---> Verify password redis-server mysentinel.conf --sentinel in redis Start sentinel mode and start listening, as follows:

The above is a brief introduction to the explanation of redis read-write separation and sentinel mechanism configuration. Of course, the difference between using the above in detail must be understood by everyone themselves. If you want to know more, welcome to pay attention to 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