在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!登錄