redis配置文件的介绍

来源:互联网 发布:js伪类选择器 编辑:程序博客网 时间:2024/05/21 22:30

安全

首先,redis默认是空密码的,可以通过config get requirepass查看当前的密码,在redis看来,它只负责利用缓存存储,安全问题是linux的责任,所以是空密码,如果你要设置密码,也是可以的config set requirepass "1234567"设置了密码,下次你要输入密码的时候是这个命令 auth 1234567


缓存(几种缓存清理策略)

MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
is reached. You can select among five behaviors:
1,volatile-lru -> Evict using approximated LRU among the keys with an expire set.
2,allkeys-lru -> Evict any key using approximated LRU.
3, volatile-lfu -> Evict using approximated LFU among the keys with an expire set.
4,volatile-random -> Remove a random key among the ones with an expire set.
5,allkeys-random -> Remove a random key, any key.
6,volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
7,noeviction -> Don’t evict anything, just return an error on write operations.

以上摘自redis.conf配置文件:

volatile-lru:使用LRU算法移除key,只对设置了过期时间的键(与操作系统的LRU算法一样)
allkeys-lru :使用LRU算法移除key
volatile-random: 在过期的集合中移除随机的key
allkeys-random:移除随机的key
volatile-ttl:移除那些TTL(time to leave)值最小的key,即那些最近要过期的的key(这个也类似于操作系统调度的哪个算法忘了)
noeviction:不进行移除,针对写操作,只是返回错误信息(这个在公司企业实际操作过程中绝对不允许的)


到了企业,具体怎么配置?看下面:

daemonize yes   //启用守护进程timeout 3000loglevel verbose logfile stdout
原创粉丝点击