网站建设资讯详细

nacos结合seata 分布式事务报错解决方案,can not get cluster name in registry config,please make sure registry 通过nacos设置命名空间解决

发表日期:2023-05-14 12:10:09   作者来源:shuimu   浏览:1858       

1:nacos新建一个单独的命名空间,命名:SEATA_GROUP

2:导入相关设置 3:seata registry.conf 配置

3:seata的registry.conf 配置

registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"

  nacos {
    application = "seata-server" #seata注册到nacos上面的应用名
    serverAddr = "https://www.shuimuinfo.com:8848" #注册中心的地址
    group = "SEATA_GROUP" #分组
    namespace = "55acac11-5345-4ba5-9d47-4c999ae27c6d" 
    cluster = "default" #集群名
    username = "nacos" #nacos的用户名
    password = "nacos" #nacos密码
  }
  
  redis {
    #serverAddr = "localhost:6379"
    serverAddr = "https://www.shuimuinfo.com:6379"
    db = 0
    password = "***"
    cluster = "default"
    timeout = 0
  }
}

config {
  # file、nacos 、apollo、zk、consul、etcd3
  type = "nacos"

  nacos {
    serverAddr = "127.0.0.1:8848"
    namespace = "55acac11-5345-4ba5-9d47-4c999ae27c6d" 
    group = "SEATA_GROUP"
    username = "nacos"
    password = "nacos"
    dataId = "seataServer.properties"
  }
}

4:项目中设置上面创建的命名空间

config:
  type: nacos
  nacos:
    namespace: 55acac11-5345-4ba5-9d47-4c999ae27c6d #配置上面的namespace
    serverAddr: https://www.shuimuinfo.com:8848 #nacos地址
    group: SEATA_GROUP
    userName: nacos
    password: nacos
registry:
  type: nacos
  nacos:
    application: seata-server
    serverAddr: https://www.shuimuinfo.com:8848
    group: SEATA_GROUP
    namespace: 55acac11-5345-4ba5-9d47-4c999ae27c6d
    userName: nacos
    password: nacos
    cluster: default