Redis配置文件(1)units/includes/GENERAL/SECURITY/LIMITS
redis.conf文件
在Linux进行文件的查看!
units单位:
# 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 => bytes
# 1kb => bytes
# 1m => bytes
# 1mb => * bytes
# 1g => bytes
# 1gb => ** bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
################################## INCLUDES ##############################
# Include one or more other config files here. This is useful if you
# have a standard template that goes to all Redis servers but also need
# to customize a few per-server settings. Include files can include
# other files, so use this wisely.
#
# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
# from admin or Redis Sentinel. Since Redis always uses the last processed
# line as value of a configuration directive, you'd better put includes
# at the beginning of this file to avoid overwriting config change at runti me.
#
# 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
GENERAL
# If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
#
# 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 fi le
# 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
# 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 daemoniz ed.
daemonize yes
# Accept connections on the specified port, default is (IANA #).
# If port is specified Redis will not listen on a TCP socket.
port 6379
# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
tcp-backlog 511 tcp-backlog
设置tcp的backlog,backlog其实是一个连接队列,backlog队列总和=未完成三次握手队列 + 已经完成三次握手队列。
在高并发环境下你需要一个高backlog值来避免慢客户端连接问题。注意Linux内核会将这个值减小到
/proc/sys/net/core/somaxconn的值,所以需要确认增大somaxconn和tcp_max_syn_backlog两个值
来达到想要的效果
# Close the connection after a client is idle for N seconds ( to disable)
timeout
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is seconds, which is the new
# Redis default starting with Redis 3.2..
tcp-keepalive 300
单位为秒,如果设置为0,则不会进行Keepalive检测,建议设置成60
# 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
日志级别
# 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 ""
日志的名字
# Set the number of databases. The default database is DB , you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between and 'databases'-
databases 16
系统默认的库16个
默认使用0库
# 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中
系统日志默认时关着
# Specify the syslog identity.
# syslog-ident redis 指定syslog里的日志标志
设备以redis开头
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
指定syslog设备,值可以是USER或LOCAL0-LOCAL7
默认使用local0
SECURITY安全
访问密码的查看、设置和取消

设置密码:
config set requirepass " "
;
改为空的时候默认没有密码!
################################## SECURITY ################################### # Require clients to issue AUTH <PASSWORD> before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
要求必须auth + password 在任何命令之前

设置redis同时可以与多少个客户端进行连接。默认情况下为10000个客户端。当你
无法设置进程文件句柄限制时,redis会设置为当前的文件句柄限制值减去32,因为redis会为自
身内部处理逻辑留一些句柄出来。如果达到了此限制,redis则会拒绝新的连接请求,并且向这
些连接请求方发出“max number of clients reached”以作回应。
maxmemory
设置redis可以使用的内存量。一旦到达内存使用上限,redis将会试图移除内部数据,移除规则可以通过maxmemory-policy来指定。
如果redis无法根据移除规则来移除内存中的数据,或者设置了“不允许移除”,
那么redis则会针对那些需要申请内存的指令返回错误信息,比如SET、LPUSH等。
但是对于无内存申请的指令,仍然会正常响应,比如GET等。如果你的redis是主redis(说明你的redis有从redis),
那么在设置内存使用上限时,需要在系统中留出一些内存空间给同步队列缓存,只有在你设置的是“不移除”的情况下,才不用考虑这个因素
()volatile-lru:使用LRU算法移除key,只对设置了过期时间的键
()allkeys-lru:使用LRU算法移除key
()volatile-random:在过期集合中移除随机的key,只对设置了过期时间的键
()allkeys-random:移除随机的key
()volatile-ttl:移除那些TTL值最小的key,即那些最近要过期的key
()noeviction:不进行移除。针对写操作,只是返回错误信息
LRU 算法或者 TTL 算法都是不是很精确算法,而是 个近似算法。

