Redis installation, master-slave, master-slave switchover

Source: Internet
Author: User
Tags failover
Network Environment: MASTER: 10.187.120.5 slave: 10.187.69.58 slave: 10.187.69.59 1. InstallationMusic redis-2.8.19.tar.gz/export/servers/CD/export/servers/tar zxf redis-2.8.19.tar.gzcd redis-2.8.19make & make install 2. Build a master-slave EnvironmentMASTER: 10.187.120.5conf/redis_62.16.conf (src/redis-server CONF/redis_62.16.conf)
daemonize yespidfile /export/Data/redis_pid/redis_6379.pidport 6379# tcp-backlog 511timeout 300tcp-keepalive 0loglevel noticelogfile /export/Logs/redis/redis_6379.logdatabases 16stop-writes-on-bgsave-error yesrdbcompression yesdbfilename 6379.rdbdir /export/Data/redis_data/6379slave-serve-stale-data yesslave-read-only yesrepl-disable-tcp-nodelay norepl-backlog-size 128mbmaxmemory 2gappendonly noappendfilename 6379.aofappendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mblua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 1024# notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64# hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 512mb 256mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10rename-command keys jkeys

 

 

From: 10.187.69.58conf/redis_62.16.conf (src/redis-server CONF/redis_62.16.conf)
daemonize yesslaveof  10.187.120.5 6379pidfile /export/Data/redis_pid/redis_6379.pidport 6379# tcp-backlog 511timeout 300tcp-keepalive 0loglevel noticelogfile /export/Logs/redis/redis_6379.logdatabases 16stop-writes-on-bgsave-error yesrdbcompression yesdbfilename 6379.rdbdir /export/Data/redis_data/6379slave-serve-stale-data yesslave-read-only yesrepl-disable-tcp-nodelay norepl-backlog-size 128mbmaxmemory 2gappendonly noappendfilename 6379.aofappendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mblua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 1024# notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64# hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 512mb 256mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10rename-command keys jkeys
From: 10.187.69.59conf/redis_62.16.conf (src/redis-server CONF/redis_62.16.conf)
daemonize yesslaveof  10.187.120.5 6379pidfile /export/Data/redis_pid/redis_6379.pidport 6379# tcp-backlog 511timeout 300tcp-keepalive 0loglevel noticelogfile /export/Logs/redis/redis_6379.logdatabases 16stop-writes-on-bgsave-error yesrdbcompression yesdbfilename 6379.rdbdir /export/Data/redis_data/6379slave-serve-stale-data yesslave-read-only yesrepl-disable-tcp-nodelay norepl-backlog-size 128mbmaxmemory 2gappendonly noappendfilename 6379.aofappendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mblua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 1024# notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64# hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 512mb 256mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10rename-command keys jkeys

Iii. Master-slave switchover

MASTER: 10.187.120.5conf/sentinel_262.16.conf (src/redis-sentinel CONF/sentinel_262.16.conf)
port 26379daemonize yessentinel monitor mymaster 10.187.120.5 6379 2sentinel down-after-milliseconds mymaster 10000sentinel failover-timeout mymaster 900000#sentinel can-failover mymaster yessentinel config-epoch mymaster 0# Generated by CONFIG REWRITEdir "/export/servers/redis-2.8.19"sentinel leader-epoch mymaster 0sentinel known-slave mymaster 10.187.69.59 6379sentinel known-slave mymaster 10.187.69.58 6379#sentinel known-sentinel mymaster 10.187.69.59 26379 84ac24684dc485bc0c4bcf84a03d7cdb12d32ac9#sentinel known-sentinel mymaster 10.187.69.58 26379 68da3e5c7d7da1ac1dfb542741bd89181fdda580sentinel current-epoch 0

 

From: 10.187.69.58sentinel _ 26379. conf (src/redis-sentinel CONF/sentinel_262.16.conf)
daemonize yesport 26379sentinel monitor mymaster 10.187.120.5 6379 2sentinel down-after-milliseconds mymaster 10000sentinel failover-timeout mymaster 900000#sentinel can-failover mymaster yessentinel config-epoch mymaster 0#Generated by CONFIG REWRITEdir "/export/servers/redis-2.8.19"sentinel leader-epoch mymaster 0sentinel known-slave mymaster 10.187.69.58 6379# Generated by CONFIG REWRITEsentinel known-slave mymaster 10.187.69.59 6379sentinel current-epoch 0

 

From: 10.187.69.59sentinel _ 26379. conf (src/redis-sentinel CONF/sentinel_262.16.conf)
daemonize yesport 26379sentinel monitor mymaster 10.187.120.5 6379 2sentinel down-after-milliseconds mymaster 10000sentinel failover-timeout mymaster 900000#sentinel can-failover mymaster yessentinel config-epoch mymaster 0#Generated by CONFIG REWRITEdir "/export/servers/redis-2.8.19"sentinel leader-epoch mymaster 0sentinel known-slave mymaster 10.187.69.58 6379# Generated by CONFIG REWRITEsentinel known-slave mymaster 10.187.69.58 6379sentinel known-slave mymaster 10.187.69.59 6379sentinel current-epoch 0

 


 

Redis installation, master-slave, master-slave switchover

Related Article

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.