当前位置:网站首页>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
边栏推荐
- 软件测试员的悲哀竟是...自己的技术能力不能满足大厂要求?
- 经典模型——Transformer
- 3. Caller 服务调用 - dapr
- 零钱兑换(动态规划)
- wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
- Privacy computing fat - offline prediction
- CODING DevOps 助力中化信息打造新一代研效平台,驱动“线上中化”新未来
- IPDK — Overview
- 物联网云融合安全指南
- VC2010 编绎Qt5.6.3 提示 CVTRES : fatal error CVT1107:
猜你喜欢

Flutter simply implements multilingual internationalization

Innovation and upgrading of supply chain system driven management mode in petrochemical industry and strengthening internal management of enterprises

Soliciting articles and contributions - building a blog environment with a lightweight application server

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?

Jenkins的安装及使用

Etcd可视化工具:Kstone简介(一)

Focus on the 35 year old Kan: fear is because you don't have the ability to match your age
![The k-th element in the array [heap row + actual time complexity of heap building]](/img/69/bcafdcb09ffbf87246a03bcb9367aa.png)
The k-th element in the array [heap row + actual time complexity of heap building]

Realization of a springboard machine

In depth learning foundation summary
随机推荐
Notes to distributed theory
MIPS assembly language learning-01-sum of two numbers, environment configuration and how to run
北京有哪些牛逼的中小型公司?
Fleet | "backstage exploration" issue 3: status management
Privacy computing fat - offline prediction
Qt 界面库
Qt create 5.0.3 配置Qt4.8.7
Curve 替换 Ceph 在网易云音乐的实践
一台服务器最大并发 tcp 连接数多少?65535?
Xinchuang operating system -- kylin kylin desktop operating system (project 10 security center)
MongoDB 在腾讯零售优码中的应用
A bug liver a week I can't help mentioning issue
IPDK — Overview
Practice of curve replacing CEPH in Netease cloud music
PostgreSQL enables grouping statistics by year, month, day, week, hour, minute and second
Etcd可视化工具:Kstone简介(一)
看界面控件DevExpress WinForms如何创建一个虚拟键盘
Navicat 15 for MySQL
关注35岁的坎:畏惧是因为你没有匹配这个年纪该有的能力
Application of mongodb in Tencent retail premium code