spring链接redis报错 Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 12910 172.16.4.99:6379

记录一次生产环境的redis切换事故
生产环境redis切换,由原来的直连ip服务改为阿里的redis集群,出现了链接失败的错误
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MOVED 12910 172.16.4.99:6379
原因是集群的spring配置方式和单机的不一样
单机的链接方式

spring: 
  redis:
    host: 127.0.0.1
    port: 6379
    password: 123
    database: 0

集群配置方式

spring: 
  redis:
    cluster:
      nodes: safasafdsasdasas.dsad.asf.aliyuncs.com:6379
    password: dsafdfaasdf
    database: 0
posted @ 2022-07-20 21:25  darling331  阅读(13487)  评论(0编辑  收藏  举报