Redis異常報錯:redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool

這裏貼出錯誤截圖

這裏寫圖片描述

如圖所示異常信息。百度上搜到好多是關於鏈接問題,客戶端ping不到值。這裏我的情況與他們不同,我是可以ping到的。

@Test
    public void testJedisClientSpring() {

        jedisClient.set("0000","123");
        String s = jedisClient.get("0000");
        System.out.println(s);
    }

這是測試代碼。獲取value值。

解決辦法

我啓動redis配置文件爲自己配置的。內容如下

#修改爲守護模式
daemonize no
#保護模式
protected-mode no

這裏寫圖片描述
重新啓動redis服務就行了。

參考文章連接

https://blog.csdn.net/only1994/article/details/52785306

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章