有些东西需要改一下.
如果找不到, vim请用命令/somthing
.
配置大小单位
支持字节, 不支持位, 不区分大小写1
2
3
4
5
6
7
8
9
10
11# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.INCLUDE
在该文件中可以包含其他文件的内容.1
2
3
4
5# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
#
# include /path/to/local.conf
# include /path/to/other.confNETWORK
1
2
3
4
5
6
7
8
9
10
11bind: 127.0.0.1 -::1
#只能通过本地访问, 注释掉就可以支持远程连接了
...
protect-mode yes
#本地访问保护, 将yes改为no, 就可以远程访问了
...
port 6379
#默认端口号
...
tcp-backlog 511
#连接队列, 未完成的tcp三次握手和已完成的tcp三次握手, 每300s检测一次.GENERAL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21daemonize yes
#前篇中, 为了支持后台启动, 将no改为了yes
...
pidfile /var/run/redis_6379.pid
#保存进程号文件位置
...
# 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
#日志级别, 上面是四个级别, 默认notice
...
logfile ""
#输出日志路径, 默认为空
...
databases 16
#默认16个库SECURITY
1
2# requirepass foobared
#默认没有密码, 可以手动打开, 在设置中设置密码只是临时的, 重启就还原了, 永久设置需要在配置文件中设置1
2
3
4#通过命令的方式设置密码
config get requirepass
config set requirepass "123456"
auth 123456CLIENTS
1
2# maxclients 10000
#设置客户端最大连接数, 默认10000.MEMORY MANAGEMENT
1
2
3
4
5
6
7
8
9
10
11# maxmemory <bytes>
# 设置能占用的最大的内存, redis是内存数据库, 如果不设置, 容易将内存占满, 造成服务器宕机, 默认未设置
# maxmemory-policy noeviction
# 如果内存用满了, 显然要根据一定的算法策略移除部分数据, 移除规则由它指定
# volatile-lru: LRU, 只对设置了过期时间的key
# allkeys-lru: LRU, 所有key
# volatile-random: 随机, 只对设置了过期时间的key
# allkeys-random: 随机, 对于所有key
# volatile-ttl: 移除ttl值最小的key, 即最近要过期的key
# noeviction: 不进行移除, 针对写操作, 只是返回错误信息