Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我的Redis为什么每天数据都会丢失?

我的Redis为什么每天数据都会丢失?

提问于 2024-05-12 07:45:49
回答 0关注 1查看 77

我在云服务上使用redis单机,没有配置任何主从、集群之类的东西,但是每天我的数据库中的数据都会被清除掉,通过看日志文件,发现有主从复制失败等问题,我想知道为什么啊,如何解决数据每天不被清除掉。

代码语言:txt
AI代码解释
复制
11626:M 11 May 2024 23:44:01.119 * Background saving terminated with success
11626:M 12 May 2024 00:44:02.049 * 1 changes in 3600 seconds. Saving...
11626:M 12 May 2024 00:44:02.049 * Background saving started by pid 23716
23716:C 12 May 2024 00:44:02.054 * DB saved on disk
23716:C 12 May 2024 00:44:02.054 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
11626:M 12 May 2024 00:44:02.150 * Background saving terminated with success
11626:M 12 May 2024 09:24:49.711 * 1 changes in 3600 seconds. Saving...
11626:M 12 May 2024 09:24:49.711 * Background saving started by pid 16880
16880:C 12 May 2024 09:24:49.716 * DB saved on disk
16880:C 12 May 2024 09:24:49.716 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
11626:M 12 May 2024 09:24:49.813 * Background saving terminated with success
11626:S 12 May 2024 09:24:49.931 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
11626:S 12 May 2024 09:24:49.932 * Connecting to MASTER 47.236.97.236:60108
11626:S 12 May 2024 09:24:49.932 * MASTER <-> REPLICA sync started
11626:S 12 May 2024 09:24:49.932 * REPLICAOF 47.236.97.236:60108 enabled (user request from 'id=3754 addr=101.201.119.233:47356 laddr=192.168.0.83:6379 fd=7 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=29 qbuf-free=20445 argv-mem=25 multi-mem=0 rbs=1024 rbp=668 obl=0 oll=0 omem=0 tot-mem=22449 events=r cmd=slaveof user=default redir=-1 resp=2 lib-name= lib-ver=')
11626:S 12 May 2024 09:24:50.131 * Non blocking connect for SYNC fired the event.
11626:S 12 May 2024 09:24:50.331 * Master replied to PING, replication can continue...
11626:S 12 May 2024 09:24:50.730 * Trying a partial resynchronization (request 8e68efb698e7166e33e8ac36a93ae8ecdfa0ecbb:1).
11626:S 12 May 2024 09:24:50.930 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
11626:S 12 May 2024 09:24:50.930 * MASTER <-> REPLICA sync: receiving 21816 bytes from master to disk
11626:S 12 May 2024 09:24:50.930 * MASTER <-> REPLICA sync: receiving 21816 bytes from master to disk
11626:S 12 May 2024 09:24:51.130 * Discarding previously cached master state.
11626:S 12 May 2024 09:24:51.130 * MASTER <-> REPLICA sync: Flushing old data
11626:S 12 May 2024 09:24:51.130 * MASTER <-> REPLICA sync: Loading DB in memory
11626:S 12 May 2024 09:24:51.134 # Wrong signature trying to load DB from file
11626:S 12 May 2024 09:24:51.134 # Failed trying to load the MASTER synchronization DB from disk, check server logs.
11626:S 12 May 2024 09:24:51.134 * Reconnecting to MASTER 47.236.97.236:60108 after failure
11626:S 12 May 2024 09:24:51.134 * MASTER <-> REPLICA sync started
11626:S 12 May 2024 09:24:51.323 * Non blocking connect for SYNC fired the event.
11626:S 12 May 2024 09:24:51.513 * Master replied to PING, replication can continue...
11626:S 12 May 2024 09:24:51.891 * Partial resynchronization not possible (no cached master)
11626:S 12 May 2024 09:24:52.081 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
11626:S 12 May 2024 09:24:52.081 * MASTER <-> REPLICA sync: receiving 21816 bytes from master to disk
11626:S 12 May 2024 09:24:52.270 * MASTER <-> REPLICA sync: Flushing old data
11626:S 12 May 2024 09:24:52.270 * MASTER <-> REPLICA sync: Loading DB in memory
11626:S 12 May 2024 09:24:52.274 # Wrong signature trying to load DB from file
11626:S 12 May 2024 09:24:52.274 # Failed trying to load the MASTER synchronization DB from disk, check server logs.
11626:S 12 May 2024 09:24:52.274 * Reconnecting to MASTER 47.236.97.236:60108 after failure
11626:S 12 May 2024 09:24:52.274 * MASTER <-> REPLICA sync started
11626:S 12 May 2024 09:24:52.477 * Non blocking connect for SYNC fired the event.
11626:S 12 May 2024 09:24:52.679 * Master replied to PING, replication can continue...
11626:S 12 May 2024 09:24:53.083 * Partial resynchronization not possible (no cached master)
11626:S 12 May 2024 09:24:53.286 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
11626:S 12 May 2024 09:24:53.286 * MASTER <-> REPLICA sync: receiving 21816 bytes from master to disk
11626:S 12 May 2024 09:24:53.488 * MASTER <-> REPLICA sync: Flushing old data
11626:S 12 May 2024 09:24:53.488 * MASTER <-> REPLICA sync: Loading DB in memory
11626:S 12 May 2024 09:24:53.492 # Wrong signature trying to load DB from file
11626:S 12 May 2024 09:24:53.492 # Failed trying to load the MASTER synchronization DB from disk, check server logs.
11626:S 12 May 2024 09:24:53.492 * Reconnecting to MASTER 47.236.97.236:60108 after failure
11626:S 12 May 2024 09:24:53.492 * MASTER <-> REPLICA sync started
11626:S 12 May 2024 09:24:53.680 * Non blocking connect for SYNC fired the event.
11626:S 12 May 2024 09:24:53.869 * Master replied to PING, replication can continue...
11626:S 12 May 2024 09:24:54.246 * Partial resynchronization not possible (no cached master)
11626:S 12 May 2024 09:24:54.435 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
11626:S 12 May 2024 09:24:54.435 * MASTER <-> REPLICA sync: receiving 21816 bytes from master to disk
11626:S 12 May 2024 09:24:54.623 * MASTER <-> REPLICA sync: Flushing old data
11626:S 12 May 2024 09:24:54.623 * MASTER <-> REPLICA sync: Loading DB in memory
11626:S 12 May 2024 09:24:54.627 # Wrong signature trying to load DB from file
11626:S 12 May 2024 09:24:54.627 # Failed trying to load the MASTER synchronization DB from disk, check server logs.
11626:S 12 May 2024 09:24:54.627 * Reconnecting to MASTER 47.236.97.236:60108 after failure
11626:S 12 May 2024 09:24:54.627 * MASTER <-> REPLICA sync started
11626:S 12 May 2024 09:24:54.826 * Non blocking connect for SYNC fired the event.
11626:M 12 May 2024 09:24:54.993 * Setting secondary replication ID to 8e68efb698e7166e33e8ac36a93ae8ecdfa0ecbb, valid up to offset: 1. New replication ID is 652b36f9faac47fb4261697e8004cfd4c3fe4b1c
11626:M 12 May 2024 09:24:54.993 * MASTER MODE enabled (user request from 'id=3754 addr=101.201.119.233:47356 laddr=192.168.0.83:6379 fd=7 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=16 qbuf-free=20458 argv-mem=12 multi-mem=0 rbs=1024 rbp=223 obl=0 oll=0 omem=0 tot-mem=22436 events=r cmd=slaveof user=default redir=-1 resp=2 lib-name= lib-ver=')
11626:M 12 May 2024 10:24:50.068 * 1 changes in 3600 seconds. Saving...
11626:M 12 May 2024 10:24:50.069 * Background saving started by pid 19824
19824:C 12 May 2024 10:24:50.073 * DB saved on disk
19824:C 12 May 2024 10:24:50.074 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
11626:M 12 May 2024 10:24:50.169 * Background saving terminated with success
11626:M 12 May 2024 13:04:32.698 # Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection from 124.70.90.23:27105 aborted.

