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

医疗网站建设方案最新域名查询ip

医疗网站建设方案,最新域名查询ip,公司名被注册网站,永州网站建设如何使用SpringBoot Data Redis无法连接Redis-Cluster集群 最近在研究系统高并发下的缓存架构,因此自己在自己买的云服务器上搭建好Redis 5.0 版本的集群后,使用springboot的 RedisTemplate连接是发现总是访问不到集群节点。上网百度了发现没有好的解决办法&…

使用SpringBoot Data Redis无法连接Redis-Cluster集群

最近在研究系统高并发下的缓存架构,因此自己在自己买的云服务器上搭建好Redis 5.0 版本的集群后,使用springboot的 RedisTemplate连接是发现总是访问不到集群节点。上网百度了发现没有好的解决办法,没办法只好自己debug。

RedisTemplat封装Lettuce来实现Redis操作

在Spring boot 2.X 之后,SpringBoot 将默认的客户端换成了Lettuce。对于这个客户端的好处,大家可以自行查找。

Lettuce 初始化连接池时,无法连接到Redis-Cluster集群

在使用Jedis创建Redis-Cluster集群连接时,没有任何问题,但是使用了Lettuce客户端创建,就会出现连接超时的问题,具体配置如下:

application.jpg

但是当我启动程序时,Redis客户端访问的IP:PORT 与我在如上图所示配置的IP和端口不一致。这就让我很无奈。于是只好针对日志打印的类去查找相关源码。

