当前位置: 首页 > news >正文

Redis 数据的持久化 RDB、AOF、RDB + AOF、No persistence 各自优缺点

文章目录

    • 一、RDB (Redis Database)
      • 1.1 RDB 优势
      • 1.2 RDB 缺点
      • 1.3 RDB 如何工作
      • 1.4 RDB配置
      • 1.5 开启/关闭,RDB快照策略,save指令
      • 1.6 持久化硬盘文件,dbfilename指令
      • 1.7 持久化硬盘文件的存储地址,dir指令
    • 二、AOF (Append Only File)
      • 2.1 AOF 优势
      • 2.2 AOF 缺点
      • 2.3 AOF 如何工作
      • 2.4 AOF配置
      • 2.5 开启/关闭,appendonly指令
      • 2.6 AOF文件,appendfilename指令
      • 2.7 AOF文件目录,dir指令
      • 2.8 AOF追加策略,appendfsync指令
      • 2.9 AOF写入被意外中断,数据也能恢复到上一句命令,可靠性高
    • 三、No persistence 禁用持久化
    • 四、RDB 和 AOF 能否同时开启?
    • 五、如何选择 RDB 和 AOF?
    • 六、官方文档

持久化,是指将Redis内存中的数据写入磁盘,当遇到重启Redis或重启服务器时,再将磁盘上的数据恢复到内存中

Redis持久化选项有4种
RDB (Redis Database) 以指定的时间间隔进行数据的快照备份。
AOF (Append Only File) 记录更改数据的命令(例如SET), 然后在重启时再次执行这些命令,从而恢复数据。
RDB + AOF 组合使用
No persistence 禁用持久化


一、RDB (Redis Database)

RDB开启后,Redis 可以自动创建某个时间点的快照,以便重启的时候,将快照中的数据恢复在内存中。

1.1 RDB 优势

  • 以快照的形式备份,非常适合灾难后进行数据的恢复;大数据时,更快地重新启动。
  • 因为是以时间节点的形式备份,节省了资源,也最大限度地提高了Redis的性能。

1.2 RDB 缺点

  • 因为是以快照的形式备份,会阻塞线程,来保证数据完整性,当遇到大数据时,阻塞时间会被放大。
  • 以时间节点的形式处理,服务停止工作时,可能还没到达时间点,会导致部分数据丢失,只能恢复到上一个时间节点上。
  • Redis运行时,手动复制RDB文件是安全的,那怕Redis正在写入临时RDB文件,原始的RDB文件也是完整的。
  • 每个时刻,RDB文件会有一份,可以创建cron任务,备份RDB文件。记录不同时刻的RDB文件。

1.3 RDB 如何工作

达到配置中save指令条件时,子进程将内存中的数据集写入临时RDB文件,再进行原子替换操作,替换旧的RDB文件。 此时RDB文件只会有一份

1.4 RDB配置

以windows版为例, 在redis.conf中 (redis.windows-service.conf 和 redis.windows.conf)

redis.windows-service.conf 旨在作为服务/守护进程运行。这意味着它应该在后台运行并由操作系统管理(重启时启动,崩溃时重新启动等)。

redis.windows.conf 旨在从命令行或脚本运行并在用户空间中进行管理。

两个配置文件基本相同,更细的区别,不再赘述。

windows服务管理中启用、停用redis服务,仅修改redis.windows-service.conf配置即可

################################ SNAPSHOTTING  ################################
#
# Save the DB on disk:
#
#   save <seconds> <changes>
#
#   Will save the DB if both the given number of seconds and the given
#   number of write operations against the DB occurred.
#
#   In the example below the behaviour will be to save:
#   after 900 sec (15 min) if at least 1 key changed
#   after 300 sec (5 min) if at least 10 keys changed
#   after 60 sec if at least 10000 keys changed
#
#   Note: you can disable saving completely by commenting out all "save" lines.
#
#   It is also possible to remove all the previously configured save
#   points by adding a save directive with a single empty string argument
#   like in the following example:
#
#   save ""save 900 1
save 300 10
save 60 10000# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
# disaster will happen.
#
# If the background saving process will start working again Redis will
# automatically allow writes again.
#
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
rdbcompression yes# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant to corruption but there is a performance
# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
# for maximum performances.
#
# RDB files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip the check.
rdbchecksum yes# The filename where to dump the DB
dbfilename dump.rdb# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./

