前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Redis之MISCONF Redis is configured to save RDB snapshots错误

Redis之MISCONF Redis is configured to save RDB snapshots错误

作者头像
学到老
发布2019-01-25 14:30:49
7.2K1
发布2019-01-25 14:30:49
举报

操作redis过程中并没有修改什么配置,出现如下错误, 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.

问题

java操作插入数据:

代码语言:javascript
复制
package redis;

import redis.clients.jedis.Jedis;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class insert_data {
    public static void main(String[] args) throws IOException {
        //连接本地的 Redis 服务
        Jedis jedis = new Jedis("localhost");
        System.out.println("连接成功");
        //查看服务是否运行
        System.out.println("服务正在运行: " + jedis.ping());
        int a = 0;
        try {
            String filePath = "C:\\Users\\lenovo\\Desktop\\NewShortestPathCountrywideComplete.txt";
            FileReader fileRead = new FileReader(filePath);
            BufferedReader bufferRead = new BufferedReader(fileRead);
            String str;
            String strNowName;

            while ((str = bufferRead.readLine()) != null) {
                String[] contParts = str.split("\t");
                a++;
                //if (a>10000){
                if (contParts.length < 2) {
                    continue;
                }
                strNowName = contParts[0] + " " + contParts[1];
                if (!jedis.exists(strNowName))

                    jedis.set(strNowName , contParts[2]);
            }
//            }
            bufferRead.close();
        } catch (IOException e) {
            System.out.println(a);
            e.printStackTrace();
        }


    }
}

出现错误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 进入redis

代码语言:javascript
复制
E:\>cd E:\REDIS\redis-64.3.0.503
E:\REDIS\redis-64.3.0.503>redis-cli

执行:127.0.0.1:6379> config set stop-writes-on-bgsave-error no 问题解决

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年05月30日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题
  • 解决方案:
相关产品与服务
云数据库 Redis
腾讯云数据库 Redis(TencentDB for Redis)是腾讯云打造的兼容 Redis 协议的缓存和存储服务。丰富的数据结构能帮助您完成不同类型的业务场景开发。支持主从热备,提供自动容灾切换、数据备份、故障迁移、实例监控、在线扩容、数据回档等全套的数据库服务。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档