加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

DENIED Redis is running in protected mode because protected

发布时间:2020-12-16 04:39:11 所属栏目:安全 来源:网络整理
导读:背景:在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?a

背景:在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详细教程


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读