1.5 开启/关闭,RDB快照策略,save指令

# 900秒(15分钟)后,如果至少有一个按键发生变化
save 900 1  
# 300秒(5分钟)后,如果至少有10个按键发生变化  
save 300 10 
# 60秒后,如果至少有10000个密钥发生更改   
save 60 10000  
  • 注释或删除掉所有策略,就可以禁用RDB模式
  • 添加自定义策略,只需要满足save指令规则即可

1.6 持久化硬盘文件,dbfilename指令

dbfilename dump.rdb

指定了文件的名称、扩展名;dump.rdb是一个的二进制文件


1.7 持久化硬盘文件的存储地址,dir指令

dir ./

默认是:当前安装目录下

AOF和RDB模式,使用了这个公共配置项,如果修改RDB和AOF都受影响


二、AOF (Append Only File)

2.1 AOF 优势

  • 持久化的同步有不同的策略,fsync策略,参照后面文章,可以自行灵活配置
  • 即使由于某种原因(磁盘已满或其他原因),AOF文件中存在不完整命令,redis check aof工具也能很容易地修复它。
  • AOF文件过大时,文件会被拆分和重写,用当前数据集所需的最小操作命令集生成一个全新的AOF文件,再进行原子替换操作,切换新旧AOF文件

2.2 AOF 缺点

  • AOF文件通常比RDB文件大;因为RDB是时间点的数据快照,AOF是整个数据变动过程的完整命令。
  • AOF重写过程时, 可能会占用更多内存, 先缓冲在内存中,并在最后写入新的AOF

2.3 AOF 如何工作

Redis 收到更改数据集的命令(例如SET)时,将该命令写入到缓冲区,最后依据fsync策略,从缓冲区再追加AOF文件中。需要恢复时,执行中AOF文件中命令即可。

Redis 7.0.0以后,AOF文件过大时,原始的单个AOF文件被拆分为基本文件(最多一个)和增量文件(可能有多个)

2.4 AOF配置

以windows版为例, 在redis.conf中 (redis.windows-service.conf 和 redis.windows.conf)

redis.windows-service.conf 旨在作为服务/守护进程运行。这意味着它应该在后台运行并由操作系统管理(重启时启动,崩溃时重新启动等)。

redis.windows.conf 旨在从命令行或脚本运行并在用户空间中进行管理。

两个配置文件基本相同,更细的区别,不再赘述。

windows服务管理中启用、停用redis服务,仅修改redis.windows-service.conf配置即可

