记一次公司新服务器Ubuntu16.04.6初始化配置 (三) redis启动报警问题解决

以前查看redis启动日志时发现redis启动时有几条报警,之前在解决这些问题时没做记录,以至于今天安装redis后还要问度娘怎么解决,这次就记录一下方便下次查找。

警告1:

828:M 30 May 19:20:29.837 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. 828:M 30 May 19:20:29.838 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted. 828:M 30 May 19:20:29.838 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
这个问题根据redis的提示是解决不了的,

解决方法:

第一步: 修改redis.cnf配置文件,默认在/etc/redis/redis.cnf,配置maxclients 为10000(默认就是10000)
在这里插入图片描述
第二步: 修改redis.service文件,默认在/etc/systemd/system/redis.service
在Group下面添加 LimitNOFILE=65536
在这里插入图片描述
第三步:执行下面重启命令使配置生效
sudo systemctl daemon-reload
sudo systemctl restart redis.service

警告2

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中,然后执行sudo sysctl -p生效配置。

警告3

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中,然后执行sudo sysctl -p生效配置

警告4

you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting 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生效配置,注意要放在exit 0前面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值