maxmemory-samples
设置样本数量,LRU算法和最小TTL算法都并非是精确的算法,而是估算值,所以你可以设置样本的大小,
redis默认会检查这么多个key并选择其中LRU的那个
Redis配置文件(1)units/includes/GENERAL/SECURITY/LIMITS的更多相关文章
- redis深入学习(二)-----redis配置文件、持久化
redis配置文件 地址 units单位 a 配置大小单位,开头定义了一些基本的度量单位,只支持bytes,不支持bitb 对大小写不敏感 GENERAL通用 1.daemonize 2.pidf ...
- linux资源使用配置文件 /etc/security/limits.conf和ulimit
limits.conf文件实际上是linux PAM中pam_limits.so的配置文件,而且只针对于单个会话. limits.conf的格式如下: <domain> <type& ...
- Linux资源使用配置文件 /etc/security/limits.conf
Linux资源使用配置文件 /etc/security/limits.conf http://www.linuxidc.com/Linux/2012-05/59489.htm Linux就这个范儿P5 ...
- /etc/security/limits.conf配置文件详解
这个文件主要是用来限制用户对系统资源的使用.是/lib64/security/pam_limits.so模块对应的/etc/serurity/pam_limits的配置文件. # /etc/secur ...
- Redis 配置文件详解
# Redis 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, 5GB, 4M 等类似的格式,其转换方式如下(不区分大小写)## 1k => 1000 bytes# 1kb => ...
- 4 Redis 配置文件介绍
2016-12-22 14:28:39 该系列文章链接NoSQL 数据库简介Redis的安装及及一些杂项基础知识Redis 的常用五大数据类型(key,string,hash,list,set,zse ...
- windows下redis 配置文件参数说明
1.先看redis.windows.conf 文件 # Redis configuration file example # Note on units: when memory size is ne ...
- Redis配置文件redis.conf详解
一.Redis配置文件redis.conf详解 # Note on units: when memory size is needed, it is possible to specifiy # it ...
- redis配置文件redis.conf翻译、解释以及常用注意事项(持续更新中...)
# Redis configuration file example. #Redis 配置文件的示例 #如何利用配置文件启动Redis # Note that in order to read the ...
随机推荐
- HTML <a>标签的使用
<a></a>标签称作链接标记,由<a>与</a>所围的文字.图片等可以作为一个链接 Eg:<a href="index.html&qu ...
- 一、URL和URLConnection
一.简述: 在Java网络编程中,我们最常听到的一个单词是URL.URL标识了一个资源,并可以通过URL来获取这个资源.我们不知道资源具体是什么,也不需要关心怎么获取.你只需要拿到一个URL,你就可以 ...
- 解锁Spring框架姿势1
Spring 介绍:Spring 框架是一个Java平台,它为开发Java应用程序提供全面的基础架构支持.Spring负责基础架构,因此您可以专注于应用程序的开发. Spring可以让您从" ...
- IntelliJ IDEA16 热部署,解决每次修改java文件就得重启tomcat的问题
这样就可以了....
- eclipse svn使用
简单介绍一些基本操作 1.同步在Eclipse下,右击你要同步的工程->team->与资源库同步->这时会进入同步透视图,会显示出本机与SVN上内容有不同的文件,双击文件名,会显示出 ...
- Logger性能优化
最近排查线上问题,无意中发现了Logger堵塞的情况,排查的同时也做下总结,做个笔记,以防备用. 先上图,看下实际堵塞的情况 从图中可以清楚的看到标黄的都在 waiting to lock <0 ...
- 任务九:使用HTML/CSS实现一个复杂页面
任务目的 通过实现一个较为复杂的页面,加深对于HTML,CSS的实战能力 实践代码的复用.优化 任务描述 通过HTML及CSS实现设计稿 设计稿PSD文件(点击下载),效果如 效果图(点击打开) 整个 ...
- centos系统移植
今天将一个服务器上面的硬盘拆掉放到安装到另外一个服务器上面,硬盘里已经安装系统为centos6.0. 服务器 为dell的1850,好吧,在今天我还有幸搞这种“屎”前的服务器还是很幸运的! 硬盘换了之 ...
- 落地生根两周年,微软Azure进入2.0时代
By: 申元庆 微软亚太科技有限公司董事长 微软亚太研发集团首席运营官 微软中国云计算与企业总经理 仿佛就在转眼间,微软Azure已经在中国落地生根两年了. 长风破浪会有时,直挂云帆济沧海.微软云技术 ...
- 立即终止Sleep的线程
在实际工作中,我们需要每隔几分钟从API取数. while(isRunning) { work(); Thread.Sleep(5*60*1000); } 如果设置isRunning=false,也需 ...