############################## APPEND ONLY MODE ################################ By default Redis asynchronously dumps the dataset on disk. This mode is
# good enough in many applications, but an issue with the Redis process or
# a power outage may result into a few minutes of writes lost (depending on
# the configured save points).
#
# The Append Only File is an alternative persistence mode that provides
# much better durability. For instance using the default data fsync policy
# (see later in the config file) Redis can lose just one second of writes in a
# dramatic event like a server power outage, or a single write if something
# wrong with the Redis process itself happens, but the operating system is
# still running correctly.
#
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
#
# Please check http://redis.io/topics/persistence for more information.appendonly no# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"# The fsync() call tells the Operating System to actually write data on disk
# instead of waiting for more data in the output buffer. Some OS will really flush
# data on disk, some other OS will just try to do it ASAP.
#
# Redis supports three different modes:
#
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# always: fsync after every write to the append only log. Slow, Safest.
# everysec: fsync only one time every second. Compromise.
#
# The default is "everysec", as that's usually the right compromise between
# speed and data safety. It's up to you to understand if you can relax this to
# "no" that will let the operating system flush the output buffer when
# it wants, for better performances (but if you can live with the idea of
# some data loss consider the default persistence mode that's snapshotting),
# or on the contrary, use "always" that's very slow but a bit safer than
# everysec.
#
# More details please check the following article:
# http://antirez.com/post/redis-persistence-demystified.html
#
# If unsure, use "everysec".# appendfsync always
appendfsync everysec
# appendfsync no# When the AOF fsync policy is set to always or everysec, and a background
# saving process (a background save or AOF log background rewriting) is
# performing a lot of I/O against the disk, in some Linux configurations
# Redis may block too long on the fsync() call. Note that there is no fix for
# this currently, as even performing fsync in a different thread will block
# our synchronous write(2) call.
#
# In order to mitigate this problem it's possible to use the following option
# that will prevent fsync() from being called in the main process while a
# BGSAVE or BGREWRITEAOF is in progress.
#
# This means that while another child is saving, the durability of Redis is
# the same as "appendfsync none". In practical terms, this means that it is
# possible to lose up to 30 seconds of log in the worst scenario (with the
# default Linux settings).
#
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
no-appendfsync-on-rewrite no# Automatic rewrite of the append only file.
# Redis is able to automatically rewrite the log file implicitly calling
# BGREWRITEAOF when the AOF log size grows by the specified percentage.
#
# This is how it works: Redis remembers the size of the AOF file after the
# latest rewrite (if no rewrite has happened since the restart, the size of
# the AOF at startup is used).
#
# This base size is compared to the current size. If the current size is
# bigger than the specified percentage, the rewrite is triggered. Also
# you need to specify a minimal size for the AOF file to be rewritten, this
# is useful to avoid rewriting the AOF file even if the percentage increase
# is reached but it is still pretty small.
#
# Specify a percentage of zero in order to disable the automatic AOF
# rewrite feature.auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb# An AOF file may be found to be truncated at the end during the Redis
# startup process, when the AOF data gets loaded back into memory.
# This may happen when the system where Redis is running
# crashes, especially when an ext4 filesystem is mounted without the
# data=ordered option (however this can't happen when Redis itself
# crashes or aborts but the operating system still works correctly).
#
# Redis can either exit with an error when this happens, or load as much
# data as possible (the default now) and start if the AOF file is found
# to be truncated at the end. The following option controls this behavior.
#
# If aof-load-truncated is set to yes, a truncated AOF file is loaded and
# the Redis server starts emitting a log to inform the user of the event.
# Otherwise if the option is set to no, the server aborts with an error
# and refuses to start. When the option is set to no, the user requires
# to fix the AOF file using the "redis-check-aof" utility before to restart
# the server.
#
# Note that if the AOF file will be found to be corrupted in the middle
# the server will still exit with an error. This option only applies when
# Redis will try to read more data from the AOF file but not enough bytes
# will be found.
aof-load-truncated yes

2.5 开启/关闭,appendonly指令

默认情况下 Redis 没有开启 AOF(Redis 6.0 之后已经默认是开启了)
通过 appendonly 参数开启:yes/no 开启/关闭

appendonly yes

2.6 AOF文件,appendfilename指令

appendfilename "appendonly.aof"

2.7 AOF文件目录,dir指令

dir ./

默认是:当前安装目录下

AOF和RDB模式,使用了这个公共配置项,如果修改RDB和AOF都受影响


2.8 AOF追加策略,appendfsync指令

appendfsync everysec  
# appendfsync always    
# appendfsync no        
  • everysec 默认值, 后台线程每秒主动同步一次,将缓冲区数据写入到aof文件;性能和数据一致性的折中方案。

  • always 每次缓冲区有更改数据集的命令时,直接写入AOF文件;性能差一点,但数据一致性更高。

  • no 不主动进行写入到aof文件,等待操作系统刷新数据;数据一致比较差,性能更好;Linux 下一般为 30 秒一次。


2.9 AOF写入被意外中断,数据也能恢复到上一句命令,可靠性高

当写入AOF文件时,redis或服务器发生故障,可能导致命令写入了一半(命令不完整),当服务恢复时,redis能自己检测出来异常的命令,将其截断,然后将数据恢复到上一个命令记录的时刻,可能最多损失1秒的数据(配置是 appendfsync everysec)

* Reading RDB preamble from AOF file...
* Reading the remaining AOF tail...
# !!! Warning: short read while loading the AOF file !!!
# !!! Truncating the AOF at offset 439 !!!
# AOF loaded anyway because aof-load-truncated is enabled

三、No persistence 禁用持久化

在上面文章中,已经讲述到了RDB、AOF的开启关闭, 将RDB、AOF都关闭,其实就是不使用持久化。

关闭后,redis对于数据的操作,不会被同步到RDB、AOF文件;
关闭后,重启服务后,也不会从RDB、AOF文件恢复数据,所以重启服务后,redis没有数据。
关闭后,向redis写入key-val数据,如果重启服务,redis就回丢失数据

