💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] # redis启动 Redis启动的时候,可以指定配置文件,如下: ~~~ /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf & ~~~ 注:#加上&号使redis以后台程序方式运行 # 外网连不上redis ~~~ vim redis.conf ~~~ 把里面的bind 127.0.0.1前面加个# 注释掉,这个可能不止一行,关于这个的全部注释掉,外面的网就可以连接成功了 设置密码 为了安全一定要设,而且这里如果不绑定ip也不设密码的话,redis是默认保护模式,只能本虚拟机访问,不允许其他ip访问,本人刚开始图方便啥都不设,结果在这里踩坑了 .还有linux的防火墙开放端口还有aliyun的安全组 在配置文件里面设置requirepass 重启redis ~~~ # service不行就用systemctl sudo service redis restart ~~~ 在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 no