回答

成为首答用户。去 写回答
相关文章
Redis数据丢失问题
因为master -> slave的复制是异步的(客户端发送给redis,主节点数据同步到内存中后就返回成功了) 所以可能有部分数据还没复制到slave,master就宕机了,此时master内存中的数据也没了,这些部分数据就丢失了。
名字是乱打的
2021/12/24
3.8K0
Redis数据丢失问题
2022年,我每天都会用的linux常用命令
本章将学习Linux命令的基本格式、命令帮助的使用,并通过命令来管理系统中的文件和目录。
网络豆
2023/10/15
2470
2022年,我每天都会用的linux常用命令
为什么我的Redis这么“慢”?
Redis 作为内存数据库,拥有非常高的性能,单个实例的 QPS 能够达到 10W 左右。
架构师修行之路
2020/08/20
3.8K0
宕机了,Redis 如何避免数据丢失?
停止一个线程意味着在任务处理完任务之前停掉正在做的操作,也就是放弃当前的操作。停止一个线程可以用Thread.stop()方法,但最好不要用它。虽然它确实可以停止一个正在运行的线程,但是这个方法是不安全的,而且是已被废弃的方法。在java中有以下3种方法可以终止正在运行的线程:
一行Java
2023/02/23
9010
宕机了,Redis 如何避免数据丢失?
宕机了,Redis 如何避免数据丢失?
我想你大概率会说:"我会把它当作缓存使用,因为它把后端数据库中的数据存储在内存中,然后直接从内存中读取数据,响应速度会非常快。"
SmallRoll小卷
2023/03/02
1.1K0
宕机了,Redis 如何避免数据丢失?
Redis持久化-数据丢失及解决
转载自 http://www.cnblogs.com/hs8888/p/5520495.html
allsmallpig
2021/02/25
2K0
Redis哨兵主备切换的数据丢失问题
此时哨兵可能就会认为M宕机了,然后开启选举,将其他S切换成M。这时,集群里就会有两个M-脑裂
JavaEdge
2022/11/30
9710
Redis哨兵主备切换的数据丢失问题
Redis 怎么防止数据丢失?面试必问!
因为Redis的主从复制和自动故障恢复,都需要依赖Redis持久化相关的东西。同时,Redis的数据持久化也可以用来做数据备份,用来保障数据的安全性。
Java技术栈
2020/10/27
4.7K0
Redis 怎么防止数据丢失?面试必问!
如何防止Redis脑裂导致数据丢失?
所谓的脑裂,就是指在主从集群中,同时有两个主节点,它们都能接收写请求。而脑裂最直接的影响,就是客户端不知道应该往哪个主节点写入数据,结果就是不同的客户端会往不同的主节点上写入数据。而且,严重的话,脑裂会进一步导致数据丢失。
码农架构
2020/12/01
1.4K0
如何防止Redis脑裂导致数据丢失?
Redis脑裂为何会导致数据丢失?
主从集群有1个主库、5个从库和3个哨兵实例,突然发现客户端发送的一些数据丢了,直接影响业务层数据可靠性。
JavaEdge
2023/02/13
1.4K0
Redis脑裂为何会导致数据丢失?
公式我都会,为何依然分析不好数据?
有多少人大学里被挂在一棵名叫”高数”的树上,又有多少人心里默默污了拉格朗日无数次……
博文视点Broadview
2020/06/11
4600
Redis 数据持久化?-----意外宕机如何避免数据丢失
我们在实际应用生产中,大部分公司会把 Redis 当做缓存使用,用它来把后端数据库中的数据存储在内存中,然后直接从内存中直接读取数据,这样会使这个程序响应速度变得非常快。但是一旦服务器宕机,那么内存中的数据将全部丢失?
张琳兮
2020/12/18
2.1K0
Redis 数据持久化?-----意外宕机如何避免数据丢失
Redis 数据持久化?-----意外宕机如何避免数据丢失
我们在实际应用生产中,大部分公司会把 Redis 当做缓存使用,用它来把后端数据库中的数据存储在内存中,然后直接从内存中直接读取数据,这样会使这个程序响应速度变得非常快。但是一旦服务器宕机,那么内存中的数据将全部丢失?
张琳兮
2020/12/14
1.2K0
可能每天都会用到的Git命令速查表
老实说,莱纳斯·托瓦尔兹(Linus Torvalds)的小项目几乎感觉像是一个奇迹。
王小婷
2020/11/02
1.2K0
Redis内存空间占用及避免数据丢失的方法
在现代的互联网应用中,Redis作为一种高性能的内存数据库,被广泛应用于缓存、会话管理和消息队列等场景。然而,Redis的内存资源是有限的,过多的内存占用可能会导致数据丢失。因此,对于项目中使用Redis的架构师来说,合理预估Redis内存空间的占用,并采取相应的措施来避免内存占用过多,是非常重要的。
疯狂的KK
2023/08/22
5090
Redis内存空间占用及避免数据丢失的方法
Redis主从复制是如何保证数据不丢失的?
在生产环境中,为了系统的可靠性,我们会对Redis搭建主从。这样当一个实例发生宕机,另一个实例中还有数据,还能继续提供服务。主从库之间采用的是读写分离的模式。
Java识堂
2021/01/20
2.1K0
Redis主从复制是如何保证数据不丢失的?
AOF日志:宕机了,Redis如何避免数据丢失?
“Redis 一般用在什么业务场景下?” -- “常见的是把它当作**缓存**使用,因为它把后端数据库中的数据存储在内存中,然后直接从内存中读取数据,响应速度会非常快。”
刺槐儿
2023/11/26
5531
小米二面:Redis 如何保证数据不丢失?
前段时间表妹收到了小米秋招补录的面试邀请,一面还算顺利,很快就通过了,但在看二面面试录屏的时候,我发现了一个问题,回答的不是很好,也就是我们今天要聊的这个问题:Redis 如何保证数据不丢失?
磊哥
2023/11/27
3030
小米二面:Redis 如何保证数据不丢失?
Redis主从集群切换数据丢失问题如何应对
对于Redis主节点与从节点之间的数据复制,是异步复制的,当客户端发送写请求给master节点的时候,客户端会返回OK,然后同步到各个slave节点中。
用户4283147
2022/10/08
1.3K0
Redis主从集群切换数据丢失问题如何应对
redis kill掉进程数据丢失解决方案
默认情况下,是快照rdb的持久化方式,将内存中的数据以快照的方式写入二进制文件中,默认的文件名是dump.rdb
24-丰总
2018/08/30
1.9K0
redis kill掉进程数据丢失解决方案

相似问题

ip出现很多异地登录是什么原因?

41.4K

linux redis 数据丢失 服务没有重启 DB saved on disk后 数据就没了?

01.4K

自己安装的redis服务,设值成功 10min左右 数据就丢失了?

0152

2021-02-01:Redis 集群会有写操作丢失吗?

0199

redis用程序为什么连不上?

21.1K
相关问答用户
擅长3个领域
萃橙科技 | 合伙人擅长4个领域
腾讯云TDP | 高级后端开发工程师擅长3个领域
高级数据分析师擅长5个领域
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档