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