Redis: key-value 数据库

本文介绍了如何启动Redis服务,并通过实例演示了如何检查服务状态和关闭服务。此外,还详细解析了两个常见问题:一是Redis无法持久化到硬盘及解决方法;二是Spring框架中Redis序列化异常的处理方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、启动redis

二、查看redis服务是否启动

ps aux | grep redis

lifei            21372   0.0  0.0  4322452    768   ??  S    日04下午   1:09.08 ./src/redis-server 127.0.0.1:6379 
lifei            36177   0.0  0.0  4286488    844 s001  S+    7:23上午   0:00.01 grep redis

三、关闭redis服务

 

四、遇到的问题

问题一:MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk.

参考: https://www.jianshu.com/p/3aaf21dd34d6

Redis问题
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
Redis被配置为保存数据库快照,但它目前不能持久化到硬盘。用来修改集合数据的命令不能用。请查看Redis日志的详细错误信息。


原因
强制关闭Redis快照导致不能持久化。


解决方案
将stop-writes-on-bgsave-error设置为no
127.0.0.1:6379> config set stop-writes-on-bgsave-error no

问题二:org.springframework.data.redis.serializer.SerializationException: Cannot deserialize;

解决:

      要为domain添加 序列化id。如:

public class Product implements Serializable {

    private static final long serialVersionUID = -2685226830321909895L;

......
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值