incrby redis 最大值_Redis——设置最大内存 | key淘汰机制
前言
原有的内存淘汰机制没有设置导致redis持久化的时候,内存直接爆掉
步骤
修改配置 | 重启服务
修改redis.conf的配置文件,并重启redis服务
############################## MEMORY MANAGEMENT ################################
# Set a memory usage limit to the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys
# according to the eviction policy selected (see maxmemory-policy).
#
# If Redis can't remove keys according to the policy, or if the policy is
# set to 'noeviction', Redis will start to reply with errors to commands
# that would use more memory, like SET, LPUSH, and so on, and will continue
# to reply to read-only commands like GET.
#
# This option is usually useful when using Redis as an LRU or LFU cache, or to
# set a hard memory limit for an instance (using the 'noeviction' policy).
#
# WARNING: If you have replicas attached to an instance with maxmemory on,
# the size of the output buffers needed to feed the replicas are subtracted
# from the used memory count, so that network problems / resyncs will
# not trigger a loop where keys are evicted, and in turn the output
# buffer of replicas is full with DELs of keys evicted triggering the deletion
# of more keys, and so forth until the database is completely emptied.
#
# In short... if you have replicas attached it is suggested that you set a lower
# limit for maxmemory so that there is some free RAM on the system for replica
# output buffers (but this is not needed if the policy is 'noeviction').
#
maxmemory 32212254720
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select among five behaviors:
#内存不足的情况下,有以下几种移除key的方式供你选择
# volatile-lru -> Evict using approximated LRU among the keys with an expire set.
# allkeys-lru -> Evict any key using approximated LRU.
# volatile-lfu -> Evict using approximated LFU among the keys with an expire set.
# allkeys-lfu -> Evict any key using approximated LFU.
# volatile-random -> Remove a random key among the ones with an expire set.
# allkeys-random -> Remove a random key, any key.
# volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
# noeviction -> Don't evict anything, just return an error on write operations.
#
# LRU means Least Recently Used
# LFU means Least Frequently Used
#
# Both LRU, LFU and volatile-ttl are implemented using approximated
# randomized algorithms.
#
# Note: with any of the above policies, Redis will return an error on write
# operations, when there are no suitable keys for eviction.
#
# At the date of writing these commands are: set setnx setex append
# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
# getset mset msetnx exec sort
#
# The default is:
#volatile-ttl 移除设置过过期时间且最近要过期的key
maxmemory-policy volatile-ttl
# LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated
# algorithms (in order to save memory), so you can tune it for speed or
# accuracy. For default Redis will check five keys and pick the one that was
# used less recently, you can change the sample size using the following
# configuration directive.
#
# The default of 5 produces good enough results. 10 Approximates very closely
# true LRU but costs more CPU. 3 is faster but not very accurate.
#
# maxmemory-samples 5
# Starting from Redis 5, by default a replica will ignore its maxmemory setting
# (unless it is promoted to master after a failover or manually). It means
# that the eviction of keys will be just handled by the master, sending the
# DEL commands to the replica as keys evict in the master side.
#
# This behavior ensures that masters and replicas stay consistent, and is usually
# what you want, however if your replica is writable, or you want the replica to have
# a different memory setting, and you are sure all the writes performed to the
# replica are idempotent, then you may change this default (but be sure to understand
# what you are doing).
#
# Note that since the replica by default does not evict, it may end using more
# memory than the one set via maxmemory (there are certain buffers that may
# be larger on the replica, or data structures may sometimes take more memory and so
# forth). So make sure you monitor your replicas and make sure they have enough
# memory to never hit a real out-of-memory condition before the master hits
# the configured maxmemory setting.
#
# replica-ignore-maxmemory yes
动态修改 | 无需重启
scrm:0>config set maxmemory 32212254720
"OK"
scrm:0>config get maxmemory
1) "maxmemory"
2) "32212254720"
scrm:0>config set maxmemory-policy volatile-ttl
"OK"
scrm:0>config gscrm-taibao:0>et maxmemory-policy
1) "maxmemory-policy"
2) "volatile-ttl"
incrby redis 最大值_Redis——设置最大内存 | key淘汰机制相关推荐
- incrby redis 最大值_Redis 的 8 大数据类型,写得非常好!
NoSQL 开发中或多或少都会用到,也是面试必问知识点.最近这几天的面试每一场都问到了.但是感觉回答的并不好,还有很多需要梳理的知识点. Redis-key 127.0.0.1:6379> ke ...
- incrby redis 最大值_redis incr incrby decr decrby命令
incr.incrby.decr.decrby命令的作用和用法 redis中incr.incrby.decr.decrby属于string数据结构,它们是原子性递增或递减操作. incr递增1并返回递 ...
- 笔记【Redis数据结构、常用命令、key淘汰及持久化策略】
文章目录 简要介绍 服务安装 数据结构 通用命令 字符串类型命令 散列类型命令 列表类型命令 集合类型命令 有序集合类型命令 HyperLogLog命令 GeoHash命令(地图坐标) 排序命令 事务 ...
- redis 用户订单缓存_Redis实战(12)-基于Key失效和定时任务实现订单支付超时自动失效...
"商城平台用户下单"这一业务场景相信很多小伙伴并不陌生,在正常的情况下,用户在提交完订单/下完单之后,应该是前往"收银台"选择支付方式进行支付,之后只需要提供相 ...
- Redis内存淘汰机制
Redis内存淘汰机制 网趣科技 2016-09-06 13:26 摘要 Redis是一款优秀的.开源的内存数据库,我在阅读Redis源码实现的过程中,时时刻刻能感受到Redis作者为更好地使用内存而 ...
- c# redis hashid如何设置过期时间_Redis中Key过期策略amp;淘汰机制
1. Redis中设置Key过期时间 我们有两种方式设置过期时间 1.1 设置多久后过期 设置一个 key 10s 过期,可以这样 127.0.0.1:6379> SET key value E ...
- redis value最大值_Redis基础知识整理
Redis安装和使用 使用Docker安装Redis docker run --name redis -p 6379:6379 --restart always -d redis 使用redis-cl ...
- redis value最大值_Redis value的5种类型及常见操作
Redis本身存储就是一个hash表,实际实࣫比hash表更复一些,后续讲存储结构时会细讲 Key只有String类型 Value包括String ,Set,List,Hash,Zset五中类型 ST ...
- redis value最大值_Redis 的 maxmemory 和 dbnum 默认值都是多少?对于最大值会有限制吗?...
一.Redis 的默认配置 了解 Redis 的都知道,Redis 服务器状态有很多可配置的默认值. 例如:数据库数量,最大可用内存,AOF 持久化相关配置和 RDB 持久化相关配置等等.我相信,关于 ...
最新文章
- Openstack安装部署
- 【代码】CyclicBarrier栅栏使用示例
- (常用API)正则表达式语法规则
- 使用cython加密python代码
- QT-Qt获取当前时间并格式化输出及将积秒转换成时间
- Java如何避免重量级锁,Java 中锁是如何一步步膨胀的(偏向锁、轻量级锁、重量级锁)...
- 赋值给集合_ArrayList集合源码
- KerasSeq2seqGeneration:基于seq2seq模型的文本生成任务项目
- Python 中的json字符串以及使用
- C# CLRInsideOut 托管代码与非托管代码互操作,产生相关调用代码的好工具 C++ 头文件转C# 的好工具...
- MIT Scheme编译scm文件
- 【SQL Server】入门教程-基础篇(完结)
- OpenCore引导配置说明第十一版说明-基于OpenCore-0.6.4正式版
- 基于android的酒店客房预订客户端app
- Windows事件查看器介绍
- 新浪企业邮箱服务器怎么设置,新浪企业邮箱|手机端设置
- linuxwindows应急响应
- 把数组改为用逗号隔开的形式
- 帝国cms如何域名html的专题,帝国cms 二级域名绑定栏目的最完美的解决方案
- 计算机d盘无法格式化,电脑D盘无法格式化怎么办