springboot整合linux上的redis时报错怎么解决
springboot整合linux上的redis时报错怎么解决
这篇文章主要介绍“springboot整合linux上的redis时报错怎么解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“springboot整合linux上的redis时报错怎么解决”文章能帮助大家解决问题。
如果你在springboot整合linux上的redis时,其他配置都对了,但是访问时依然提示下面信息:
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
DENIEDRedisisrunninginprotectedmodebecauseprotectedmodeisenabled,nobindaddresswasspecified,noauthenticationpasswordisrequestedtoclients.Inthismodeconnectionsareonlyacceptedfromtheloopbackinterface.IfyouwanttoconnectfromexternalcomputerstoRedisyoumayadoptoneofthefollowingsolutions:1)Justdisableprotectedmodesendingthecommand'CONFIGSETprotected-modeno'fromtheloopbackinterfacebyconnectingtoRedisfromthesamehosttheserverisrunning,howeverMAKESURERedisisnotpubliclyaccessiblefrominternetifyoudoso.UseCONFIGREWRITEtomakethischangepermanent.2)AlternativelyyoucanjustdisabletheprotectedmodebyeditingtheRedisconfigurationfile,andsettingtheprotectedmodeoptionto'no',andthenrestartingtheserver.3)Ifyoustartedtheservermanuallyjustfortesting,restartitwiththe'--protected-modeno'option.4)Setupabindaddressoranauthenticationpassword.NOTE:Youonlyneedtodooneoftheabovethingsinorderfortheservertostartacceptingconnectionsfromtheoutside.
那就在Linux上启动redis时选择使用绝对路径试试,我就是各种尝试无效后,通过这种方式搞定的!特此记录,已备查用!
例如我的启动命令是下面这样:
[root@localhostfsrm]#/usr/local/redis/bin/redis-server/home/fsrm/文档/redis.conf
之前怎么改都不生效,可能是启动时加载了默认redis.conf配置文件,导致不是以自己修改后的配置文件启动,所以任何改动都是没有意义的!
下面是Linux下使用redis时几个常用的命令
[root@localhost]#ps-ef|grepredis//查看redis进程信息[root@localhostfsrm]#kill-9XXXX//杀死XXXX端口号对应进程
redis.conf配置文件里的几个配置项
#bind127.0.0.1//注释掉才能通过外网访问daemonizeyes//以守护进程启动默认时noprotected-modeno//取消保护模式默认时yes开启
还有就是重启完redi后,springboot项目也要重启,否则不生效!
关于“springboot整合linux上的redis时报错怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注恰卡编程网行业资讯频道,小编每天都会为大家更新不同的知识点。
推荐阅读
-
linux怎么搭建ftp服务器(linux ftp命令)
linuxftp命令?很欢喜问本问题,此观点祝你好运吧!再连接ftp服务器。格式:ftp[hostname|ip-address...
-
linux怎么调出屏幕键盘(linux | 怎么打出来,管道符号怎么打)
linux|怎么打出来,管道符号怎么打?楼主,你好!“|”这个符号在linux环境称做“管道符”框输入方法:Shift键盘的“...
-
linux系统生成core文件(linux udp缓存配置)
linuxudp缓存配置?临时再添加:sysctl-w_max26214400无限制再添加:将以下行添加到中:_max26214...
-
vue动态添加删除输入框(springboot vue怎么让数据库显示出来)
springbootvue怎么让数据库显示出来?一般情况下是前端调阅后端接口,来获取到数据库的数据,后端哪里会把数据库的数据整理...
-
php如何让Swoole/Pool进程池实现Redis持久连接
php如何让Swoole/Pool进程池实现Redis持久连接本篇...
-
linux Centos如何安装PHP7
linuxCentos如何安装PHP7今天小编给大家分享一下li...
-
干了10多年的php,还不会安装,是不是丢人
-
php操作redis大全记录
php连接redis测试˂?php$redis=newRedis();$redis-˃conne...
-
Linux编程的十大代码编辑器新鲜出炉,你用的入榜单了吗?
-
从7到8,CentOS又更新了什么