[英]How does Redis persist data on my local Apache server even after reboot and complete power down?
From how I understand, Redis uses in memory from which I gather my RAM if I am running a local apache development server. 据我了解,如果我正在运行本地apache开发服务器,Redis会在内存中使用收集内存的内存。 I tried powering down my computer and disconnected the power cable as well, but the redis data on my local server development website persisted when I powered back up my computer and tested my test website again.
我曾尝试关闭计算机电源并断开了电源线,但是当我重新启动计算机并再次测试我的测试网站时,本地服务器开发网站上的redis数据仍然存在。 I thought RAM data gets completely wiped when I do a system reboot, how does Redis persist data even after reboot on my local development environment?
我以为重新启动系统后RAM数据会被完全擦除,即使在本地开发环境上重新启动后,Redis如何持久保存数据? Thanks!
谢谢! :)
:)
Redis serves data only out of RAM, but it provides two modes of persistence RDB (snapshot persistence) and AOF (changelog persistence). Redis仅在RAM之外提供数据,但是它提供了两种持久性模式RDB(快照持久性)和AOF(变更日志持久性)。 If either mode of persistence is enabled on your Redis server, then your data will persist between reboots.
如果在Redis服务器上启用了任何一种持久性模式,则数据将在两次重新引导之间保持不变。
The config directives you want to check are: 您要检查的config指令是:
More information on Redis Persistence here. 有关Redis Persistence的更多信息,请参见此处。
Redis has persistence options that saves Redis data in either RDB or AOF format (basically saving the Redis data to a file/log): Redis具有持久性选项,可将其以RDB或AOF格式保存(基本上将Redis数据保存到文件/日志中):
The RDB persistence performs point-in-time snapshots of your dataset at specified intervals.
RDB持久性按指定的时间间隔执行数据集的时间点快照。
The AOF persistence logs every write operation received by the server, that will be played again at server startup, reconstructing the original dataset.
AOF持久性会记录服务器接收的每个写入操作,这些操作将在服务器启动时再次播放,以重建原始数据集。 Commands are logged using the same format as the Redis protocol itself, in an append-only fashion.
使用与Redis协议本身相同的格式记录命令,并且采用仅追加方式。 Redis is able to rewrite the log on background when it gets too big.
当日志太大时,Redis可以在后台重写日志。
- If you wish, you can disable persistence at all, if you want your data to just exist as long as the server is running.
如果希望,只要您的数据在服务器运行时就一直存在,则可以完全禁用持久性。
- It is possible to combine both AOF and RDB in the same instance.
可以在同一实例中同时合并AOF和RDB。 Notice that, in this case, when Redis restarts the AOF file will be used to reconstruct the original dataset since it is guaranteed to be the most complete.
请注意,在这种情况下,当Redis重新启动时,AOF文件将用于重建原始数据集,因为它可以保证是最完整的。
This info was quoted from https://redis.io/topics/persistence , which goes into detail about these options. 此信息引自https://redis.io/topics/persistence ,其中详细介绍了这些选项。
You can read more from the Antirez weblog: Redis Persistence Demystified 您可以从Antirez网站日志中了解更多信息: Redis Persistence Demystified
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.