当前位置: 首页 > news >正文

网站的类型主要有营销方案推广

网站的类型主要有,营销方案推广,平台制作专业网站制作,自己做公司网站简单吗目录 Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:用客户端Redis Desktop Manager一样的密码端口,是可以正常连接的,但是运行java程序之后使用接口请求就会报错 Unable to connect to Redis; nested e…

目录

Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:用客户端Redis Desktop Manager一样的密码端口,是可以正常连接的,但是运行java程序之后使用接口请求就会报错

Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379


首先引入相关的依赖:我使用的springBoot版本是 2.5.2

<!-- 提供Redis连接池 -->
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId>
</dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
spring: # redis配置 redis:# Redis数据库索引(默认为0)database: 1# Redis服务器地址host: 127.0.0.1# Redis服务器连接端口port: 6379# Redis服务器连接密码(默认为空)password: root# 连接超时时间timeout: 10slettuce:pool:# 连接池最大连接数max-active: 200# 连接池最大阻塞等待时间(使用负值表示没有限制)max-wait: -1ms# 连接池中的最大空闲连接max-idle: 10# 连接池中的最小空闲连接min-idle: 0

Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:
用客户端Redis Desktop Manager一样的密码端口,是可以正常连接的,但是运行java程序之后使用接口请求就会报错

运行遇到的几个问题:

1、Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException:
用客户端Redis Desktop Manager一样的密码端口,是可以正常连接的,但是运行java程序之后使用接口请求就会报错,所以对配置文件redis.conf进行如下修改:

1. 修改protected-mode配置的值为no

protected-mode 是 Redis 配置文件中的一个选项,用于控制 Redis 是否启用保护模式。当 protected-mode 设置为 yes 时,表示 Redis 处于保护模式,只能通过本地回环地址(127.0.0.1)来访问 Redis 服务,即只允许本地客户端进行连接,而不允许外部网络访问。

2. 注释#bind 127.0.0.1

默认情况下,bind 设置为空,表示 Redis 监听所有可用的网络接口,包括本地127.0.0.1和外部网络地址。这意味着 Redis 可以接受来自任何网络接口的连接。当将 bind 设置为具体的 IP 地址或主机名时,Redis 将仅监听指定的网络接口,而不再监听其他网络接口。例如,如果将 bind 设置为 127.0.0.1,则 Redis 只会监听本地回环地址,即只允许本地客户端进行连接,而拒绝来自外部网络的连接。

3. 增加redis连接密码

 在redis.conf配置文件中搜索requirepass,就可以添加密码了:

 然后重新启动redis就行。

上面都配置好后,但是还是报错,报错内容如下:

"Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379

Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379

 原因是配置文件有问题,刚刚我们的配置文件是:

 需要把password修改为 auth:

  redis:database: 0host: localhostport: 6379auth: abc123456

这样就可以正常访问了!

http://www.ds6.com.cn/news/102298.html

相关文章:

  • 站长推荐黄色长沙网络营销公司排名
  • 平面设计公司广告语seo 首页
  • wordpress调用微云视频宁波seo网络推广外包报价
  • 佛山高端网站建设信息推广平台
  • 济南百度竞价代运营seo查询外链
  • 马鞍山网站建设公司排名百度网址链接
  • 珠海企业网站建设社群营销的十大案例
  • bootstrap做的网站微信广告推广如何收费
  • 小县城做网站建立一个企业网站需要多少钱
  • 惠州做企业网站的石家庄网站建设
  • 做t-shirt素材网站百度seo招聘
  • 怎么用dw做响应式网站百度推广开户联系方式
  • 建设网站对比方案营销平台建设
  • 重庆石柱网站设计公司企业做推广有用吗
  • 做网站有什么软件郑州网站优化推广
  • wordpress用nginxseo这个行业怎么样
  • 抖音小程序平台站长工具seo查询
  • 网站培训制度国内好用的搜索引擎
  • 网站怎么做不违法吗百度一下你就知道主页
  • asp网站用ftp怎么替换图片如何快速搭建一个网站
  • 百度云做网站网络营销师资格证报名
  • 哈尔滨优化网站排名百度推广平台登录
  • 昆明有哪些帮忙做网站的公司做个网页需要多少钱?
  • 怎样免费建个人网站百度手机助手安卓版下载
  • 网站名称不能涉及百度贴吧广告投放
  • 网站每年的维护费重庆seo招聘
  • 重庆企业做网站搜索引擎优化效果
  • 杭州网络推广公司那家好汕头seo公司
  • 兰州做it网站运营的怎么样河南seo网站多少钱
  • 用css做商务网站的代码如何统计网站访问量