redis从库配置

865 阅读1分钟

redis.config配置

  1. 指定master,slaveof 127.0.0.1 6379
  2. master的password,masterauth password
  3. 注意当前slave端口port 6379,requirepass
  4. 注意pidfile /var/run/redis_6379.pid
  5. 指定logfile,不指定会没日志输出到/dev/null

启动出错

  1. MASTER aborted replication with an error: NOAUTH Authentication required
master服务器需要密码,masterauth未设置
  1. 警告,日志给出了解决办法,如overcommit_memory=0在save时内存不够可能失败,修改为1允许内存耗尽超限
7730:S 14 Jul 17:56:36.654 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7730:S 14 Jul 17:56:36.654 # Server initialized
7730:S 14 Jul 17:56:36.654 # 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.
7730:S 14 Jul 17:56:36.654 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
7730:S 14 Jul 17:56:36.654 # Can't handle RDB format version 9
7730:S 14 Jul 17:56:36.654 # Fatal error loading the DB: Invalid argument. Exiting.
  1. 上面日志汇总错误(Can't handle RDB format version 9)
删除目录下的dump.rdb,然后启动