当前位置:网站首页>Redis configuration file explanation
Redis configuration file explanation
2022-07-28 14:44:00 【Although the sunset is not as beautiful as you】
Preface
As the saying goes : Experts have wood ! You know it when you do it !
The previous study is just to let us know How to use Redis , But we as developers , You have to know why , So we have to fundamentally understand , Let's take Redis.conf Study the document carefully , Improve yourself ! Flying self !
In practice : Some little configuration , It can make you stand out !
1. Company :Redis Configuration is case insensitive !

2. contain : build Redis When the cluster , have access to includes Contains other configuration files

3. The Internet :

explain :
bind 127.0.0.1 # The binding of ip
protected-mode yes # Protected mode
port 6379 # Port settings
4. Universal GENERAL
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
5. snapshot (RDB): Persistence , Within the specified time , The number of operations performed will be persisted to the file .rdb .aof file
Redis Is a memory database , If there is no persistence , If the data is powered off, it will be lost !
# If 900s Inside , If there is at least one 1 key It's been modified , We do persistence operations
save 900 1
# If 300s Inside , If at least 10 key It's been modified , We do persistence operations
save 300 10
# If 60s Inside , If at least 10000 key It's been modified , We do persistence operations
save 60 10000
# We'll learn about persistence later , Will define the test itself !
6.SECURITY Security
You can set it up here Redis Password , There is no password by default .
① Set by command
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 The password for 123456
OK
# Ctrl+C Exit the current connection
[[email protected] bin]# redis-cli -p 6379 # Reconnect the
127.0.0.1:6379> ping # test ping, Failure , All commands show no permission
(error) NOAUTH Authentication required.
127.0.0.1:6379> set k1 v1 # Failure , All commands show no permission
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456 #auth + password Land on it
OK
127.0.0.1:6379> ping # normal
PONG
127.0.0.1:6379> config get requirepass # Get password , normal
1) "requirepass"
2) "123456"
② By modifying the configuration file settings , Find the location shown , Add password

restart Redis test !
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> ping
PONG
7. Limit CLIENTS
maxclients 10000 # Settings can be connected to redis The maximum number of clients
maxmemory <bytes> #redis Configure maximum memory capacity
maxmemory-policy noeviction # The processing strategy after the memory reaches the upper limit
1、volatile-lru: Only for key Conduct LRU( The default value is )
2、allkeys-lru : Delete lru Algorithm key
3、volatile-random: Random delete is about to expire key
4、allkeys-random: Random delete
5、volatile-ttl : Delete expiring
6、noeviction : Never expire , Returns an error
8.APPEND ONLY Pattern aof To configure ( Persistent save )
appendonly no # The default is not on aof Mode , The default is to use rdb Way persistent , In most cases ,rdb Quite enough !
appendfilename "appendonly.aof" # The name of the persistent file
# appendfsync always # Every time you make a change, it will sync. Consumption performance
appendfsync everysec # Once a second sync, You may lose this 1s The data of !
# appendfsync no # Don't execute sync, At this time, the operating system synchronizes its own data , The fastest !
边栏推荐
猜你喜欢

OKR and grad

9、 Uni popup usage popup effect at the bottom of the drop-down box

数字化转型安全问题频发,山石网科助力数字政府建设

Career planning of Software Test Engineer

十、时间戳

Redis-配置文件讲解

Installing MySQL on Linux

2022年熔化焊接与热切割考题及在线模拟考试

Raspberry pie foundation | summarize and record some operations in the learning process of raspberry pie

面试官:ThreadLocal使用场景有哪些?内存泄露问题如何避免?
随机推荐
10、 Timestamp
为自定义属性包装类型添加类 @Published 的能力
Animation mechanism of swiftui
35道MySQL面试必问题图解,这样也太好理解了吧
9、 Uni popup usage popup effect at the bottom of the drop-down box
八、picker用法 下拉框选择效果
Swiftui layout - alignment
2022低压电工考试题及答案
unittest执行runTestCase提示<_io.TextIOWrapper name=‘<stderr>‘ mode=‘w‘ encoding=‘utf-8‘>解决方案
复制excel行到指定行
BGP experiment
Development and definition of software testing
如何只降3D相机不降UI相机的分辨率
UI开发中所遇到的各种坑
国产数据库的红利还能“吃”多久?
Thrift 序列化协议浅析
2022 melting welding and thermal cutting examination questions and online simulation examination
Factory mode and constructor mode
[ecmascript6] modularization
Metersphere -- Open Source continuous testing platform