springboot整合redis报错:链接失败;org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis

一般这种报错的原因要么是没有开放虚拟机的6379的端口号,要么是因为redis的配置文件没有修改。现在我们来一个一个排除解决这些问题。

开放6379端口号

1,开启防火墙

systemctl start firewalld

2,开放指定端口

firewall-cmd --zone=public --add-port=6379/tcp --permanent

3,重启防火墙

firewall-cmd --reload
修改redis的配置文件redis.conf
vim /usr/local/bin/myredisconfig/redis.conf

进入redis的编辑将 bind 127.0.0.1 注释,将 protected-mode 改为 no:

默认情况bind 127.0.0.1只能接受本机的访问请求,注释掉则意味着无限制接受任何ip地址的访问, 生产环境肯定要写你应用服务器的地址;如果开启了 protected-mode,那么在没有设定 bind ip 且没有设密 码的情况下,Redis 只允许接受本机的响应。

关闭redis

redis-cli -h 127.0.0.1 -p 6379 shutdown

启动redis

redis-server myredisconfig/redis.conf
redis-server myredisconfig/redis.conf

现在再运行项目就成功啦

springboot整合redis报错:链接失败; Unable to connect to Redis的更多相关文章

  1. Springboot整合Elasticsearch报错availableProcessors is already set to [4], rejecting [4]

    Springboot整合Elasticsearch报错 今天使用SpringBoot整合Elasticsearch时候,相关的配置完成后,启动项目就报错了. nested exception is j ...

  2. SpringBoot:springboot整合eureka报错 Unable to start embedded Tomcat

    报错信息: org.springframework.context.ApplicationContextException: Unable to start web server; nested ex ...

  3. springboot整合activiti报错[processes/]不存在解决方案

    springboot整合activiti时,启动抛异常 nested exception is java.io.FileNotFoundException: class path resource [ ...

  4. springboot整合jsp报错

    今天在学springboot整合jsp时遇到了一个问题,虽然jsp不被spring官方推荐使用,但抱着学习的心态还是想解决一下这个问题.在写好了需要pom文件之后,访问网站得到了500的错误提示,后台 ...

  5. svn更新报错:svn unable to connect to a repository at url

    出现错误:unable to connect to a repository at url 解决办法1. 右键点击本地副本,TortoiseSVN -> Settings -> Saved ...

  6. springboot整合mybatis报错:Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation...

    <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis- ...

  7. springboot整合mybatis报错

    java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more ...

  8. springboot 整合spark-sql报错

    Exception in thread "main" org.spark_project.guava.util.concurrent.ExecutionError: java.la ...

  9. SpringBoot整合Dubbo报错: java.lang.ClassCastException

    com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method queryGoodsLimitPage to regi ...

  10. springboot整合cache报错org.springframework.cache.ehcache.EhCacheCacheManager cannot be cast to net.sf.ehcache.CacheManager

    原来的代码 private static CacheManager cacheManager = SpringContextHolder.getBean("cacheManager" ...

随机推荐

  1. 数据库中的可视化和探索性:MongoDB的数据可视化和探索性工具

    目录 1. 引言 2. 技术原理及概念 2.1 基本概念解释 2.2 技术原理介绍 2.3 相关技术比较 3. 实现步骤与流程 3.1 准备工作:环境配置与依赖安装 3.2 核心模块实现 3.3 集成 ...

  2. git reset --hard 撤回后commit的代码消失了的解决办法

    楼主在今天的工作中使用了这个命令 git reset --hard 撤回后commit的代码消失了,因为有commit,所以暂时得到了拯救,太不容易了,差点以为自己写的代码没了. 网上到处找帖子,看看 ...

  3. Redis基础(二)——列表操作、redis管道、Django中使用redis

    Redis列表操作 ''' lpush(name,values) rpush(name, values) 表示从右向左操作 lpushx(name,value) rpushx(name, value) ...

  4. Github秒变VSCode在线编辑器

    在仓库页面 在网页地址中github后面加上 1s 即可

  5. 从钢铁行业数字化管控与超自动化融合,看华为WeAutomate能力进化

    文/王吉伟 钢铁行业的数字化转型,历来都是值得探讨的热点话题. 2022年,我国粗钢产量10.13亿吨,占据了全球钢铁供给市场的半壁江山. 这组数据可谓非常抢眼,但仍旧难掩诸多企业的各种经营问题. 钢 ...

  6. 【小小demo】Springboot + Vue 增删改查

    vue-table-ui 该工程提供的是 一个简单的 Vue + Element-UI 的表格,增删改查操作. 工程代码在最下面. 环境 jdk1.8 idea maven springboot 2. ...

  7. 详解RISC v中断

    声明 本文为本人原创,未经许可严禁转载.部分图源自网络,如有侵权,联系删除. RISC-V 中断与异常 trap(陷阱)可以分为异常与中断.在 RISC v 下,中断有三种来源:software in ...

  8. JavaScript进阶指南: DOM与BOM操作,从初学者到专家,一步也能登天一篇文章就足够了

    DOM与BOM操作 复习链接: http://c.biancheng.net/view/9360.html 事件对象: https://www.runoob.com/jsref/dom-obj-eve ...

  9. [自然语言处理] 自然语言处理库spaCy使用指北

    spaCy是一个基于Python编写的开源自然语言处理库.基于自然处理领域的最新研究,spaCy提供了一系列高效且易用的工具,用于文本预处理.文本解析.命名实体识别.词性标注.句法分析和文本分类等任务 ...

  10. Go函数可以返回多个值

    1 package main 2 3 import "fmt" 4 5 func swap(x, y string) (string, string){ 6 return y,x ...