新聞中心
本篇內(nèi)容介紹了“如何解決Jedis連接Linux上的redis出現(xiàn) DENIED Redis is running in protected mode問題”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
10多年的北戴河網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營銷的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整北戴河建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“北戴河網(wǎng)站設(shè)計(jì)”,“北戴河網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
最近有段時(shí)間沒有寫博客了,今天抽出時(shí)間寫寫,之前開發(fā)的時(shí)候redis部署在Linux是其他人搞得,我沒怎么參與,于是閑著無聊在本地的虛擬機(jī)上安裝了個(gè)redis進(jìn)行測試,沒想到在進(jìn)行連接時(shí)報(bào)了下面這么一個(gè)錯(cuò),fuck,Linux上的redis還真是麻煩,哪像windows上的redis這么簡單一解壓完事
Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: 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. at redis.clients.jedis.Protocol.processError(Protocol.java:127) at redis.clients.jedis.Protocol.process(Protocol.java:161) at redis.clients.jedis.Protocol.read(Protocol.java:215) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239) at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:196) at com.example.redis.JedisTest.main(JedisTest.java:24)
經(jīng)過我英語八級的翻譯,上面一共提供了四種解決方案,但是綜合考慮為了簡單起見只需要執(zhí)行以下幾步即可:
?。?修改redis.conf配置文件,將綁定的ip地址端口號(hào)給注釋見下圖
6. 解決了這個(gè)問題就可以進(jìn)行各種有趣的測試了哈哈
“如何解決Jedis連接Linux上的redis出現(xiàn) DENIED Redis is running in protected mode問題”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
文章題目:如何解決Jedis連接Linux上的redis出現(xiàn)DENIEDRedisisrunninginprotectedmode問題
網(wǎng)站地址:http://www.dlmjj.cn/article/gpeeid.html