首页 > 作文

互联网常识:怎样使redis可以远程访问

更新时间:2023-02-25 22:07:52 阅读: 评论:0

导读跟大家讲解下有关怎样使redis可以远程访问,相信小伙伴们对这个话题应该也很关注吧,现在就为小伙伴荒芜们说说怎样使redis可以远程访问,小

跟大家讲解下有关怎样使redis可以远程访问,相信小伙伴们对这个话题应该也很关注吧,现在就为小伙伴们说说怎样使redis可以远程访问,小编也收集到了有关怎样使redis可以远程访问的相关资料,希望大家看到了会喜欢。

导语:

我们都知道redis默认只允许本地访问那么我们如果要使redis可以远程访问该如何做呢

具体方法:

打开redis.conf文件在NETWORK部分有说明

################################## NETWORK ##################################### # B80岁以上老人高龄津贴y default, if no "bind" configuration directive is specified, Redis listens# for connections from all the network interfaces available on the rver.# It is possible to listen to just one or multiple lected interfaces using# the "bind" configuration directive, followed by one or more IP address.## Examples:## bind 192.168.1.100 10.0.0.1# bind 127.0.0.1 ::1## ~~~ WARNING ~~~ If the computer running Redis is directly expod to the# internet, binding to all the interfaces is dangerous and will expo 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

解决办法:注释掉bind 127.0.0.1可以使所有的ip访问redis

若是想指定多个ip访问但并不是全部的ip访问可以bind

注意

下面还有个说明

# Protected mode is a layer of curity protection, in order to avoid that# Redis instances left open on the internet are accesd and exploited.## When protected mode is on and if:## 1) The rver is not binding explicitly to a t of address using the# "bind" directive.# 2) No password is configured.## The rver only accepts connections from clients connecting from the# IPv4 and IPv6 loopback address 127.0.0.1 and ::1, and from Unix domain# sockets.## By default protected mode is enabled. You should disable it only if# you are sure you want clients from other hosts to connect to Redis# even if no authentication is configured, nor a specific t of interfaces# are explicitly listed using the "b布隆克霍斯特ind" directive.protected-mode yes

在redis3.2之后redis增加了protected-mode在这个模式下即使注释掉了bind 127.0.0.1再访问redisd时候还是报错如下:

(error) DENIED Redis is running in protected mode becau 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 nding the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the rver is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. U CONFIG REWRITE to make this change perm七十周年阅兵观后感anent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration 临床医学课程file, and tting the protected mode option to 'no', and then restarting the rver. 3) If you started the rver 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 rver to start accepting connections from the outside.

相关推荐:redis数据库教程

以上就是怎样使redis可以远程访问的详细内容!

来源:php中文网

本文发布于:2023-02-25 22:07:52,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/167733407244447.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:互联网常识:怎样使redis可以远程访问.doc

本文 PDF 下载地址:互联网常识:怎样使redis可以远程访问.pdf

相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 站长QQ:55-9-10-26 专利检索|