Sentinel of Redis HA solution

Source: Internet
Author: User

The previous article studied redis monitoring (). This article analyzes redis HA, which is widely used in keepalived + redis. I haven't figured out some problems during the analysis. The next article will mention, this article mainly studies the official sentinel.

IP 10.20.112.26/27

Redis-server 2.6.16

Official Website: http://redis.io/topics/sentinel

Sentinel is a tool for managing redis instances. It can monitor, notify, and automatically failover redis instances. Sentinel constantly checks whether the redis instance can work normally and reports the status of redis to other programs through the API. If the redis master cannot work, the Failover process is automatically started, upgrade one of the Server Load balancer instances to the master node, and reset other Server Load balancer instances to the new master node.

Sentinel is a distributed system. There is a redis-sentinel command under the src directory of the source code package. In fact, it is the same as the md5sum value of the redis-server command, you can deploy the sentinel process on multiple machines to jointly monitor redis instances.

Redis sentinel 10.20.112.26: 26379
Redis master 10.20.112.26: 6379
Redis slave 10.20.112.26: 6380
Redis slave 10.20.112.27: 6379
Redis slave 10.20.112.27: 6380

Deploy 10.20.112.26. All redis configuration files are in/etc/redis/

Redis_62.16.conf

Daemonize yes
Pidfile/var/run/redis_62.16.pid
Port 6379
Bind 0.0.0.0
Timeout 0
Tcp-keepalive 0
Loglevel notice
Logfile/var/log/redis_62.16.log
Databases 16
Save 900 1
Save 300 10
Save 60 10000
Stop-writes-on-bgsave-error yes
Rdbcompression yes
Rdbchecksum yes
Dbfilename dump_62.16.rdb
Dir ./
Slave-serve-stale-data yes
Slave-read-only yes
Repl-disable-tcp-nodelay no
Slave-priority 100
Appendonly no
Appendfsync everysec
No-appendfsync-on-rewrite no
Auto-aof-rewrite-percentage 100
Auto-aof-rewrite-min-size 64 mb
Lua-time-limit 5000
Slowlog-log-slower-than 10000
Slowlog-max-len 128
Hash-max-ziplist-entries 512
Hash-max-ziplist-value 64
List-max-ziplist-entries 512
List-max-ziplist-value 64
Set-max-intset-entries 512
Zset-max-ziplist-entries 128
Zset-max-ziplist-value 64
Activerehashing yes
Client-output-buffer-limit normal 0 0 0
Client-output-buffer-limit slave 256 mb 64 mb 60
Client-output-buffer-limit pubsub 32 mb 8 mb 60
Hz 10
Aof-rewrite-incremental-fsync yes

Redis_6380.conf

### The configuration and redis_62.16.conf are mostly the same. You only need to modify the following lines:
Pidfile/var/run/redis_6380.pid
Port 6380
Logfile/var/log/redis_6380.log
Dbfilename dump_6380.rdb

Sentinel. conf

Port 26379
Sentinel monitor mymaster 0.0.0.0 6379 1
Sentinel down-after-milliseconds MySQL master 30000
Sentinel can-failover mymaster yes
Sentinel parallel-syncs mymaster 1
Sentinel failover-timeout MySQL master 900000

After the deployment, start the redis instance, which contains three configuration files: sentinel. conf configuration files are not common, but the content is relatively small, which is easy to explain and explained at the end of the article.

Deploy 10.20.112.27

Redis_62.16.conf and redis_6380.conf are also deployed on 27. In the same way as 26, sentinel can be deployed on 27, or sentinel is not needed. I chose not to deploy sentinel.

Run the following commands on 10.20.112.26/27:

### 10.20.112.26
# Terminal 1
Redis-cli-p 6379

# Terminal 2
Redis-cli-p 6380
SLAVEOF 10.20.112.26 6379


### 10.20.112.27
# Terminal 1
Redis-cli-p 6379
SLAVEOF 10.20.112.26 6379
# Terminal 2
Redis-cli-p 6380
SLAVEOF 10.20.112.26 6379

 

Redis details: click here
Redis: click here

Recommended reading:

Redis cluster details

Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis

Redis series-installation, deployment, and maintenance

Install Redis in CentOS 6.3

Redis. conf

  • 1
  • 2
  • 3
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.