1、文档链接:

2、相关问题

2.1、启动警告问题

2.1.1、 没有配置文件

  1. Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf

启动时候指定配置文件即可
redis-server ../redis.conf

2.1.2、TCP backlog setting

  1. WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

将net.core.somaxconn = 1024添加到/etc/sysctl.conf中,然后执行sysctl -p生效配置。

2.1.3、内存设置

  1. 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.

将vm.overcommit_memory = 1添加到/etc/sysctl.conf中,然后执行sysctl -p生效配置。

0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。2, 表示内核允许分配超过所有物理内存和交换空间总和的内存

2.1.4、警用THP

  1. 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.

将echo never > /sys/kernel/mm/transparent_hugepage/enabled添加到/etc/rc.local中,然后执行source /etc/rc.local生效配置。

2.2、集群状态出问题

2.2.1、redis从节点slave,fail,noaddr问题处理

链接
1、将该从节点剔出集群

  1. #在集群每个正常节点上执行cluster forget 故障从节点id,示例:
  2. redis-cli -h ip -p port -a 密码 cluster forget f86464011d9f8ec605.. (需要踢出集群的节点id)
  3. # 可以在任意一台有redis-cli的机器上执行,只需要将 ip port 密码 改为对应集群的节点即可

2、重新加入集群

  1. redis-cli -h ip -p port --cluster add-node 192.100.3.44:6379 192.100.3.38:6379
  2. # 192.100.3.44是重新加入的节点

3、设为其他节点的从节点

  1. redis-cli -h ip -p port cluster replicate 970cc71c4eb616be237ffd72489c31b338141f53(主节点节点的id,根据实际情况填写)
  2. # ip为需要变为从节点的ip

注意:如果是主节点坏了,可能导致数据丢失

2.2、编译出错

2.2.1、jemalloc/jemalloc.h:没有那个文件或目录

make MALLOC=libc