当前位置:网站首页>REDIS00_ Explain redis Conf configuration file
REDIS00_ Explain redis Conf configuration file
2022-06-28 16:02:00 【What you get is a surprise】
List of articles
①. Units - Company
- Units: Company ,Redis The units in the configuration file are case insensitive
Units are case insensitive , therefore 1GB 1Gb 1gB It's all the same
# Redis configuration file example
# 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.
# [ translate ] Units are case insensitive , therefore 1GB 1Gb 1gB It's all the same .
②. includes - Include
- includes: contain , Can be in Redis Load some more at startup except Redis.conf Configuration files other than , and Spring Of import,jsp Of include similar
################################## 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 runtime.
#
# 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 c:\path\to\other.conf
③. NETWORK - The Internet
①. bind: The Internet , Express Redis The port opened at startup is bound to the local machine by default
②. protected-mode:yes Whether to turn on the protection mode ,Redis Default on , If not set bind Of IP Address and Redis password , Then the service can only run locally by default
################################## NETWORK #####################################
# By default, ...
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ ...
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# [ effect ] The Internet , Express Redis The port opened at startup is bound to the local machine by default
bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# ...
# [ effect ] Whether to turn on the protection mode ,Redis Default on , If not set bind Of IP Address and Redis password , Then the service can only run locally by default
protected-mode yes
# [ translate ] Accept connections on the specified port , The default is 6379 (IANA #815344).
# [ translate ] If the port 0 To be designated ,Redis Will not monitor TCP Socket .
# [ effect ]Redis Specify listening port , The default is 6379
port 6379
# ...
# [ effect ] Indicates how long the server has been idle ( second ) Closed after , If this value is 0, Indicates that this function does not work
timeout 0
④. GENERAL - The guardian thread
- daemonize yes: Run as a daemon , The default is no, We need to turn it on ourselves yes
daemonize yes # Run as a daemon , The default is no, We need to turn it on ourselves yes!
pidfile /var/run/redis_6379.pid # If it runs in the background mode , We need to specify one pid file !
# journal
# 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) Production environment
# warning (only very important / critical messages are logged)
loglevel notice
logfile "" # The file location name of the log
databases 16 # Number of databases , The default is 16 A database
always-show-logo yes # Always show LOGO
⑤. SNAPSHOTTING - Persistence
①. Chinese translation for snapshot , If within the prescribed time , The data has been updated several times , Then the data will be synchronized and backed up to a file
②. Redis There are two ways to persist , One is RDB, One is AOF.SNAPSHOTTING The main aim is Redis In persistence RDB
③. Redis It's a memory database , If you do not use persistence to save data , The embarrassing scene of power failure will appear
################################ SNAPSHOTTING ################################
# ...
# stay 900 Seconds , At least one key Be modified ( add to ), The persistence operation will take place
save 900 1
# stay 300 Seconds , There are at least 10 individual key Be modified , The persistence operation will take place
save 300 10
# stay 60 Seconds , There are at least 1 m key Be modified , The persistence operation will take place
save 60 10000
# If Redis An error occurred during persistence , Whether to stop writing , The default is
top-writes-on-bgsave-error yes
# Whether to compress persistent files during data backup , The default is , This operation will cost CPU resources , It can be set to no
rdbcompression yes
# While saving the persistent file , Perform data verification on the contents of the file
rdbchecksum yes
# Directory where persistent files are saved , It is saved in the current directory by default
dir ./
⑥. REPLICATION - Master slave copy
# Copy data on the host , Specified by the current configuration IP And port number is the host
################################# REPLICATION #################################
# Redis Comment this configuration in the configuration file , Default not to use , The same below
# replicaof <masterip> <masterport>
# If the configured host has a password , This password needs to be configured to pass master Validation of the
# masterauth <master-password>
⑦. SECURITY - password
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> config get requirepass # obtain redis Password
1) "requirepass"
2) ""
127.0.0.1:6379> config set requirepass "123456" # Set up redis Password
OK
127.0.0.1:6379> config get requirepass # I found that all commands have no permission
(error) NOAUTH Authentication required.
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456 # Log in with a password !
OK
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) "123456"
⑧. CLIENT - client
- volatile-lru: Only for key Conduct LRU( The default value is )
allkeys-lru: Delete lru Algorithm key
volatile-random: Random delete is about to expire key
allkeys-random: Random delete
volatile-ttl: Delete expiring
noeviction: Never expire , Returns an error
# Redis Maximum number of clients allowed , There are 10000 by default
################################### CLIENTS ####################################
# Redis Maximum number of clients allowed , There are 10000 by default
# maxclients 10000
############################## MEMORY MANAGEMENT ################################
# Redis Configure maximum memory capacity
# maxmemory <bytes>
# The default processing policy after the memory reaches the maximum
# maxmemory-policy noeviction
⑨. APPEND - Persistence
- ①. This is a Redis Another way to persist ,AOF,AOF Mode is not enabled by default ,Redis By default, the persistence mode is enabled RDB, In most cases ,RDB Our model is fully adequate
appendonly no
# AOF Persistent file name
appendfilename "appendonly.aof"
# Synchronize once per second , But this second of data may be lost
# about appendfsync It has the following properties
# appendfsync always It means that data synchronization will be performed for each modification , Slower , Consumption performance
# appendfsync no Do not perform synchronization , No performance consumption
appendfsync everysec # Data out of sync , Once per second
边栏推荐
- 分布式理论须知
- Tiktok actual battle ~ list of bloggers I follow, follow and check
- openGauss内核:SQL解析过程分析
- 10: 00 interview, came out at 10:02, the question is really too
- 讲师征集令 | Apache DolphinScheduler Meetup分享嘉宾,期待你的议题和声音!
- 首次失败后,爱美客第二次冲刺港交所上市,财务负责人变动频繁
- ROS knowledge points - ROS create workspace
- PostgreSQL 存储结构浅析
- leetcode:22. 括号生成
- 薅羊毛的机会了,点个“赚”即有机会赚取高额佣金
猜你喜欢
Qt5.5.1 configuring msvc2010 compiler and WinDbg debugger
MIPS assembly language learning-01-sum of two numbers, environment configuration and how to run
10年测试经验,在35岁的生理年龄面前,一文不值
今天睡眠质量记录80分
NAACL 2022 | 机器翻译SOTA模型的蒸馏
[leetcode] 13. Roman numeral to integer
Analysis of PostgreSQL storage structure
关注35岁的坎:畏惧是因为你没有匹配这个年纪该有的能力
Visual studio 2019 software installation package and installation tutorial
Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]
随机推荐
Android和eclipse和MySQL上传图片并获取
go-zero 微服务实战系列(七、请求量这么高该如何优化)
Operating excel with openpyxl
关注35岁的坎:畏惧是因为你没有匹配这个年纪该有的能力
关于针对tron API签名广播时使用curl的json解析问题解决方案及针对json.loads方法的问题记录
零钱兑换(动态规划)
征文投稿丨使用轻量应用服务器搭建博客环境
How can the digital intelligent supply chain management platform of the smart Park optimize process management and drive the development of the park to increase speed and quality?
tablestore中可以使用sql查询可以查出表中所有的数据吗?
深度学习基础汇总
openGauss内核:SQL解析过程分析
Soliciting articles and contributions - building a blog environment with a lightweight application server
The past and present life of distributed cap theorem
信创操作系统--麒麟Kylin桌面操作系统 (项目十 安全中心)
QT interface library
Visual Studio 2010 compilation qt5.6.3
10年测试经验,在35岁的生理年龄面前,一文不值
wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
全球陆续拥抱Web3.0,多国已明确开始抢占先机
Visual Studio 2010 configuring and using qt5.6.3