如果再次开启RDB、AOF模式,重启服务后,会再次加载RDB、AOF文件中的数据。


四、RDB 和 AOF 能否同时开启?

AOF和RDB可以同时启用

AOF文件将优先使用,因为它保证是最完整的


五、如何选择 RDB 和 AOF?

个人理解,RDB是必须要开启的,Redis默认也是开启的, 简单的快照是一个有效的恢复手段,哪怕中间有小部分数据丢失。

普通场景, 能承受一定的数据丢失,可能只开启RDB即可。
数据安全性要求高的场景,可能需要RDB和AOF同时开启,

任何时候,都应该再借助数据库(mqsql、 sql server)进行持久化,做最后一道防线。


六、官方文档

https://redis.io/docs/management/persistence/

相关文章:

Redis 数据的持久化 RDB、AOF、RDB + AOF、No persistence 各自优缺点

文章目录 一、RDB (Redis Database)1.1 RDB 优势1.2 RDB 缺点1.3 RDB 如何工作1.4 RDB配置1.5 开启/关闭&#xff0c;RDB快照策略&#xff0c;save指令1.6 持久化硬盘文件&#xff0c;dbfilename指令1.7 持久化硬盘文件的存储地址&#xff0c;dir指令 二、AOF (Append Only Fil…...

回味童年经典游戏的项目

目录 1.超级玛丽2.坦克大战3.吃豆人游戏4.贪吃蛇游戏 1.超级玛丽 项目地址&#xff1a;超级马里奥游戏源码 在线试玩网址在资源描述中 在线试玩&#xff1a;http://martindrapeau.github.io/backbone-game-engine/super-mario-bros/index.html 主要语言&#xff1a;JavaScript…...

Electron[5] 渲染进程和主进程

1 进程 Electron里头的进程分为渲染进程和主进程。简单理解&#xff1a; main.js就是主进程每个页面就是渲染进程一个Electron应用仅有一个主进程&#xff0c;可以有多个渲染进程 上面的这些概念很重要&#xff0c;不展开细讲。 2 进程职责 主进程是用来实现应用的基础功能…...

基于Java SSM框架实现大学生校园兼职系统项目【项目源码+论文说明】

基于java的SSM框架实现大学生兼职系统演示 摘要 随着科学技术的飞速发展&#xff0c;社会的方方面面、各行各业都在努力与现代的先进技术接轨&#xff0c;通过科技手段来提高自身的优势&#xff0c;大学生校园兼职系统当然也不能排除在外。大学生校园兼职系统是以实际运用为开…...

Codeforces Round 913 (Div. 3) A~E

目录 A. Rook 问题分析: B. YetnotherrokenKeoard 问题分析: C. Removal of Unattractive Pairs 问题分析: D. Jumping Through Segments 问题分析: E. Good Triples 问题分析: A. Rook 问题分析: 给一个棋子将其同行同列的位置输出 #include<bits/s…...

反序列化 [网鼎杯 2020 朱雀组]phpweb 1

打开题目 我们发现这个页面一直在不断的刷新 我们bp抓包一下看看 我们发现index.php用post方式传了两个参数上去&#xff0c;func和p 我们需要猜测func和p两个参数之间的关系&#xff0c;可以用php函数MD5测一下看看 我们在响应处得到了一串密文&#xff0c;md5解密一下看看 发…...

Java 何时会触发一个类的初始化

Java 何时会触发一个类的初始化&#xff1f; 使用new关键字创建对象访问类的静态成员变量 或 对类的静态成员变量进行赋值调用类的静态方法反射调用类时&#xff0c;如 Class.forName()初始化子类时&#xff0c;会先初始化其父类&#xff08;如果父类还没有进行过初始化的话&a…...

我的记事本

url uniform resource locator. 统一资源定位符 请求状态码 1XX:信息响应 2XX:成功响应 3XX:重定向消息 4XX:客户端错误响应 5XX:服务器端错误响应 IP地址分类 本机回环IP地址&#xff1a;127.0.0.1 &#xff5e; 127.255.255.254 局域网IP(私网IP) 192.168.0.0 &am…...

GO设计模式——4、单例模式(创建型)

