溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

springboot整合linux上的redis時報錯怎么解決

發(fā)布時間:2022-03-29 14:01:19 來源:億速云 閱讀:237 作者:iii 欄目:大數(shù)據(jù)

這篇文章主要介紹“springboot整合linux上的redis時報錯怎么解決”的相關知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“springboot整合linux上的redis時報錯怎么解決”文章能幫助大家解決問題。

如果你在springboot整合linux上的redis時,其他配置都對了,但是訪問時依然提示下面信息:

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

那就在Linux上啟動redis時選擇使用絕對路徑試試,我就是各種嘗試無效后,通過這種方式搞定的!特此記錄,已備查用!

例如我的啟動命令是下面這樣:

[root@localhost fsrm]# /usr/local/redis/bin/redis-server  /home/fsrm/文檔/redis.conf

之前怎么改都不生效,可能是啟動時加載了默認redis.conf配置文件,導致不是以自己修改后的配置文件啟動,所以任何改動都是沒有意義的!

下面是Linux下使用redis時幾個常用的命令

[root@localhost]# ps -ef | grep redis //查看redis進程信息
[root@localhost fsrm]# kill -9 XXXX  //殺死XXXX端口號對應進程

redis.conf配置文件里的幾個配置項

# bind 127.0.0.1    //注釋掉才能通過外網(wǎng)訪問
daemonize yes       //以守護進程啟動 默認時no        
protected-mode no   //取消保護模式 默認時yes開啟

還有就是重啟完redi后,springboot項目也要重啟,否則不生效!

關于“springboot整合linux上的redis時報錯怎么解決”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識,可以關注億速云行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。

AI