### slave daemonize yes pidfile /var/run/redis.pid port 6379 timeout 300 loglevel verbose logfile /usr/local/xiemx-redis/var/log/redis.log databases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yes dbfilename dump.rdb dir /usr/local/xiemx-redis/var/data appendonly no appendfsync everysec no-appendfsync-on-rewrite no slowlog-log-slower-than 10000 slowlog-max-len 1024 vm-enabled no vm-swap-file /tmp/redis.swap vm-max-memory 0 vm-page-size 32 vm-pages 134217728 vm-max-threads 4 hash-max-zipmap-entries 512 hash-max-zipmap-value 64 list-max-ziplist-entries 512 list-max-ziplist-value 64 set-max-intset-entries 512 activerehashing yes slaveof 192.168.1.189 6379 masterauth redis
redis复制测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
查看master端日志: [8930] 31 Jul 19:16:09 - Accepted 192.168.1.136:54774 [8930] 31 Jul 19:16:09 * Slave ask for synchronization [8930] 31 Jul 19:16:09 * Starting BGSAVE for SYNC [8930] 31 Jul 19:16:09 * Background saving started by pid 10782 [10782] 31 Jul 19:16:09 * DB saved on disk [8930] 31 Jul 19:16:09 * Background saving terminated with success [8930] 31 Jul 19:16:09 * Synchronization with slave succeeded [8930] 31 Jul 19:16:14 - DB 0: 1 keys (0 volatile) in 4 slots HT. [8930] 31 Jul 19:16:14 - 1 clients connected (1 slaves), 807320 bytes in use
查看slave端日志: [24398] 01 Aug 10:16:10 * Connecting to MASTER... [24398] 01 Aug 10:16:10 * MASTER SLAVE sync started: SYNC sent [24398] 01 Aug 10:16:10 * MASTER SLAVE sync: receiving 25 bytes from master [24398] 01 Aug 10:16:10 * MASTER SLAVE sync: Loading DB in memory [24398] 01 Aug 10:16:10 * MASTER SLAVE sync: Finished with success [24398] 01 Aug 10:16:15 - DB 0: 1 keys (0 volatile) in 4 slots HT. [24398] 01 Aug 10:16:15 - 1 clients connected (0 slaves), 798960 bytes in use
1 2 3 4 5 6 7
master端操作: redis 127.0.0.1:6379> set k_m master OK