目录 单例模式&#xff08;Singleton Pattern&#xff09; 优缺点 使用场景 饿汉式和懒汉式单例模式 单例模式&#xff08;Singleton Pattern&#xff09; 单例模式&#xff08;Singleton Pattern&#xff09;是一个类只允许创建一个对象&#xff08;或者实例&#xff…...

我对迁移学习的一点理解——领域适应(系列3)

文章目录 1. 领域适应&#xff08;Domain Adaptation&#xff09;的基本概念2.领域适应&#xff08;Domain Adaptation&#xff09;的目标3.领域适应&#xff08;Domain Adaptation&#xff09;的实现方法4.领域适应&#xff08;Domain Adaptation&#xff09;的可以解决的问题…...

【openssl】RSA 生成公钥私钥 |通过私钥获取公钥

通过博客&#xff1a;Window系统如何编译openssl 编译出openssl.exe&#xff08;位于apps文件夹下&#xff09;。 现在需要使用它获得公钥私钥、通过私钥获取公钥 目录 说明&#xff01;&#xff01;&#xff01; 一.定位openssl.exe目录 二、进入命令cmd 三、生成私钥 …...

MongoDB的删除文档、查询文档语句

本文主要介绍MongoDB的删除文档、查询文档命令语句。 目录 MongoDB删除文档MongoDB查询文档 MongoDB删除文档 MongoDB是一种基于文档的NoSQL数据库&#xff0c;它使用BSON格式存储文档。删除文档是MongoDB数据库中的常见操作之一。 下面是MongoDB删除文档的详细介绍和示例&am…...

Rust编程语言入门教程(三)-trait

文章目录 Rust编程语言入门教程&#xff08;三&#xff09;-trait什么是 trait&#xff1f;trait使用举例 Rust编程语言入门教程&#xff08;三&#xff09;-trait 什么是 trait&#xff1f; trait 是 Rust 中的接口&#xff0c;它定义了类型使用这个接口的行为。你可以类比到…...

LeetCode-1566. 重复至少 K 次且长度为 M 的模式【数组 枚举】

LeetCode-1566. 重复至少 K 次且长度为 M 的模式【数组 枚举】 题目描述&#xff1a;解题思路一&#xff1a;题意就是找出长度为m且连续重复k次的子数组。解题思路就是暴力枚举加剪枝。解题思路二&#xff1a;思路差不多解题思路三&#xff1a;0 题目描述&#xff1a; 给你一个…...

QT5.4.1无法打开文件

问题描述&#xff1a;起初是在QT代码中运行打开文件代码&#xff1a; QString gFilename QFileDialog::getOpenFileName(this,"open File",path,"*", nullptr,QFileDialog::DontUseNativeDialog);时&#xff0c;出现了堵塞情况&#xff0c;经过多次实验一…...

【1day】金和OA某接口存在未授权访问漏洞

注:该文章来自作者日常学习笔记,请勿利用文章内的相关技术从事非法测试,如因此产生的一切不良后果与作者无关。 目录 一、漏洞描述 二、影响版本 三、资产测绘 四、漏洞复现...

使用Rust 构建C 组件

协议解析&#xff0c;这不就很快了&#xff0c;而且原生的标准库红黑树和avl 树支持&#xff0c;异步tokio 这些库&#xff0c;编写应用组件就很快了 rust 标准库不支持 unix 的消息队列&#xff0c;但是支持 shm 和 uds&#xff0c;后者从多方面考虑都比&#xff0c;消息队列更…...

AI:大模型技术

Prompt Prompt&#xff08;提示&#xff09;是一种在人工智能领域&#xff0c;特别是在自然语言处理和聊天机器人中常用的技术。它是一种输入&#xff0c;用于激发人工智能模型生成相应的输出。在聊天机器人中&#xff0c;用户输入的问题或请求就是提示&#xff0c;而聊天机器…...

揭开WPF里面XAML可以通过http引入命名空间的神秘面纱

前言 做WPF开发这么久,其实一直对头部引入命名空间有些疑问,为啥官方提供的库通过xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"引入,而我自己开发的就只能通过 xmlns:local="clr-namespace:Darren.Wpf.MainModule.Views"来引入…...

什么是高防IP,高防IP该如何选择。

