解决:Redis:java.util.NoSuchElementException: Unable to validate object at

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

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一下redis

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持久化的问题。spa

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

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

    重启redis-server,问题解决!server

    

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

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

    

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

    启动redis-serverio

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

    问题解决!class

    OK!登录

相关文章
相关标签/搜索