Open lly835 opened 3 years ago
您用的是那个版本啊 1.4我这边都改了,但是还在报错 transport.shutdown.wait=3 service.vgroupMapping.oauth-seata-service-group=default service.vgroupMapping.contract-seata-service-group=default service.vgroupMapping.financial-seata-service-group=default service.default.grouplist=127.0.0.1:8091 service.enableDegrade=false 这个是我在nacos中的配置[17:39:12] [main] [INFO ] c.a.d.p.DruidDataSource {dataSource-1} inited [17:39:12] [main] [INFO ] i.s.s.a.d.SeataAutoDataSourceProxyCreator Auto proxy of [dataSource] [17:39:13] [main] [ERROR] i.s.c.r.n.NettyClientChannelManager can not get cluster name in registry config 'service.vgroupMapping.oauth-seata-service-group', please make sure registry config correct [17:39:13] [main] [INFO ] o.a.c.c.StandardContext Suspicious URL pattern: [/ants/**] in context [], see sections 12.1 and 12.2 of the Servlet specification 这个是我在项目中的报错
如果是手动添加的检查下group 可能是填的默认的DEFAULT_GROUP
找到问题了,dataId必须是service.vgroupMapping+分组
我这里跑的是springcloud-eureka-seata 项目也是包的这个错误
环境 nacos 1.4.1 seata 1.3 报错"can not get cluster name in registry config 'service.vgroupMapping.xxx_group', please make sure registry config correct "; 在registry.conf 中 registry 和 config使用的都是 nacos; 解决: 项目中 的yml 配置“tx-service-group: xxx_group“ 要在nacos的配置中心 ,要有与之对应的“service.vgroupMapping.xxx_group=default”;(自己踩得坑:yml中配置seata的信息时没有配置seata.config.nacos.namespace的值,导致一直找不到对应的配置。配置地址信息一定要全)
nacos 1.3.0
seata 1.4.2
采用nacos作为配置中心
同样的报错
解决办法:
方法1. 手动在nacos中seata对应的配置组中(默认SEATA_GROUP)增加配置项service.vgroupMapping.
seata-server-1.4.0 nacos-server-1.4.2
server: port: 8102
spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/seata?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true username: root password: 123456 application: name: dubbo-account-example
dubbo: application: id: dubbo-account-example name: dubbo-account-example qosEnable: false protocol: id: dubbo name: dubbo port: 20883 registry: id: dubbo-account-example-registry address: nacos://127.0.0.1:8848 config-center: address: nacos://127.0.0.1:8848 metadata-report: address: nacos://127.0.0.1:8848
mybatis-plus: mapper-locations: classpath:/mapper/.xml typeAliasesPackage: io.seata.samples.integration.*.entity configuration: map-underscore-to-camel-case: true global-config: db-config: id-type: auto
seata: enabled: true application-id: account-seata-example tx-service-group: account-service-seata-service-group # 事务群组(可以每个应用独立取名,也可以使用相同的名字) client: rm-report-success-enable: true rm-table-meta-check-enable: false # 自动刷新缓存中的表结构(默认false) rm-report-retry-count: 5 # 一阶段结果上报TC重试次数(默认5) rm-async-commit-buffer-limit: 10000 # 异步提交缓存队列长度(默认10000) rm: lock: lock-retry-internal: 10 # 校验或占用全局锁重试间隔(默认10ms) lock-retry-times: 30 # 校验或占用全局锁重试次数(默认30) lock-retry-policy-branch-rollback-on-conflict: true # 分支事务与其它全局回滚事务冲突时锁策略(优先释放本地锁让回滚成功) tm-commit-retry-count: 3 # 一阶段全局提交结果上报TC重试次数(默认1次,建议大于1) tm-rollback-retry-count: 3 # 一阶段全局回滚结果上报TC重试次数(默认1次,建议大于1) undo: undo-data-validation: true # 二阶段回滚镜像校验(默认true开启) undo-log-serialization: jackson # undo序列化方式(默认jackson) undo-log-table: undo_log # 自定义undo表名(默认undo_log) support: spring: datasource-autoproxy: true service: vgroup-mapping: account-service-seata-service-group: default # TC 集群(必须与seata-server保持一致) enable-degrade: false # 降级开关 disable-global-transaction: false # 禁用全局事务(默认false) grouplist: default: 127.0.0.1:8091 transport: shutdown: wait: 3 thread-factory: boss-thread-prefix: NettyBoss worker-thread-prefix: NettyServerNIOWorker server-executor-thread-prefix: NettyServerBizHandler share-boss-worker: false client-selector-thread-prefix: NettyClientSelector client-selector-thread-size: 1 client-worker-thread-prefix: NettyClientWorkerThread type: TCP server: NIO heartbeat: true serialization: seata compressor: none enable-client-batch-send-request: true # 客户端事务消息请求是否批量合并发送(默认true) registry: file: name: file.conf type: nacos nacos: server-addr: localhost:8848 namespace: cluster: default config: file: name: file.conf type: nacos nacos: server-addr: localhost:8848 namespace: 0af6e97b-a684-4647-b696-7c6d42aecce7 group: SEATA_GROUP log: exception-rate: 100 # 日志异常输出概率(默认100)
transport.type=TCP transport.server=NIO transport.heartbeat=true transport.thread-factory.boss-thread-prefix=NettyBoss transport.thread-factory.worker-thread-prefix=NettyServerNIOWorker transport.thread-factory.server-executor-thread-prefix=NettyServerBizHandler transport.thread-factory.share-boss-worker=false transport.thread-factory.client-selector-thread-prefix=NettyClientSelector transport.thread-factory.client-selector-thread-size=1 transport.thread-factory.client-worker-thread-prefix=NettyClientWorkerThread transport.thread-factory.boss-thread-size=1 transport.thread-factory.worker-thread-size=8 transport.shutdown.wait=3 service.vgroupMapping.order-service-seata-service-group=default service.vgroupMapping.account-service-seata-service-group=default service.vgroupMapping.storage-service-seata-service-group=default service.vgroupMapping.business-service-seata-service-group=default service.enableDegrade=false service.disable=false service.max.commit.retry.timeout=-1 service.max.rollback.retry.timeout=-1 client.async.commit.buffer.limit=10000 client.lock.retry.internal=10 client.lock.retry.times=30 store.mode=db store.file.dir=file_store/data store.file.max-branch-session-size=16384 store.file.max-global-session-size=512 store.file.file-write-buffer-cache-size=16384 store.file.flush-disk-mode=async store.file.session.reload.read_size=100 store.db.driver-class-name=com.mysql.jdbc.Driver store.db.datasource=druid store.db.db-type=mysql store.db.url=jdbc:mysql://localhost:3306/seata?useUnicode=true store.db.user=root store.db.password=123456 store.db.min-conn=1 store.db.max-conn=3 store.db.global.table=global_table store.db.branch.table=branch_table store.db.query-limit=100 store.db.lock-table=lock_table recovery.committing-retry-period=1000 recovery.asyn-committing-retry-period=1000 recovery.rollbacking-retry-period=1000 recovery.timeout-retry-period=1000 transaction.undo.data.validation=true transaction.undo.log.serialization=jackson transaction.undo.log.save.days=7 transaction.undo.log.delete.period=86400000 transaction.undo.log.table=undo_log transport.serialization=seata transport.compressor=none metrics.enabled=false metrics.registry-type=compact metrics.exporter-list=prometheus metrics.exporter-prometheus-port=9898 client.report.retry.count=5 service.disableGlobalTransaction=false client.support.spring.datasource.autoproxy=true
nacos做配置中心:如果配置放在nacos的非默认(非public)空间中 请设置seata.config.nacos.namespace的值为namespace的命名空间id 而不是namaspace的名称
using nacos as config center:If your seata configs are placed in a non-default space(non-public) please set the value of 'seata.config.nacos.namespace' as 'namespace id' NOT THE 'NAMESPACE NAME'
(seata 1.4.2) 将nacos上的相应配置的data-id由 service.vgroup_mapping.XXX 改为 service.vgroupMapping.XXX
应该是业务项目中的yml配置文件没有配置:seata.tx-service-group: xxxx
导致seata使用默认的规则: 获取事务分组(服务启动时加载配置) spring/springboot可配置在yml、properties中,对应值"my_test_tx_group"即为事务分组名,若不配置则默认以:spring.application.name值+"-seata-service-group"拼接后的字符串作为分组名
nacos做配置中心:如果配置放在nacos的非默认(非public)空间中 请设置seata.config.nacos.namespace的值为namespace的命名空间id 而不是namaspace的名称
using nacos as config center:If your seata configs are placed in a non-default space(non-public) please set the value of 'seata.config.nacos.namespace' as 'namespace id' NOT THE 'NAMESPACE NAME'
nacos 1.3.0 seata 1.4.2 采用nacos作为配置中心 同样的报错 解决办法: 方法1. 手动在nacos中seata对应的配置组中(默认SEATA_GROUP)增加配置项service.vgroupMapping., 内容为default, 不需要加配置文件后缀, 格式我选的txt,应该没影响 ; 其中是报错中出现的项, 按问题内容就是'account-service-fescar-service-group', 这一项我找了很久都没找到在哪配置, 猜测是seata自动将服务名称-seata服务名称-group自动拼接起来了 方法2. 用官方提供的shell脚本或者python脚本向nacos导入之前, 增加service.vgroupMapping.=default项, group-name和前面说的一样, 就是报错中出现的项, 脚本会自动把这些内容配置到nacos中; 服务很多或者需要部署到服务器上的时候建议采用
这两个结合在一起才是正确的,本地环境部署的namespace和namespaceId是一致的所以没问题,线上的namespace和namespaceId不一致
找到问题了,dataId必须是service.vgroupMapping+分组
有使用这种解决的吗?具体是怎么操作的?
文档说项目中的 yml
配置文件没有配置:seata.tx-service-group: xxxx
,配置了,还是同样的报错,后面我调式代码发现了需要配置 spring.cloud.alibaba.seata.tx-service-group:xxxx
属性。
具体可以参考以下文章:
seata-server 启动后,启动account-service报错。
https://github.com/seata/seata-samples/blob/master/springcloud-jpa-seata/account-service/src/main/resources/file.conf
把
改成
不再报错