高防IP&#xff0c;指的是高防御能力的IP地址。在互联网的世界里&#xff0c;网络安全问题成为一个重要的话题。作为一个用户&#xff0c;你是否曾遇到过被黑客攻击造成的网站瘫痪、信息泄露等问题&#xff1f;如果你是一个企业&#xff0c;你是否考虑过自己公司的网站和业务的…...

Linux 进程

文章目录 进程定义进程的描述查看进程方法进程状态进程优先级进程相关概念补充 进程定义 大多数的说法&#xff1a;进程是计算机中正在运行的程序的实例。它是操作系统对程序的一种抽象&#xff0c;用于管理和调度程序的执行。 个人理解: 从OS(操作系统)开始说起&#xff0c;…...

Docker部署开源分布式任务调度平台DolphinScheduler并实现远程访问办公

文章目录 前言1. 安装部署DolphinScheduler1.1 启动服务 2. 登录DolphinScheduler界面3. 安装内网穿透工具4. 配置Dolphin Scheduler公网地址5. 固定DolphinScheduler公网地址 前言 本篇教程和大家分享一下DolphinScheduler的安装部署及如何实现公网远程访问&#xff0c;结合内…...

SQL语言重温

数据库语言重温 笔记背景SQL教程一些最重要的 SQL 命令SQL WHERE 子句SQL AND & OR 运算符SQL ORDER BY 关键字 笔记背景 由于工作需要&#xff0c;现重温简单SQL语言&#xff0c;笔记记录如下。 SQL教程 SQL&#xff08;Structured Query Language:结构化查询语言&…...

Java学习手册——第五篇数据类型

数据类型&#xff1a;是数据化的基石&#xff0c;如果没有数据类型怎么表示呢&#xff1f;比如年龄可以用整数&#xff1a;18岁。如果有更好的表示方式大家可以留言哟~ 在举个例子就是姓名&#xff0c;我们需要用字符串的形式来表示。这就是数据类型的魅力&#xff0c;而又有同…...

机器学习算法性能评估常用指标总结

考虑一个二分问题&#xff0c;即将实例分成正类&#xff08;positive&#xff09;或负类&#xff08;negative&#xff09;。对一个二分问题来说&#xff0c;会出现四种情况。如果一个实例是正类并且也被 预测成正类&#xff0c;即为真正类&#xff08;True positive&#xff0…...

java面试题-ArrayList 和 LinkedList 的区别是什么

远离八股文&#xff0c;面试大白话&#xff0c;通俗且易懂 看完后试着用自己的话复述出来。有问题请指出&#xff0c;有需要帮助理解的或者遇到的真实面试题不知道怎么总结的也请评论中写出来&#xff0c;大家一起解决。 java面试题汇总-目录-持续更新中​​​​​​​ ArrayLi…...

k8s中部署基于nfs的StorageClass

部署nfs服务 1.1 创建基础镜像(选做) 如果以docker的形式部署nfs server, 参考此步骤, 若否, 该步骤可忽略。 mkdir /data/nfs -p chmod 755 /data/nfs# NFS默认端口: 111、2049、20048 docker run -d \ --privileged \ --name nfs_server \ -p 111:111/tcp \ -p 111:111/ud…...

c语言一维数组总结详解

目录 介绍&#xff1a; 一维整型数组&#xff1a; 声明&#xff1a; 初始化&#xff1a; 打印输出&#xff1a; 输出结果&#xff1a; 浮点型数组&#xff1a; 代码&#xff1a; 运行结果&#xff1a; 补充&#xff1a; 一维字符数组&#xff1a; 字符数组声明及初始…...

Redis 持久化 —— 超详细操作演示!

四、Redis 持久化 四、Redis 持久化4.1 持久化基本原理4.2 RDB持久化4.3 AOF持久化4.4 RDB与AOF对比4.5 持久化技术转型 五、Redis 主从集群六、Redis 分布式系统七、Redis 缓存八、Lua脚本详解九、分布式锁 数据库系列文章&#xff1a; 关系型数据库: MySQL —— 基础语法大全…...

使用Java实现桶排序算法

文章目录 桶排序算法 今天来看看桶排序算法&#xff1a; 桶排序算法 &#xff08;1&#xff09;基本思想&#xff1a;把数组 arr 划分为 n 个大小相同子区间&#xff08;桶&#xff09;&#xff0c;每个子区间各自排序&#xff0c;最后合并 。计数排序是桶排序的一种特殊情况…...