当前位置:网站首页>Redis進階
Redis進階
2022-04-22 07:22:00 【shooter7】
Redis.conf詳解
啟動的時候,通過配置文件來啟動。
- 單比特

- 配置文件unit單比特,對大小寫不敏感
- 包含其他的配置文件

就好比我們學習Spring,Import,include - 網絡
bind 127.0.0.1 #綁定的ip
protected-mode yes #保護模式
port 6379 #端口設置
- 通用
# 以守護進程的方式運行,默認是no,我們需要自己開啟為yes
daemonize yes
# 如果以後臺的方式運行,我們就需要指定一個pid文件
pidfile /var/run/redis_6379.pid
#日志
# 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)
# warning (only very important / critical messages are logged)
loglevel notice
# 日志的文件比特置名,如果為空,則就是標准的輸出
logfile ""
# 數據庫的數量,默認是16個數據庫
databases 16
#是否總是顯示logo
set-proc-title yes
- 快照
持久化,在規定的時間內,執行了多少次操作,則會持久化到文件,有.rdb .aof兩種方式。
redis是內存數據庫,如果沒有持久化,那麼會斷電即失。
# 如果900s內,如果至少有一個key進行了修改,我們即進行持久化操作
save 900 1
# 如果300內,如果至少有10個key進行了修改,我們即進行持久化操作
save 300 10
# 如果900s內,如果至少有10000個key進行了修改,我們即進行持久化操作
save 60 10000
# 持久化如果出錯,是否還需要繼續工作!
stop-writes-on-bgsave-error yes
# 是否壓縮rdb文件需要消耗一些CPU資源。
rdbcompression yes
# 保存rdb文件的時候,進行錯誤的檢查校驗
rdbchecksum yes
#rdb文件保存的目錄
dir ./
- REPLICATION複制,我們後面講解主從複制的時候再進行講解
- SECURITY安全
可以在這裏設置redis的密碼,默認是沒有密碼的!

- 限制 CLIENTS
#設置能連接上redis的最大的客戶端的數量
maxclients 10000
# redis配置最大的內存容量
maxmemory <bytes>
# 內存達到上限之後的處理策略
maxmemory-policy noeviction
1、volatile-lru:只對設置了過期時間的key進行LRU(默認值)
2、allkeys-lru : 删除lru算法的key
3、volatile-random:隨機删除即將過期key
4、allkeys-random:隨機删除
5、volatile-ttl : 删除即將過期的
6、noeviction : 永不過期,返回錯誤
- APPEND ONLY MODE aof配置
#默認不開啟aof模式
appendonly no
# 持久化文件的名字
appendfilename "appendonly.aof"
# appendfsync always #每次都會修改sync,消耗性能
appendfsync everysec # 每秒執行一次sync,可能會丟失s的數據。
# appendfsync no #不執行sync,這個時候操作系統自己會同步數據,速度最快。
具體的配置,在Redis的持久化中給大家詳解!
版权声明
本文为[shooter7]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220612283075.html
边栏推荐
- 微信浏览器无法长期保存cookie
- What is socket programming?
- 【数论】素数(三):素数判断法(朴素法、模6法、Rabin-Miller及改进)
- Write a method Sanjiao (a, B, c) to judge whether the three parameters can form a triangle. If not, throw an exception illegalargumentexception and display the exception information a, B, C "cannot fo
- . net learning notes (I) -- introduction, advantages, design ideas, principles and applications of generics
- 【数论】素数(四):数的分解(Pollard-rho)
- [number theory] prime number (4): decomposition of numbers (Pollard rho)
- 【数论】素数(五):梅森素数(Lucas_Lehmer判定法)
- JVM中唯一一个不会发生GC和OOM的存储区域
- sql server快速入门
猜你喜欢
![[bug notes] antd table height adaptive window height](/img/44/b6d2dc589520767fe6f7d0e428f684.png)
[bug notes] antd table height adaptive window height

. net learning notes (2) -- ubiquitous reflection (including the method of reading JSON)

二叉树链式结构操作LeetCode+牛客(详解)

1. Compile the following three modules of student information management system: and detect the implementation. 1. Add student information 4. Query student information 5. Query all student information

Choose any novel website, crawl any novel and save it in the form of Notepad.

Process of stepping on the pit in the flutter environment

面试官常问的,对象分配的一般过程及特殊情况

Flutter环境搭建踩坑过程

定义类Shape作为父类,并在类中定义方法求周长和面积; (2)定义Shape子类圆形(circle),具有半径属性和常量PI,同时重写父类中的方法; (3)定义Shape子类长方形(rect

JS realizes clicking avatar to upload picture modification
随机推荐
(五) 使用Navicat创建数据库数据表并设置id自增
【数论】素数(一):基本概念、性质、猜想、定理
[number theory] prime number (2): prime number sieve method (Egyptian sieve, Euler sieve, interval sieve)
win10修改命令行默认字体
csdn文字样式
[number theory] congruence (2): inverse element
最强数组学习之路
最强操作符学习之路(C语言详解)
Robomaster大疆飞手考核
在类加载的过程中,类变量的分配区域和实例变量的分配区域不一样
secureCRT无限循环脚本
The only storage area in the JVM where GC and oom will not occur
浅谈时间复杂度与空间复杂度
MacOS installs redis and sets the service self start
win10 anaconda安装cocotb
Escape analysis in JVM can realize that memory is not allocated on the heap
顺序表 增删查(找)
Raspberry Pi 4b
Prompt the user to enter his name, and the user will write his name to the file guest Txt program determines that when it is not equal to N, it executes to create the file data Txt, a total of 100000
[DRC 23-20] Rule violation (REQP-1712) Input clock driver - Unsupported PLLE2_ ADV connectivity.