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

Sentinel configuration of Redis master-slave cluster

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

First install redis on a single machine for the three machines, and then perform the following steps

Master 192.168.1.102

Slaver 192.168.1.104

Slaver 192.168.1.105

Modify the redis.conf configuration files of two slaver to add master configuration information

Slaveof 192.168.1.102 6379

Start three machines

Sudo. / redis-server redis.conf

Then check the information of the primary node

. / redis-cli-h 192.168.1.102 info Replication

Then check the information of the slave node.

. / redis-cli-h 192.168.1.105 info Replication

At this point, verify whether the master and slave are synchronized.

Insert data on the master connection client to see if there is data in the slaver

You can see that the master and slave have been able to successfully synchronize data

192.168.1.106

Configure sentinel

Sentinel needs to be copied over.

Cp src/redis-sentinel / usr/redis/

Cp sentinel.conf / usr/redis/

Modify the configuration file sentinel.conf

Modify settings master address and port number

Sentinel monitor mymaster 192.168.1.102 6379 2

Save

Then copy three configuration files

Sentinel1.conf sentinel2.conf sentinel3.conf

The port numbers are 26379, 36379, and 46379 respectively.

Start three processes respectively

. / redis-sentinel sentinel1.conf

. / redis-sentinel sentinel2.conf

. / redis-sentinel sentinel3.conf

Test cluster

Shut down the redis service of 192.168.1.102

View the information of 192.168.1.104 which was originally slaver on 192.168.1.106

. / redis-cli-h 192.168.1.104 info Replication

You can see that 192.168.1.104 has become master,slaver is 192.168.1.105

Reconnect 192.168.1.102

Found that 192.168.1.102 has become a slave node

So far, the whole cluster has been built.

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

Servers

Wechat

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

12
Report