搜尋
首頁web前端css教學Redis3.2開啟遠端存取詳細步驟

Redis3.2開啟遠端存取詳細步驟

Mar 06, 2018 pm 04:41 PM
redis訪問遠端

Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。 Redis支援遠端訪問,詳細步驟小編已為大家整理出來了,具體步驟如下:

redis預設只允許本地訪問,要讓redis可以遠端存取可以修改redis.conf
開啟redis. conf檔在NETWORK部分有說明

################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using       
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1

讓redis可以遠端存取只要註解掉redis.conf設定檔中的bind 127.0.0.1 即可以讓所有的ip訪問redis

若是想指定多個ip訪問,但並不是全部的ip訪問,可以bind多個IP

注意

在redis3.2之後,redis增加了protected-mode,在這個模式下,即使註解掉了bind 127.0.0.1,再訪問redisd時候還是報錯,如下

(error) 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.

解決方法是修改原protected-mode yes為protected-mode no

儲存設定檔重啟redis即可。

相關推薦:

PHP操作Redis實例講解

一個php+redis的簡單實例分享

ThinkPhP5框架中redis以及Redis的使用詳解

#

以上是Redis3.2開啟遠端存取詳細步驟的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
每周平台新聞:Galaxy Store的Web應用程序,Tappable Stories,CSS Subgrid每周平台新聞:Galaxy Store的Web應用程序,Tappable Stories,CSS SubgridApr 14, 2025 am 11:20 AM

在本週的綜述中:Firefox獲得了類似鎖匠的力量,三星的Galaxy Store開始支持Progressive Web Apps,CSS Subgrid正在Firefox發貨

每周平台新聞:Internet Explorer模式,搜索控制台中的速度報告,限制通知提示每周平台新聞:Internet Explorer模式,搜索控制台中的速度報告,限制通知提示Apr 14, 2025 am 11:15 AM

在本週的綜述中:Internet Explorer進入Edge,Google搜索控制台吹捧新的速度報告,而Firefox給出了Facebook' s Notification

CSS自定義屬性的範圍的功率(和樂趣)CSS自定義屬性的範圍的功率(和樂趣)Apr 14, 2025 am 11:11 AM

您可能至少已經對CSS變量有點熟悉了。如果沒有,這是兩秒鐘的概述:它們真的稱為自定義屬性

我們是程序員我們是程序員Apr 14, 2025 am 11:04 AM

構建網站正在編程。編寫HTML和CSS正在編程。我是程序員,如果您在這裡閱讀CSS-Tricks,那麼您很有可能是您

您如何從網站上刪除未使用的CSS?您如何從網站上刪除未使用的CSS?Apr 14, 2025 am 10:59 AM

在這裡,我想預先知道的是:這是一個很難的問題。如果您降落在這裡,因為您希望指向您可以運行的工具

圖片中的圖片網絡API簡介圖片中的圖片網絡API簡介Apr 14, 2025 am 10:57 AM

圖片中的圖片在2016年發行了Macos Sierra,在Safari瀏覽器中首次出現在網絡上。這使用戶可以彈出

使用Gatsby組織和準備圖像以使圖像模糊效果的方法使用Gatsby組織和準備圖像以使圖像模糊效果的方法Apr 14, 2025 am 10:56 AM

蓋茨比(Gatsby)進行了出色的處理和處理圖像。例如,它可以幫助您節省圖像優化的時間,因為您不必手動

哦,嘿,填充百分比基於父元素的寬度哦,嘿,填充百分比基於父元素的寬度Apr 14, 2025 am 10:55 AM

今天,我學到了一些有關基於百分比的(%)填充的知識,我腦海中完全錯了!我一直認為百分比填充是基於

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
4 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

EditPlus 中文破解版

EditPlus 中文破解版

體積小,語法高亮,不支援程式碼提示功能

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中