# 日志 # Specify the server verbosity level. # This can be one of: # debug (a lot of information, useful for development/testing) # verbose (many rarely useful info, but not a mess like the debug level) # notice (moderately verbose, what you want in production probably) # warning (only very important / critical messages are logged) loglevel notice logfile ""# 日志的文件位置名 databases 16 # 数据库的数量,默认是16个数据库 always-show-logo yes # 是否总是显示LOGO
快照
持久化,在规定化的时间内,执行了多少次操作,则会持久化到文件 .rdb .aof
redis 是内存数据库,如果没有持久化,那么数据会断电丢失!
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 如果900s内,至少有1个key进行了修改,我们就会进行持久化操作 save 900 1 # 如果300s内,至少有10个key进行了修改,我们就会进行持久化操作 save 300 10 # 如果60s内,至少有10000个key进行了修改,我们就会进行持久化操作 save 60 10000
127.0.0.1:6379> ping PONG 127.0.0.1:6379> config get requirepass # 查看密码,默认没有 1) "requirepass" 2) "" 127.0.0.1:6379> config set requirepass "123456"# 设置redis的密码 OK 127.0.0.1:6379> config get requirepass # 再执行命令就不能执行了 (error) NOAUTH Authentication required. 127.0.0.1:6379> ping # 也不能ping通了 (error) NOAUTH Authentication required. 127.0.0.1:6379> auth 123456 # 登录 OK 127.0.0.1:6379> config get requirepass # 登录成功之后就可以了 1) "requirepass" 2) "123456" 127.0.0.1:6379>
CLIENTS 客户端的一些限制
1
maxclients 10000 # 设置能连接上redis的最大客户端数量
MEMORY MANAGEMENT 内存达到上限之后的处理策略
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
maxmemory <bytes> # redis最大内存容量
571 # volatile-lru -> Evict using approximated LRU among the keys with an expire set. 572 # allkeys-lru -> Evict any key using approximated LRU. 573 # volatile-lfu -> Evict using approximated LFU among the keys with an expire set. 574 # allkeys-lfu -> Evict any key using approximated LFU. 575 # volatile-random -> Remove a random key among the ones with an expire set. 576 # allkeys-random -> Remove a random key, any key. 577 # volatile-ttl -> Remove the key with the nearest expire time (minor TTL) 578 # noeviction -> Don't evict anything, just return an error on write operations.