记录一次生产环境的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
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