微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

DENIED Redis is running in protected mode because protected mode is enabled

背景:在codis的admin界面中准备添加redis提示错误

DENIED Redis is running in protected mode because protected mode is enabled

具体错误如下:

 "Cause": "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.",    "Stack": [
        {
            "Name": "github.com/CodisLabs/codis/pkg/utils/redis.(*Client).Do",            "File": "/opt/gowork/src/github.com/CodisLabs/codis/pkg/utils/redis/client.go",            "Line": 74
        },        {
            "Name": "github.com/CodisLabs/codis/pkg/utils/redis.(*Client).SlotsInfo",            "Line": 269
        },        {
            "Name": "github.com/CodisLabs/codis/pkg/topom.(*apiServer).GroupAddServer",            "File": "/opt/gowork/src/github.com/CodisLabs/codis/pkg/topom/topom_api.go",            "Line": 375
        },        {
            "Name": "github.com/CodisLabs/codis/pkg/topom.(*apiServer).GroupAddServer-fm",            "Line": 91
        }
    ]
}

解决办法:

打开redis配置文件,如/etc/codis/codis-server/redis7021.conf

# bind 127.0.0.1 
protected-mode no  # 保护模式

杀死原本的redis进程

>>> ps -ef | grep codis  # 查看codis运行的进程

root     13695     1  0 11:47 ?        00:00:05 codis-server *:7021
root     13700     1  0 11:47 ?        00:00:05 codis-server *:7022
root     13719 26723  0 11:55 pts/21   00:00:07 codis-proxy --ncpu=1 --config=/etc/codis/codis-proxy/proxy.toml --log=/usr/local/codis/logs/proxy.log --log-level=warn

>>> kill -9 13695
>>> kill -9 13700

开启codis-server

codis-server /etc/codis/codis-server/redis7021.conf 
codis-server /etc/codis/codis-server/redis7022.conf

如果部分无法看懂,请参考文章

ubuntu 安装codis详细教程


版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