• nacos seata 微服务seata注册报错


    nacos版本 1.4.1
    seata版本 1.4.1
    具体报错日志:

    ...
    no available service found in cluster 'default', please make sure registry cluster
    ...
    

    配置文件:

    registry.yml

    #nacos seata都装在docker里,这里可以直接通过docker服务名访问
    registry {
      # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
      type = "nacos"
    
      nacos {
        application = "seata-server"
        serverAddr = "dev-nacos-server" 
        group = "SEATA_GROUP"
        namespace = ""
      }
    }
    
    config {
      type = "nacos"
    
      nacos {
        serverAddr = "dev-nacos-server"
        namespace = ""
        group = "SEATA_GROUP"
        username = "nacos"
        password = "nacos"
      }
    }
    

    file.conf

    ## transaction log store, only used in seata-server
    store {
      ## store mode: file、db、redis
      mode = "db"
      ## rsa decryption public key
      publicKey = ""
      ## file store property
    
    
      ## database store property
      db {
        ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
        datasource = "druid"
        ## mysql/oracle/postgresql/h2/oceanbase etc.
        dbType = "mysql"
        driverClassName = "com.mysql.jdbc.Driver"
        ## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
        url = "jdbc:mysql://**/seata?rewriteBatchedStatements=true"
        user = "**"
        password = "**"
        minConn = 5
        maxConn = 100
        globalTable = "global_table"
        branchTable = "branch_table"
        lockTable = "lock_table"
        queryLimit = 100
        maxWait = 5000
      }
    }
    

    application.yml

    *其中主要问题就在这里:

    可以看到默认的Group为SEATA_GROUP,需要与nacos中注册上去的seata服务的group一致才能访问到;

    seata:
      tx-service-group: ${spring.application.name}-group
      registry:
        type: nacos
        nacos:
          server-addr: ${spring.profiles.active}-nacos-server:8848
          #      server-addr: localhost
          namespace:
      config:
        type: nacos
        nacos:
          server-addr: ${spring.profiles.active}-nacos-server:8848
          #      server-addr: localhost
          namespace:
    
  • 相关阅读:
    单元测试乱弹(一):悲剧的测试工具
    Android 4.2中sqlite操作问题(二):某些情况下显式启用事务能提高操作效率
    some code of debug mode
    asp .NET弹出窗口 汇总
    if (!IsPostBack)
    Asp.Net中清空所有textbox的几种方法
    ASP.NET验证控件详解
    正则表达式限制文本框只能输入数字
    颜色
    gridview 根据条件更改链接的可用和颜色
  • 原文地址:https://www.cnblogs.com/liaoweiming/p/14893954.html
Copyright © 2020-2023  润新知