Redis learning and practice 2 --- Redis master/slave Replication

Source: Internet
Author: User
1. Introduce the masterslave data replication method of Redis, which can be one master, one slave, or one master, multiple slaves. Redis is in the non-blocking mode on the master, that is, when the slave executes data synchronization, master is OK

I. Introduction Redis master/slave Data Replication mode can be one master, one slave, or one master and multiple slave, Redis is in non-blocking mode on the master, that is, when slave executes data synchronization, master is OK

, That is, in ,,.
Service, while

Daemonize yespidfile redis-slave.pidport 6380 timeout 300 loglevel verboselogfile limit 16 save 900 1 save 300 10 save 60 10000 rdbcompression yesdbfilename dump-slave.rdbdir/usr/local/redis/var/slaveof 127.0.0.1 6379 appendonly limit everysec

Start slave:

./Redis-server redis-slave.conf

3. Configure an instance:

I have two machines, one linux machine A (ip: 172.16.205.186) and the other windows machine B (ip: 192.168.30.86 ). Server A is configured with A master with port 6379 and Server Load balancer with port 6380. Server B is configured with slave2 and Server Load balancer with ports 6380 and 6381 respectively.

The configuration of A's Linux machine is as follows:

[Root @ DEV etc] # lsredis. conf redis-slave1.conf [root @ DEV etc] # cat redis. confdaemonize yespidfile/usr/local/redis/var/redis. pidport 6379 timeout 300 loglevel debuglogfile/usr/local/redis/var/redis. logdatabases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yesdbfilename dump. rdbdir/usr/local/redis/var/appendonly noappendfsync always [root @ DEV etc] # cat redis-slave1.confdaemonize yespidfile redis-slave.pidport 6380 timeout 300 loglevel verboselogfile stdoutdatabases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yesdbfilename dump-slave.rdbdir/usr/local/redis/var/slaveof 127.0.0.1 6379 appendonly noappendfsync everysec

B's Windows server configuration is as follows:

Slave2:

Daemonize yespidfile redis-slave2.pidport 6380 timeout 300 loglevel verboselogfile stdout2databases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yesdbfilename dump-slave2.rdbdir./slaveof 172.16.205.186 6379 appendonly no

Slave3:

Daemonize yespidfile redis-slave3.pidport 6381 timeout 300 loglevel verboselogfile stdout3databases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yesdbfilename dump-slave3.rdbdir./slaveof 172.16.205.186 6379 appendonly no

In this way, a linux master, a server Load balancer instance, and a windows Server Load balancer instance are implemented. Of course, a server Load balancer instance can also be used as the master of another Server Load balancer instance. "To the corresponding slave information.

This article is from the "Flying snails" blog. Please keep this source

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.