当前位置:网站首页>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 redis in Linux
- Factory mode and constructor mode
- Swiftui layout - size (top)
- AFNetworking速成教程
- [leetcode] sticker spelling (dynamic planning)
- Qtableview in QT sets three methods of paging display [easy to understand]
- How long can we "eat" the dividends of domestic databases?
- SwiftUI 布局 —— 尺寸( 下 )
- 2022年安全员-A证操作证考试题库模拟考试平台操作
- (function(global,factory){
猜你喜欢

Redis-Redis在Jedis中的使用

Thoughts on the construction of some enterprise data platforms

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

8、 Picker usage drop-down box selection effect

C语言实现简单学生成绩管理系统的方法
C # read INI file and key value pair operation

2022 melting welding and thermal cutting examination questions and online simulation examination

Copy excel row to specified row

九、uni-popup用法 下拉框底部弹窗效果

It's so hot that solar power can't take off? Hello, head
随机推荐
2022年熔化焊接与热切割考题及在线模拟考试
C语言库函数getchar()怎么使用
Store and guarantee rancher data based on Minio objects
468 product planning and promotion plan (150 copies)
八、picker用法 下拉框选择效果
2022年熔化焊接与热切割考题及在线模拟考试
力扣解法汇总1331-数组序号转换
Hcip day 11
Force deduction solution summary 1331 array sequence number conversion
Redis-持久化
Installing redis in Linux
Error reason for converting string to long type: to convert to long type, it must be int, double, float type [easy to understand]
How does core data save data in SQLite
Recommended super easy-to-use mobile screen recording software
国产数据库的红利还能“吃”多久?
工厂模式和构造函数模式
C # read INI file and key value pair operation
2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination
How to perform batch operations in core data
String转为long 类型报错原因:要转为long必须是int、double、float型[通俗易懂]