【REdis】如何让Redis能供外界访问

【前篇】

 https://www.cnblogs.com/heyang78/p/15962970.html

【Deny提示】

如果没有进行设置,redis只能本机操作,从外界访问您迟早会看到下列文字:

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.

因此,不进行设置还不行。

【修改redis.conf文件】

vi redis.conf

将bind 127.0.0.1 -::1 一句屏蔽掉,变成 #bind 127.0.0.1 -::1

将protected-mode yes 改写成 protected-mode no

daemonize no一句,保持,如果是yes请改为no

【运行redis】

复制代码
[hy@localhost ~]$ cd redis-6.2.6
[hy@localhost redis-6.2.6]$ ls
00-RELEASENOTES  COPYING   MANIFESTO   runtest-cluster    src
BUGS             deps      README.md   runtest-moduleapi  tests
CONDUCT          INSTALL   redis.conf  runtest-sentinel   TLS.md
CONTRIBUTING     Makefile  runtest     sentinel.conf      utils
[hy@localhost redis-6.2.6]$ vi redis.conf
[hy@localhost redis-6.2.6]$ cd src
[hy@localhost src]$ ./redis-server ../redis.conf
复制代码

前面是步骤,粗体是关键。

此后,外界访问redis的路径便通达了。

END

 

posted @   逆火狂飙  阅读(540)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
历史上的今天:
2019-03-04 【Canvas与艺术】"社会主义核心价值观"表盘
2019-03-04 【Canvas与艺术】绘制地平线
2019-03-04 【Canvas与艺术】绘制磨砂黄铜材质Premium Quality徽章
2019-03-04 【Canvas与艺术】绘制蓝色森麒麟轮胎
2016-03-04 【Canvas技法】绘制绘制正五边形、正五角星
2016-03-04 VI使用技巧
2016-03-04 【Canvas与数学】绘制圆形中运动的包络线
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东
点击右上角即可分享
微信分享提示