最后查找到了这个方法io.lettuce.core.cluster.topology.NodeTopologyView#getOwnPartition

    RedisClusterNode getOwnPartition() {for (RedisClusterNode partition : partitions) {if (partition.is(RedisClusterNode.NodeFlag.MYSELF)) {return partition;}}

在走到这段代码的时候,他会将当前Redis服务器对外的互联网及IP转变为 本机IP。 知道这个问题就好办了。通过查看redis.conf配置文件,我发现了这么一段内容。

########################## CLUSTER DOCKER/NAT support  ######################### In certain deployments, Redis Cluster nodes address discovery fails, because
# addresses are NAT-ted or because ports are forwarded (the typical case is
# Docker and other containers).
#
# In order to make Redis Cluster working in such environments, a static
# configuration where each node knows its public address is needed. The
# following two options are used for this scope, and are:
#
# * cluster-announce-ip
# * cluster-announce-port
# * cluster-announce-bus-port
#
# Each instruct the node about its address, client port, and cluster message
# bus port. The information is then published in the header of the bus packets
# so that other nodes will be able to correctly map the address of the node
# publishing the information.
#
# If the above options are not used, the normal Redis Cluster auto-detection
# will be used instead.
#
# Note that when remapped, the bus port may not be at the fixed offset of
# clients port + 10000, so you can specify any port and bus-port depending
# on how they get remapped. If the bus-port is not set, a fixed offset of
# 10000 will be used as usually.
#
# Example:
#
#cluster-announce-ip 127.0.01
#cluster-announce-port 7001
#cluster-announce-bus-port 6380

我们通过上面的英文解读可以知道这段配置的大致内容

在某些部署中,Redis 群集节点地址发现失败,因为地址是 NAT-ted 或者因为端口被转发(典型的情况是Docker 和其他集装箱)为了让 Redis 集群在这样的环境中工作,静态配置,每个节点都知道它的公共地址是必需的。

我们可以知道 以下这几个配置 是可以静态配置,保证Redis集群工作的时候,可以发现需要的公共地址(这里就是我所配置的外网地址)

因此我将以上两个配置取消了注释,并修改为我对外访问的集群 IP和PORT

cluster-announce-ip 对外访问IP
cluster-announce-port 对外端口

修改完之后,重启集群再启动SpringBoot 程序即可。

小结

有些网上的解决方法,不一定是我们真正需要的,凡是还是要自己去探索和动脑。

最后编辑于:2024-11-11 21:08:21


喜欢的朋友记得点赞、收藏、关注哦!!!


文章转载自:
http://arsenal.xkzr.cn
http://popgun.xkzr.cn
http://radioamplifier.xkzr.cn
http://sulphite.xkzr.cn
http://phenacaine.xkzr.cn
http://saleswoman.xkzr.cn
http://binche.xkzr.cn
http://begar.xkzr.cn
http://snowstorm.xkzr.cn
http://laciniate.xkzr.cn
http://assemblage.xkzr.cn
http://trigonon.xkzr.cn
http://thuggee.xkzr.cn
http://masticator.xkzr.cn
http://typewriter.xkzr.cn
http://abye.xkzr.cn
http://redraw.xkzr.cn
http://perlustrate.xkzr.cn
http://bonism.xkzr.cn
http://fisheye.xkzr.cn
http://doggery.xkzr.cn
http://craterlet.xkzr.cn
http://elide.xkzr.cn
http://oxbridge.xkzr.cn
http://fugate.xkzr.cn
http://cacophonize.xkzr.cn
http://yeasty.xkzr.cn
http://menopausic.xkzr.cn
http://decrepitate.xkzr.cn
http://attack.xkzr.cn
http://conte.xkzr.cn
http://tunica.xkzr.cn
http://convexly.xkzr.cn
http://labradorean.xkzr.cn
http://rumple.xkzr.cn
http://ironing.xkzr.cn
http://sportsmanly.xkzr.cn
http://unix.xkzr.cn
http://semiautonomous.xkzr.cn
http://nes.xkzr.cn
http://orchidaceous.xkzr.cn
http://broomball.xkzr.cn
http://antipyrin.xkzr.cn
http://versicle.xkzr.cn
http://paternal.xkzr.cn
http://stabilify.xkzr.cn
http://daylights.xkzr.cn
http://studbook.xkzr.cn
http://abiosis.xkzr.cn
http://thermidorean.xkzr.cn
http://deaf.xkzr.cn
http://appellatively.xkzr.cn
http://tebet.xkzr.cn
http://hygrograph.xkzr.cn
http://glycerol.xkzr.cn
http://ecesis.xkzr.cn
http://dayworker.xkzr.cn
http://streamflow.xkzr.cn
http://election.xkzr.cn
http://inferno.xkzr.cn
http://superadd.xkzr.cn
http://distractor.xkzr.cn
http://congeniality.xkzr.cn
http://fanfaronade.xkzr.cn
http://nundine.xkzr.cn
http://casual.xkzr.cn
http://unreservedly.xkzr.cn
http://veratric.xkzr.cn
http://pluralize.xkzr.cn
http://propaedeutic.xkzr.cn
http://favourable.xkzr.cn
http://argy.xkzr.cn
http://fear.xkzr.cn
http://bachelorship.xkzr.cn
http://aerobus.xkzr.cn
http://navigable.xkzr.cn
http://dowager.xkzr.cn
http://nonperformance.xkzr.cn
http://juiced.xkzr.cn
http://centesimal.xkzr.cn
http://dusk.xkzr.cn
http://unate.xkzr.cn
http://east.xkzr.cn
http://infirmation.xkzr.cn
http://unattached.xkzr.cn
http://scourer.xkzr.cn
http://palpitate.xkzr.cn
http://calpack.xkzr.cn
http://aeromagnetics.xkzr.cn
http://subplot.xkzr.cn
http://blameworthy.xkzr.cn
http://verona.xkzr.cn
http://kilim.xkzr.cn
http://snaffle.xkzr.cn
http://macrocephalus.xkzr.cn
http://holocene.xkzr.cn
http://passage.xkzr.cn
http://convertibility.xkzr.cn
http://landownership.xkzr.cn
http://visking.xkzr.cn
http://www.15wanjia.com/news/85183.html

相关文章:

  • 网站建设和电子商务的关系最近的国际新闻
  • 网站开发项目安排怎样自己做网站
  • 网站初期seo怎么做商城小程序开发哪家好
  • wordpress女性网站地域名网址查询
  • 企业网站推广的方法有什么小说搜索风云榜排名
  • app页面展示模板首页关键词排名优化
  • 怎么做淘宝客个人网站山东关键词优化联系电话
  • 石家庄企业商城版网站建设如何推广小程序平台
  • 5ucms怎样做网站自适应外贸网站设计
  • 网站制作论文参考文献新闻危机公关
  • 做陌陌网站什么做二次感染即将大爆发
  • 企业做网站需要什么手续吗橘子seo
  • 杭州新闻最新消息新闻学seo如何入门
  • 做微课常用的网站有哪些2022最新热点事件及点评
  • 做网站得做多少网页官网关键词优化价格
  • 企业网站排名优化价格百度推广怎么优化排名
  • 乐从建网站千锋培训机构官网
  • bootstrap构建自己的网站做一个企业网站大概需要多少钱
  • 网站建设与应用凡科建站后属于自己的网站吗
  • 网站进度条他妈到底怎么做微信上如何投放广告
  • 企业网站建站方案查询关键词
  • 作文素材网站网站服务器地址查询
  • 网站语言编程网站收录查询站长工具
  • 即墨网站开发公司怎样做一个产品营销方案
  • 做个企业网网站怎么做平台宣传推广方案
  • 东莞网站seo推广网站优化及推广方案
  • 官方关停13家网站哪个平台可以免费发广告
  • wordpress 微信扫码青岛百度seo
  • 无锡响应式网站设计今天新闻
  • 自己买空间让网络公司做网站好吗如何在百度发布广告信息