zoukankan      html  css  js  c++  java
  • 解决:Redis:java.util.NoSuchElementException: Unable to validate object at

        在Java使用Redis的过程中遇见了一个问题,

    redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at
    Caused by: java.util.NoSuchElementException: Unable to validate object at

        这个问题是说拿不到Redis的链接,因为validate通不过。登录一个客户端,手动ping一下

    127.0.0.1:6379> ping
    (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.

        貌似是RDB持久化的问题。

        解决方法,使用redis-cli修改rdb目录

    CONFIG SET dir /tmp/redis_data
    CONFIG SET dbfilename temp.rdb

        重启redis-server,问题解决!

        

        上面的解决方法需要每次启动server都要修改rdb的路径。

        另一种解决方法是直接修改redis.conf文件,修改如下两行:

        

    dir /tmp/redis_data    #./ -->  /tmp/redis_data
    dbfilename temp.rdb   #

        启动redis-server

    /opt/redis-3.2.1/src/redis-server /etc/redis/redis.conf

        问题解决!

        OK!

  • 相关阅读:
    AQS简介
    原子类案例
    保证线程安全的三个方面
    CAS无锁机制
    乐观锁与悲观锁
    读写锁简介
    重入锁简介
    并发队列Queue
    报错Cannot resolve com.mysq.jdbc.Connection.ping method. Will use 'SELECT 1' instead 问题记录
    Springboot中MyBatis 自动转换 map-underscore-to-camel-case
  • 原文地址:https://www.cnblogs.com/fengzhiwu/p/5662772.html
Copyright © 2011-2022 走看看