- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 docker 中将 redis 与 image: redis:5.0.3
一起使用,我时常需要面对所有 key 。我试图弄清楚发生了什么。首先检查 maxmemory-policy
和 maxmemory
看起来是正确的,但也许 noeviction
应该在最上面?
127.0.0.1:6379> config get maxmemory-policy
1) "maxmemory-policy"
2) "noeviction"
127.0.0.1:6379> config get maxmemory
1) "maxmemory"
2) "0"
然后检查了我的 redis_server.conf
,看起来是正确的 maxmemory-policy noeviction
root@ec59084b3d77:/data# cat /etc/redis-server/redis_server.conf
# General
port 6379
bind 0.0.0.0
#dir /var/lib/redis
timeout 0
tcp-keepalive 20
tcp-backlog 10000
loglevel notice
logfile ""
databases 16
# Snapshotting
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
# Replication
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
min-slaves-max-lag 10
# Security
# Limits
maxclients 30000
maxmemory-policy noeviction
# Append Only Mode
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
# Lua
lua-time-limit 5000
# Slow Log
slowlog-log-slower-than 10000
slowlog-max-len 128
# Event Notification
notify-keyspace-events ""
# Advanced
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
但我的 key 有时会消失,昨天我有 7514 个 key ,但今天我发现只有 76 个。我检查它执行了 keys *
或 dbsize
。
你能帮帮我吗,请检查我的redis配置。
当我使用 image: redis:alpine
时也是如此。 maxmemory-policy 和 maxmemory 的结果相同。我以为当键用完所有内存时我应该面对允许内存大小的错误,但没有,只是消失键。
最佳答案
您的 redis.conf
看起来不错,您正在执行的关于内存和驱逐的命令也表明了这一点。
redis documentation说
noeviction return errors when the memory limit was reached and the client is trying to execute commands that could result in more memory to be used (most write commands, but DEL and a few more exceptions).
因此,如果您有 n 个应用程序与此 Redis 通信,其中 maxmemory
设置为 zero
并且 eviction policy
为 noeviction
然后当你超过限制时,那些应用程序将抛出异常。如果您没有收到任何 OOM
错误/异常,那么我乐观的猜测是它与 eviction
无关。
以下是我可能会建议的可能出现的问题和调试解决方案;
从 7514 急剧下降到 74。我认为可以;
restart
/shutdown
事件的相关日志。flushall
/flushdb
。
密码
,也许您可以设置并更新您的客户端,看看它是否会再次发生。关于Redis maxmemory-policy noeviction 但键消失无误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61386223/
我是一名优秀的程序员,十分优秀!