微服务整合Seata异常处理:no available service ‘default‘ found, please make sure registry config correct

一:YML配置信息

seata:
  enabled: true
  application-id: ${spring.application.name}
  # 事务组
  tx-service-group: my_test_tx_group
  # 数据源代理模式
  enable-auto-data-source-proxy: true
  # 数据源代理模式
  data-source-proxy-mode: AT
  # 事务组
  service:
    vgroup-mapping:
      my_test_tx_group: default
  #整合nacos配置
  config:
    type: nacos
    nacos:
      server-addr: 192.101:8848
      group: SEATA_GROUP
      namespace: d4874eb0-1917-45fd-8dc1-34f6f3f5265a
      data-id: seataServer.properties
      #可选
      username: nacos
      #可选
      password: nacos
  #整合nacos注册中心
  registry:
    type: nacos
    nacos:
      server-addr: 192.101:8848  
      application: seata-server  
      group: SEATA_GROUP 
      username: nacos
      password: nacos
      namespace: d4874eb0-1917-45fd-8dc1-34f6f3f5265a

二:启动异常日志

2022-12-26 22:26:27.065 ERROR 25384 --- [eoutChecker_1_1] i.s.c.r.netty.NettyClientChannelManager  : no available service 'default' found, please make sure registry config correct

在这里插入图片描述

三:异常信息排查

3.1:锁定包路径 io.seata.core.rpc.netty

在这里插入图片描述

3.2:全局搜索异常关键字:please make sure registry config correct

在这里插入图片描述

3.3:问题定位

打断点一层层查看变量信息,最后是获取不到Nacos对应的vgroupMapping键值对信息。

3.3.1 :注意:如果Seata配置信息是Nacos类型,即使在file文件中配置了vgroupMapping,不是file类型也获取不到,这里用的Nacos,应该在Nacos配置中进行配置

这里的YML中的事务组和Nacos – vgroupMapping配置的事务组信息必须一致

 # 这段不是完整配置信息,单独提出来的
 tx-service-group: my_test_tx_group
   service:
    vgroup-mapping:
      my_test_tx_group: default
seata:
  enabled: true
  application-id: ${spring.application.name}
  # 事务组
  tx-service-group: my_test_tx_group
  # 数据源代理模式
  enable-auto-data-source-proxy: true
  # 数据源代理模式
  data-source-proxy-mode: AT
  # 事务组
  service:
    vgroup-mapping:
      my_test_tx_group: default
service {
   
  #transaction service group mapping
  vgroupMapping.my_test_tx_group = "default"
  default.grouplist = "192..101:8091"
  #degrade, current not support
  enableDegrade = false
  #disable seata
  disableGlobalTransaction = false
}
#client tr

四:问题解决

4.1. 配置 nacos-config.sh 和 config.txt

在这里插入图片描述

4.1.1. 编辑nacos-config.sh nacos配置文件加载sh执行文件
4.1.1.1 代码如下
#copyright 1999-2019 Seata.io Group.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at、
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值