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

Redis Sentinel sentinel

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

Share

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

# Sentinel sentinel

Configure 3 redis (1 master and 2 slaves) and 1 sentry. The steps are as follows:

Cp redis.conf redis1.conf

Cp redis.conf redis2.conf

Cp redis.conf redis3.conf

# created 3 redis profiles and 1 Sentinel profile: redis01 is set to master, redis02,redis03 is set to slave

Vi redis01.conf

Port 6380

Requirepass beijing-configure the redis Master password to beijing

Masterauth beijing

Vi redis02.conf

Port 6381

Requirepass beijing-configure the redis Slave password to beijing

Masterauth beijing-because slave needs to interact with master, it needs to be configured on slave

Slaveof 127.0.0.1 6380

Vi redis03.conf

Port 6382

Requirepass beijing-configure the redis Slave password to beijing

Masterauth beijing-because slave needs to interact with master, it needs to be configured on slave

Slaveof 127.0.0.1 6380

Vi sentinel.conf

Daemonize yes

Port 26379

Sentinel monitor mymaster 127.0.0.1 6380 1 # explain the following meaning

Sentinel auth-pass mymaster beijing

Pidfile "/ var/run/sentinel_26379.pid"

Logfile "/ usr/local/redis/bin/sentinel_26379.log"

Protected-mode no

The above master-slave configuration is familiar with, only the Sentinel configuration sentinel.conf, you need to explain:

The name of the mymaster master node, which can be taken freely, and will be used when connecting in the later program.

127.0.0.1 63790 ip,port of the primary node

The number 1 followed by 1 indicates the number of votes cast when the primary node is elected. 1 means that you can upgrade to master with the consent of a sentinel.

Redis Sentinel

If the redis Sentinel cluster is used in the system, the original master may become slave when switching master, so you also need to configure masterauth on the original redis master:

# vi / path/to/conf/6379.conf

Masterauth beijing-in the configuration of Sentinel, you also need to enter the obtained master password:

# vi / path/to/conf/sentinel.conf

Sentinel auth-pass master beijing-master is your custom sentinel cluster maste

# start Sentinel and use jedis to connect Sentinel to operate redis

. / redis-server redis1.conf

. / redis-server redis2.conf

. / redis-server redis3.conf

. / redis-server sentinel.conf-- sentinel

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

Wechat

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

12
Report