一: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