redis错误vm.overcommit_memory&The TCP backlog setting of 511 cannot be enforced

本文解决了Redis启动时出现的两个警告:overcommit_memory设置为0可能导致背景保存失败,通过修改配置文件或直接写入sysctl参数解决;TCP backlog设置无法强制执行,通过修改somaxconn值解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

redis错误vm.overcommit_memory&The TCP backlog setting of 511 cannot be enforced

 

 原文:

http://skly-java.iteye.com/blog/2167400

 

错误

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.

 


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

 


解决方法

第一个警告两个方式解决(overcommit_memory)

1.  echo "vm.overcommit_memory=1" > /etc/sysctl.conf  或 vi /etcsysctl.conf , 然后reboot重启机器

2.  echo 1 > /proc/sys/vm/overcommit_memory  不需要启机器就生效

 

第二个警告解决

1. echo 511 > /proc/sys/net/core/somaxconn

Starting Redis Server 1:C 09 Jun 2025 12:44:54.319 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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. 1:C 09 Jun 2025 12:44:54.320 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 09 Jun 2025 12:44:54.320 * Redis version=8.0.2, bits=64, commit=00000000, modified=1, pid=1, just started 1:C 09 Jun 2025 12:44:54.320 * Configuration loaded 1:M 09 Jun 2025 12:44:54.320 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis Open Source .-`` .-```. ```\/ _.,_ ''-._ 8.0.2 (00000000/1) 64 bit ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 1 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 1:M 09 Jun 2025 12:44:54.321 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 09 Jun 2025 12:44:54.321 * <bf> RedisBloom version 8.0.1 (Git=unknown) 1:M 09 Jun 2025 12:44:54.321 * <bf> Registering configuration options: [ 1:M 09 Jun 2025 12:44:54.321 * <bf> { bf-error-rate : 0.01 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { bf-initial-size : 100 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { bf-expansion-factor : 2 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { cf-bucket-size : 2 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { cf-initial-size : 1024 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { cf-max-iterations : 20 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { cf-expansion-factor : 1 } 1:M 09 Jun 2025 12:44:54.321 * <bf> { cf-max-expansions : 32 } 1:M 09 Jun 2025 12:44:54.321 * <bf> ] 1:M 09 Jun 2025 12:44:54.321 * Module 'bf' loaded from /usr/local/lib/redis/modules//redisbloom.so 1:M 09 Jun 2025 12:44:54.322 * <search> Redis version found by RedisSearch : 8.0.2 - oss 1:M 09 Jun 2025 12:44:54.322 * <search> RediSearch version 8.0.1 (Git=5688fcc) 1:M 09 Jun 2025 12:44:54.322 * <search> Low level api version 1 initialized successfully 1:M 09 Jun 2025 12:44:54.322 * <search> gc: ON, prefix min length: 2, min word length to stem: 4, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results: 1000000, 1:M 09 Jun 2025 12:44:54.322 * <search> Initialized thread pools! 1:M 09 Jun 2025 12:44:54.322 * <search> Disabled workers threadpool of size 0 1:M 09 Jun 2025 12:44:54.322 * <search> Subscribe to config changes 1:M 09 Jun 2025 12:44:54.322 * <search> Enabled role change notification 1:M 09 Jun 2025 12:44:54.322 * <search> Cluster configuration: AUTO partitions, type: 0, coordinator timeout: 0ms 1:M 09 Jun 2025 12:44:54.322 * <search> Register write commands 1:M 09 Jun 2025 12:44:54.322 * Module 'search' loaded from /usr/local/lib/redis/modules//redisearch.so 1:M 09 Jun 2025 12:44:54.323 * <timeseries> RedisTimeSeries version 80001, git_sha=577bfa8b5909e7ee572f0b651399be8303dc6641 1:M 09 Jun 2025 12:44:54.323 * <timeseries> Redis version found by RedisTimeSeries : 8.0.2 - oss 1:M 09 Jun 2025 12:44:54.323 * <timeseries> Registering configuration options: [ 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-compaction-policy : } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-num-threads : 3 } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-retention-policy : 0 } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-duplicate-policy : block } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-chunk-size-bytes : 4096 } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-encoding : compressed } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-ignore-max-time-diff: 0 } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> { ts-ignore-max-val-diff : 0.000000 } 1:M 09 Jun 2025 12:44:54.323 * <timeseries> ] 1:M 09 Jun 2025 12:44:54.323 * <timeseries> Detected redis oss 1:M 09 Jun 2025 12:44:54.323 * Module 'timeseries' loaded from /usr/local/lib/redis/modules//redistimeseries.so 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Created new data type 'ReJSON-RL' 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> version: 80001 git sha: unknown branch: unknown 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Exported RedisJSON_V1 API 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Exported RedisJSON_V2 API 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Exported RedisJSON_V3 API 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Exported RedisJSON_V4 API 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Exported RedisJSON_V5 API 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Enabled diskless replication 1:M 09 Jun 2025 12:44:54.323 * <ReJSON> Initialized shared string cache, thread safe: false. 1:M 09 Jun 2025 12:44:54.323 * Module 'ReJSON' loaded from /usr/local/lib/redis/modules//rejson.so 1:M 09 Jun 2025 12:44:54.323 * <search> Acquired RedisJSON_V5 API 1:M 09 Jun 2025 12:44:54.323 * Server initialized 1:M 09 Jun 2025 12:44:54.323 * <search> Loading event starts 1:M 09 Jun 2025 12:44:54.323 * <search> Enabled workers threadpool of size 4 1:M 09 Jun 2025 12:44:54.323 * Loading RDB produced by version 7.4.2 1:M 09 Jun 2025 12:44:54.323 * RDB age 11115 seconds 1:M 09 Jun 2025 12:44:54.323 * RDB memory usage when created 3.81 Mb 1:M 09 Jun 2025 12:44:54.327 # FATAL: Data file was created with a Redis server configured to handle more than 16 databases. Exiting
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值