当前位置:网站首页>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
边栏推荐
- 一种跳板机的实现思路
- 【LeetCode】13、罗马数字转整数
- Grand launch of qodana: your favorite CI code quality platform
- PostgreSQL 存储结构浅析
- 10: 00 interview, came out at 10:02, the question is really too
- NFT质押LP流动性挖矿系统开发详情
- Gartner发布当前至2024年的五大隐私趋势
- What useful supplier management systems are available
- Summary of language features of fluent dart
- Fleet | background Discovery issue 3: Status Management
猜你喜欢

Basic grammar of C language
![数组中的第K大元素[堆排 + 建堆的实际时间复杂度]](/img/69/bcafdcb09ffbf87246a03bcb9367aa.png)
数组中的第K大元素[堆排 + 建堆的实际时间复杂度]

What are the most powerful small and medium-sized companies in Beijing?

Big God explains open source buff gain strategy live lecture

讲师征集令 | Apache DolphinScheduler Meetup分享嘉宾,期待你的议题和声音!

10: 00 interview, came out at 10:02, the question is really too

wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module

Qt create 5.0.3 配置Qt4.8.7

Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(上)

Etcd可视化工具:Kstone简介(一)
随机推荐
Privacy computing fat - offline prediction
征文投稿丨使用轻量应用服务器搭建博客环境
PostgreSQL enables grouping statistics by year, month, day, week, hour, minute and second
Etcd可视化工具:Kstone简介(一)
The past and present life of distributed cap theorem
In depth learning foundation summary
Ffmpeg forbidden output banner log (30)
The world has embraced Web3.0 one after another, and many countries have clearly begun to seize the initiative
【MySQL】表连接为什么比子查询快
Qt create 5.0.3 配置Qt4.8.7
Web worker poll request
QT interface library
10: 00 interview, came out at 10:02, the question is really too
What are the most powerful small and medium-sized companies in Beijing?
开源大咖说 - Linus 与 Jim 对话中国开源
抖音实战~我关注的博主列表、关注、取关
Today's sleep quality record is 80 points
MIPS assembly language learning-03-cycle
知道这几个命令让你掌握Shell自带工具
MIPS assembly language learning-01-sum of two numbers, environment configuration and how to run