units单位:
# 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.
1 配置大小单位,开头定义了一些基本的度量单位,只支持bytes,不支持bit
2 对大小写不敏感
INCLUDES包含
# 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.conf
和我们的Struts2配置文件类似,可以通过includes包含,redis.conf可以作为总闸,包含其他
GENERAL通用
1.daemonize
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes //是否以守护进程运行,默认是no,我这里设置为yes。后台运行。
2.pidfile
# When the server runs non daemonized, no pid file is created if none is
# specified in the configuration. When the server is daemonized, the pid file
# is used even if not specified, defaulting to "/var/run/redis.pid".
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/redis_6379.pid
3.port
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
4.tcp-backlog
# TCP listen() backlog.
tcp-backlog 511 //默认511
设置tcp的backlog,backlog其实是一个连接队列,backlog队列总和=未完成三次握手队列 + 已经完成三次握手队列。
在高并发环境下你需要一个高backlog值来避免慢客户端连接问题。注意Linux内核会将这个值减小到/proc/sys/net/core/somaxconn的值,所以需要确认增大somaxconn和tcp_max_syn_backlog两个值
来达到想要的效果
5.timeout
# Close the connection after a client is idle for N seconds (0 to disable) //在客户端N秒空闲时间后,关闭连接。默认不关闭连接,一直开启。
timeout 0
6.bind
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~绑定指定ip,可以绑定多个,如果允许全部ip访问,就注释下面bind指令
#bind 127.0.0.1
7.tcp-keepalive
# A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis 3.2.1.
tcp-keepalive 300 //从redis3.2.1版开始,默认值是300s
单位为秒,如果设置为0,则不会进行Keepalive检测,建议设置成60
8.loglevel
# 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 //日志级别。有debug,verbose,notice,warning,层次上升,输出也就越来越少
9.logfile
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile "" //日志文件名,默认为空
10.syslog-enabled
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# syslog-enabled no
//是否把日志输出到syslog中,默认注释了
11.syslog-ident
# Specify the syslog identity.
# syslog-ident redis
指定syslog里的日志标志
12.syslog-facility
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
指定syslog设备,值可以是USER或LOCAL0-LOCAL7
13.databases
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between 0 and 'databases'-1
databases 16
redis默认有16个库,默认操作的是db 0,可以select dbid选择操作那个库
SNAPSHOTTING快照
1.Save the DB on disk
# save <seconds> <changes>
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
save 900 1 // save 秒钟 写操作次数
save 300 10
save 60 10000
RDB是整个内存的压缩过的Snapshot,RDB的数据结构,可以配置复合的快照触发条件,
默认
是1分钟内改了1万次,
或5分钟内改了10次,
或15分钟内改了1次。
禁用:
# save ""
如果想禁用RDB持久化的策略,只要不设置任何save指令,或者给save传入一个空字符串参数也可以
2.stop-writes-on-bgsave-error //如果为yes,后台持久化出现错误时就停止写操作
如果配置成no,表示你不在乎数据不一致或者有其他的手段发现和控制
3. rdbcompression //是否压缩
rdbcompression:对于存储到磁盘中的快照,可以设置是否进行压缩存储。如果是的话,redis会采用LZF算法进行压缩。如果你不想消耗CPU来进行压缩的话,可以设置为关闭此功能
4. rdbchecksum
rdbchecksum:在存储快照后,还可以让redis使用CRC64算法来进行数据校验,但是这样做会增加大约10%的性能消耗,如果希望获取到最大的性能提升,可以关闭此功能
5. dbfilename
# The filename where to dump the DB
dbfilename dump.rdb
rdb的默认文件名
6. dir
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./ //dump.rdb默认是生成在你运行redis的目录下
REPLICATION复制(主从复制,之后详细完善)
SECURITY安全
requirepass dingxu
在客户端执行命令时需要:AUTH <PASSWORD>授权
LIMITS限制
1.maxclients
设置redis同时可以与多少个客户端进行连接。默认情况下为10000个客户端。当你无法设置进程文件句柄限制时,redis会设置为当前的文件句柄限制值减去32,因为redis会为自身内部处理逻辑留一些句柄出来。如果达到了此限制,redis则会拒绝新的连接请求,并且向这些连接请求方发出“max number of clients reached”以作回应。
2.maxmemory
设置redis可以使用的内存量。一旦到达内存使用上限,redis将会试图移除内部数据,移除规则可以通过maxmemory-policy来指定。如果redis无法根据移除规则来移除内存中的数据,或者设置了“不允许移除”,那么redis则会针对那些需要申请内存的指令返回错误信息,比如SET、LPUSH等。
但是对于无内存申请的指令,仍然会正常响应,比如GET等。如果你的redis是主redis(说明你的redis有从redis),那么在设置内存使用上限时,需要在系统中留出一些内存空间给同步队列缓存,只有在你设置的是“不移除”的情况下,才不用考虑这个因素
3.maxmemory-policy
(1)volatile-lru:使用LRU算法移除key,只对设置了过期时间的键
(2)allkeys-lru:使用LRU算法移除key
(3)volatile-random:在过期集合中移除随机的key,只对设置了过期时间的键
(4)allkeys-random:移除随机的key
(5)volatile-ttl:移除那些TTL值最小的key,即那些最近要过期的key
(6)noeviction:不进行移除。针对写操作,只是返回错误信息
4.maxmemory-samples
设置样本数量,LRU算法和最小TTL算法都并非是精确的算法,而是估算值,所以你可以设置样本的大小,
redis默认会检查这么多个key并选择其中LRU的那个
APPEND ONLY MODE追加
1. appendonly
2. appendfilename
3.appendfsync
always:同步持久化 每次发生数据变更会被立即记录到磁盘 性能较差但数据完整性比较好
everysec:出厂默认推荐,异步操作,每秒记录 如果一秒内宕机,有数据丢失
no
4.no-appendfsync-on-rewrite:重写时是否可以运用Appendfsync,用默认no即可,保证数据安全性。
5.auto-aof-rewrite-min-size:设置重写的基准值
6.auto-aof-rewrite-percentage:设置重写的基准值
- Redis(四):解析配置文件redis.conf
解析配置文件redis.conf目录导航: 它在哪 Units单位 INCLUDES包含 GENERAL通用 SNAPSHOTTING快照 REPLICATION复制 SECURITY安全 LIMIT ...
- 4、解析配置文件 redis.conf、Redis持久化RDB、Redis的主从复制
1.Units单位 配置大小单位,开头定义了一些基本的度量单位,只支持bytes,不支持bit 对大小写不敏感 2.INCLUDES包含 和我们的Struts2配置文件类似,可以通过includes包 ...
- Redis学习四:解析配置文件 redis.conf
一.它在哪 地址: 思考:为什么要将它拷贝出来单独执行? 二.Units单位 1 配置大小单位,开头定义了一些基本的度量单位,只支持bytes,不支持bit 2 对大小写不敏感 三.INCLUDES包 ...
- 4.解析配置文件 redis.conf
将原始的redis.conf拷贝,得到一个myRedis.conf文件,修改配置文件时,就修改这个文件,不对原始的配置文件进行修改 redis配置文件中主要有以下内容: 1.units单位 a)配置大 ...
- 解析配置文件 redis.conf
1.units单位 2.INCLUDES包含 3.GENERAL通用 1).daemonize daemonize yes 启用后台守护进程运行模式 2).pidfile pidfile /var/r ...
- Redis的配置文件redis.conf的解析
1.redis的配置文件为redis.conf 2.redis配置文件redis.conf中关于网络的配置 3.redis配置文件redis.conf中的日志配置 4.redis配置文件redis.c ...
- [转]Reids配置文件redis.conf中文详解
转自: Reids配置文件redis.conf中文详解 redis的各种配置都是在redis.conf文件中进行配置的. 有关其每项配置的中文详细解释如下: 对应的中文版解释redis.conf # ...
- redis配置文件redis.conf参数说明
redis配置文件redis.conf参数说明 (2013-01-09 21:20:40)转载▼ 标签: redis配置 redis.conf 配置说明 杂谈 分类: nosql # By defau ...
- Redis 配置文件 redis.conf 项目详解
Redis.conf 配置文件详解 # [Redis](http://yijiebuyi.com/category/redis.html) 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, ...
随机推荐
- CentOS ping www.baidu.com 报错 name or service not know
今天尝试安装了centos系统 玩一玩 刚刚装好的操作系统 ping www.baidu.com的时候 报出 name or service not known 查了好多资料,都没有很好的解决 最后 ...
- MongoDB系列四(索引).
一.索引简介 再来老生常谈一番,什么是索引呢?数据库索引与书籍的索引类似.有了索引就不需要翻整本书,数据库可以直接在索引中查找,在索引中找到条目以后,就可以直接跳转到目标文档的位置,这能使查找速度提高 ...
- powerdesigner将name的名字赋给comment
1 PowerDesigner中批量根据对象的name生成comment的脚本 执行方法:Open PDM -- Tools -- Execute Commands -- Run Script Vb ...
- H5的canvas绘图技术
canvas元素是HTML5中新添加的一个元素,该元素是HTML5中的一个亮点.Canvas元素就像一块画布,通过该元素自带的API结合JavaScript代码可以绘制各种图形和图像以及动画效果. 1 ...
- CentOS在线安装Mysql5.7
一.通过Yum命令安装 1.下载rpm安装源 官方地址:https://dev.mysql.com/downloads/repo/yum/ rpm文件地址:https://dev.mysql.com/ ...
- 使用YOLOv2进行图像检测
基本配置信息 tensorflow (1.4.0) tensorflow-tensorboard (0.4.0) Keras (2.1.5) Python (3.6.0) Anaconda 4.3.1 ...
- winform中的数据绑定
1. 简单的数据绑定 例1 using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[& ...
- [ZooKeeper] 1 基本概念
ZooKeeper: A Distributed Coordination Service for Distributed Applications ZooKeeper is a distribute ...
- 【实验吧】CTF_Web_简单的SQL注入之2
直接输入11'报语法错误,然后输入1' and '1'='1 报SQLi detected!,说明有防护,输入1'and'1'='1回显ID: 1'and'1'='1 name: baloteli ...
- [NOIp 2014]联合权值
Description 无向连通图G 有n 个点,n - 1 条边.点从1 到n 依次编号,编号为 i 的点的权值为W i ,每条边的长度均为1 .图上两点( u , v ) 的距离定义为u 点到v ...