redis 主从同步配置方案
今天研究了redis主从同步部分的配置,在这里留个备忘!
闲话少续,上配置!
这是redis-master.conf
daemonize yespidfile /var/run/redis-master.pidport 6379timeout 0loglevel verboselogfile stdoutdatabases 16save 60 100rdbcompression yesdbfilename dump-master.rdbdir /usr/local/redis/dataslave-serve-stale-data yesrequirepass ooxxooappendonly no appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbslowlog-log-slower-than 10000slowlog-max-len 128maxclients 128maxmemory 1gbvm-enabled novm-swap-file /tmp/redis.swapvm-max-memory 0vm-page-size 32vm-pages 134217728vm-max-threads 4hash-max-zipmap-entries 512hash-max-zipmap-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64activerehashing yes
daemonize nopidfile /var/run/redis-slave.pidport 7379timeout 0loglevel verboselogfile stdoutdatabases 16save 60 100rdbcompression yesdbfilename dump-slave.rdbdir /usr/local/redis/dataslave-serve-stale-data yesslaveof 127.0.0.1 6379masterauth ooxxooappendonly noappendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbslowlog-log-slower-than 10000slowlog-max-len 128maxclients 128maxmemory 1gbvm-enabled novm-swap-file /tmp/redis.swapvm-max-memory 0vm-page-size 32vm-pages 134217728vm-max-threads 4hash-max-zipmap-entries 512hash-max-zipmap-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64activerehashing yes
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
# echo vm.overcommit_memory=1 >> /etc/sysctl.conf# sysctl vm.overcommit_memory=1