[redis@Centos6 ~]$ cat run/redis-3.2.6/redis.confredis
# Redis configuration file example.安全
#服务器
# Note that in order to read the configuration file, Redis must be网络
# started with the file path as first argument:dom
#socket
# ./redis-server /path/to/redis.conftcp
# Note on units: when memory size is needed, it is possible to specifyide
# it in the usual form of 1k 5GB 4M andso forth:[l1] oop
#
# 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.[l2]
####### INCLUDES ###################################
#Include one or more other config files here. This is useful if you
# have a standard template that goes toall Redis servers but also need
# to customize a few per-serversettings. Include files can include
# other files, so use this wisely.[l3]
#
# Noticeoption "include" won't be rewritten by command "CONFIGREWRITE"
# from admin or Redis Sentinel. SinceRedis always uses the last processed
# line as value of a configurationdirective, you'd better put includes
# at the beginning of this file to avoidoverwriting config change at runtime.[l4]
#
# Ifinstead you are interested in using includes to override configuration
# options, it is better to use include asthe last line.[l5]
#
# include /path/to/local.conf
# include /path/to/other.conf
######NETWORK #####################################[l6]
# Bydefault, if no "bind" configuration directive is specified, Redislistens
# for connections from all the networkinterfaces available on the server.
# It is possible to listen to just one ormultiple selected interfaces using
# the "bind" configurationdirective, followed by one or more IP addresses.[l7]
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfacesis dangerous and will expose the
# instance to everybody on the internet.So by default we uncomment the
# following bind directive, that willforce Redis to listen only into
# the IPv4 lookback interface address(this means Redis will be able to
# accept connections only from clientsrunning into the same computer it
# is running).[l8]
#
# IFYOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.[l9]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1
# Protectedmode is a layer of security protection, in order to avoid that
# Redis instances left open on theinternet are accessed and exploited.[l10]
#
# Whenprotected mode is on and if:[l11]
#
# 1)The server is not binding explicitly to a set of addresses using the
# "bind" directive.[l12]
# 2) Nopassword is configured.[l13]
#
#The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses127.0.0.1 and ::1, and from Unix domain
# sockets.[l14]
#
# Bydefault protected mode is enabled. You should disable it only if
# you are sure you want clients fromother hosts to connect to Redis
# even if no authentication isconfigured, nor a specific set of interfaces
# are explicitly listed using the"bind" directive.[l15]
#Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will notlisten on a TCP socket.[l17]
port 6379
#
#In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connectionsissues. Note that the Linux kernel
# will silently truncate it to the valueof /proc/sys/net/core/somaxconn so
# make sure to raise both the value ofsomaxconn and tcp_max_syn_backlog
# in order to get the desired effect.[l19]
tcp-backlog 511
# Unix socket.
#
#Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is nodefault, so Redis will not listen
# on a unix socket when not specified.[l20]
#
# unixsocket /tmp/redis.sock
# unixsocketperm 700
# Closethe connection after a client is idle for N seconds (0 to disable)[l21]
timeout 0
# TCP keepalive.
#
# Ifnon-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful fortwo reasons:[l22]
#
# 2) Take the connection alive from thepoint of view of network
# equipment in the middle.[l23]
#
# OnLinux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection thedouble of the time is needed.
# On other kernels the period depends onthe kernel configuration.[l24]
#
#A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis3.2.1.[l25]
tcp-keepalive 300
[l1]当须要为某个配置项指定内存大小的时候,必需要带上单位,同城的格式是1k,5gb,4m等
[l2]单位不区分大小写,1GB,1GB,1GB都同样。
[l3]在此处包含一个或多个其余配置文件。若是您有一个标准模板可用于全部Redis服务器,但还须要自定义几个每服务器设置,这将很是有用。包含文件能够包括其余文件,所以请明智地使用。
[l4]注意选项“include”不会被来自admin或RedisSentinel的命令“CONFIG REWRITE”重写。因为Redis老是使用最后处理的行做为配置指令的值,所以最好将include包含在此文件的开头,以免在运行时覆盖配置更改
[l5]相反,若是你有兴趣使用包括覆盖配置选项,最好是使用包括做为最后一道防线。
[l6]网络配置说明
[l7]默认状况下,若是没有指定“bind”配置指令,Redis会监听来自服务器上全部可用网络接口的链接。 可使用“绑定”配置指令侦听一个或多个选定的接口,而后跟一个或多个IP地址。
[l8]~~~警告~~~若是运行Redis的计算机直接暴露在互联网上,绑定到全部接口是危险的,而且会将实例暴露给互联网上的每一个人。所以,在默认状况下,咱们取消如下绑定指令,这将迫使Redis的只监听到的IPv4回望接口地址(这意味着Redis的将只能从运行到正在运行在同一台计算机的客户端接受链接)。
[l9]若是你确信你想你的实例可以监听到全部的界面,注释下面一行。
[l10]保护模式是安全的保护层,以免该Redis的实例留在互联网上公开被访问和利用。
[l11]当保护模式打开时,若是:
[l12]1)服务器没有使用“bind”指令明确绑定到一组地址。
[l13]2)未配置密码。
[l14]服务器只接受来自从IPv4和IPv6环回地址127.0.0.1和:: 1以及从Unix域套接字链接的客户端的链接。
[l15]默认状况下启用保护模式。 只有确保您但愿来自其余主机的客户端链接到Redis,即便未配置身份验证,也不会使用“bind”指令明确列出特定的接口集,才应禁用它。
[l16]启用保护模式
[l17]接受指定端口上的链接,默认值为6379(IANA#815344)。若是指定端口0,Redis将不会侦听TCP套接字。
[l18]TCP监听的最大容纳数量
[l19]在高请求每秒环境中,您须要一个高的容纳数量,以免缓慢的客户端链接问题。注意,Linux内核会将其默认截断为/ proc / sys / net / core / somaxconn的值,所以请务必同时提升somaxconn和tcp_max_syn_backlog的值,以得到所需的效果。
[l20]指定将用于侦听传入链接的Unix套接字的路径。 没有默认值,因此Redis在没有指定的时候不会监听unixsocket
[l21]客户端空闲N秒后关闭链接(0禁用)
[l22]若是非零,则使用SO_KEEPALIVE在没有通讯的状况下向客户端发送TCP ACK。这有两个缘由:
[l23]1)检测死对等体。
2)从中间的网络设备的角度来看链接活着
[l24]在Linux上,指定的值(以秒为单位)是用于发送ACK的周期。注意,要关闭链接,须要两倍的时间。在其余内核上,周期取决于内核配置。
[l25]此选项的合理值为300秒,这是从Redis 3.2.1开始的新Redis默认值。