当前位置:网站首页>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 !
边栏推荐
- Installing MySQL on Linux
- Swiftui layout - alignment
- HCIP第十二天
- Excel VBA 免密查看VBE加密代码
- Why is it reverse to convert from other formats to BMP
- Raspberry pie foundation | summarize and record some operations in the learning process of raspberry pie
- ZABBIX distributed
- 聊天室功能的实现
- Focus on differentiated product design, intelligent technology efficiency improvement and literacy education around new citizen Finance
- Mobile phone scrolling screenshot software recommendation
猜你喜欢

It's so hot that solar power can't take off? Hello, head

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

多所“双一流”大学,保研预报名启动!

Langjing Technology (Trax China) "robot +ai" opens the era of Chinese retail meta universe

Xcode编写SwiftUI代码时一个编译通过但导致预览(Preview)崩溃的小陷阱
C# 获取当前路径7种方法

The method of implementing simple student achievement management system with C language

Tdengine helps Siemens' lightweight digital solutions

Focus on differentiated product design, intelligent technology efficiency improvement and literacy education around new citizen Finance

Forage QR code -- online QR code generator
随机推荐
SwiftUI 的动画机制
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
多线程顺序运行有几种方法?
Metersphere -- Open Source continuous testing platform
Cv:: mat conversion to qimage error
Recommended super easy-to-use mobile screen recording software
These three online PS tools should be tried
I am using a blog creation tool
Raspberry pie foundation | summarize and record some operations in the learning process of raspberry pie
How to effectively conduct the review meeting (Part 1)?
Animation mechanism of swiftui
为 @CloudStorage 添加了类 @Published 的能力
Excel VBA 开发过程中遇到的一些问题,解决方案,持续更新
九、uni-popup用法 下拉框底部弹窗效果
2022高处安装、维护、拆除考试题库及在线模拟考试
面试官:ThreadLocal使用场景有哪些?内存泄露问题如何避免?
Redis-Redis在Jedis中的使用
【七夕】七夕孤寡小青蛙究极版?七夕节最终章!
[线程安全问题] 多线程到底可能会带来哪些风险?
linux安装redis