Linux-Cent7.9 redis路径查找 | 删除redis所有缓存

查看redis端口命令

[root@VM-20-17-centos etc]# ps -ef|grep redis
redis     1257     1  0 Nov20 ?        00:02:06 /usr/bin/redis-server 0.0.0.0:6379
root      6340  6653  0 15:27 pts/0    00:00:00 grep --color=auto redis

发现redis-server对应端口为1257

查看redis对应的路径,并进入路径

[root@VM-20-17-centos etc]# ls -l /proc/1257/cwd
lrwxrwxrwx 1 redis redis 0 Nov 20 11:41 /proc/1257/cwd -> /etc
[root@VM-20-17-centos etc]# cd /etc

进入redis,执行操作

[root@VM-20-17-centos etc]# /bin/redis-cli # 进入redis
127.0.0.1:6379> dbsize  # 当看到127.0.0.1:6379就知道进入成功
(integer) 26
127.0.0.1:6379> flushall  # 清理缓存
OK
127.0.0.1:6379> dbsize  # 查看当前的缓存数量
(integer) 0
127.0.0.1:6379> keys * # key的个数
(empty list or set)
127.0.0.1:6379> exit # 退出redis

redis报错,无法持久化硬盘,临时解决方案

127.0.0.1:6379> flushall
(error) 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.
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> flushall
OK

References:

https://blog.csdn.net/changyana/article/details/123289897

posted @   在成长的土拨鼠  阅读(10)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示