SpringCloud基础框架搭建–4 seata

这是系列搭建springcloud基础框架的文章,内容包括集成shiro、Mysql主从、seata、activiti、drools、hadoop大数据常用组件、keepalive+nginx https配置等;

参考: https://blog.csdn.net/tianzhonghaoqing/article/details/125837441
1) Please install or use the JRE or JDK that contains these missing component
jdk32位,需要将 program files/java/jdkxxx/bin/server 目录 ,拷贝到 ../java/jrexxxxx/bin 下
2) Could not reserve enough space for 2097152KB object heap
需要安装 jdk 64
1.maven

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
    <exclusions>
        <exclusion>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>io.seata</groupId>
    <artifactId>seata-spring-boot-starter</artifactId>
    <version>1.3.0</version>
    <exclusions>
        <exclusion>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
        </exclusion>
    </exclusions>
</dependency>

2. 运行启动 seata-server-1.4.1 使用 nacos 配 置;
registry.conf

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

  nacos {
    application = "seata-server"
    serverAddr = "127.0.0.1:8848"
    group = "SEATA_GROUP"
    namespace = ""
    cluster = "default"
    username = ""
    password = ""
  }
}

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

  nacos {
    serverAddr = "127.0.0.1:8848"
    namespace = ""
    group = "SEATA_GROUP"
    username = ""
    password = ""
    dataId = "seata-server.yml"
  }
}

seata-server.yml 配置;
group: SEATA_GROUP

store:
  mode: db
  db:
    datasource: druid
    dbType: mysql
    driverClassName: com.mysql.jdbc.Driver
    url:jdbc: mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
    user: root
    password: 123
    minConn: 5
    maxConn: 30
    globalTable: global_table
    branchTable: branch_table
    queryLimit: 100
    lockTable: lock_table
    maxWait: 5000
server:
  recovery:
    committingRetryPeriod: 1000
    asynCommittingRetryPeriod: 1000
    rollbackingRetryPeriod: 1000
    timeoutRetryPeriod: 1000
  maxCommitRetryTimeout: -1
  maxRollbackRetryTimeout: -1
  rollbackRetryTimeoutUnlockEnable: false
  undo:
    logSaveDays: 7
    logDeletePeriod: 86400000
transport:
  serialization: seata
  compressor: none
metrics:
  enabled: false
  registryType: compact
  exporterList: prometheus
  exporterPrometheusPort: 9898
application-dev.yml 中的 seata配置 
spring:
  cloud:
    alibaba:
      seata: 
        tx-service-group: my_test_tx_group


seata:
  enabled: true
  application-id: chen-seata-test
  tx-service-group: my_test_tx_group
  config:
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8848
      group: SEATA_GROUP
      username: nacos
      password: nacos
      namespace: 
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      namespace: 
      group: SEATA_GROUP
      username: nacos
      password: nacos
  service:
    vgroup-mapping:
      my_test_tx_group: default

my_test_tx_group 默认集群配置
nacos:
data id: service.vgroupMapping.my_test_tx_group
group: SEATA_GROUP
值 :default
/////////////////////////////////////////////////////////////////////////
主访问入口;

@RestController
@RequestMapping(value = "/seata")
public class SeataController {

    @Autowired
    private TestService testService;

    @PostMapping(value = "/testSeata")
    public ResultData testSeata() {
        testService.testSeata();
        return new ResultData(ResultStatus.SUCCESS, "ok");
    }
}

TestServiceImpl

@Override
@GlobalTransactional
public void testSeata() {
    iTestService.seataTest();
    iOdrTestService.seataTest();
}

iTestService与iOdrTestService为feign

@FeignClient(value = "chen-order-biz")
public interface IOdrTestService {

    @PostMapping(value = "/seata/seataTest")
    ResultData seataTest();
}

@FeignClient(value = "chen-test-biz")
public interface ITestService {

    @PostMapping(value = "/seata/seataTest")
    ResultData seataTest();
}

chen-order-biz

@RestController
@RequestMapping(value = "/seata")
public class SeataController {

    @Autowired
    private OdrTable1Service odrTable1Service;

    @PostMapping(value = "/seataTest")
    public ResultData seataTest() {
        OdrTable1 odrTable1 = new OdrTable1();
        odrTable1.setUserName("order_" + System.currentTimeMillis());

        odrTable1Service.insert(odrTable1);

        if (true) {
            int result = 3/0;
        }
        return new ResultData(ResultStatus.SUCCESS, "ok");
    }
}

chen-test-biz

@RestController
@RequestMapping(value = "/seata")
public class SeataController {

    @Autowired
    private TsTable1Service tsTable1Service;

    @PostMapping(value = "/seataTest")
    public ResultData seataTest() {

        TsTable1 tsTable1 = new TsTable1();
        tsTable1.setUserName("user_" + System.currentTimeMillis());
        tsTable1Service.insert(tsTable1);
        return new ResultData(ResultStatus.SUCCESS, "ok");
    }
}

运行相关日志 :
通过postman,执行 [post] http://localhost:8033/seata/testSeata
chen-manager-biz 日志:

TransactionManager Singleton io.seata.tm.DefaultTransactionManager@a3bb33c
2023-05-05 03:31:39.537  INFO 6108 --- [nio-8033-exec-2] i.seata.tm.api.DefaultGlobalTransaction  : Begin new global transaction [192.168.1.101:8091:2126087229109981194]
2023-05-05 03:31:41.385  INFO 6108 --- [nio-8033-exec-2] i.seata.tm.api.DefaultGlobalTransaction  : Suspending current transaction, xid = 192.168.1.101:8091:2126087229109981194
2023-05-05 03:31:41.462  INFO 6108 --- [nio-8033-exec-2] i.seata.tm.api.DefaultGlobalTransaction  : [192.168.1.101:8091:2126087229109981194] rollback status: Rollbacked
2023-05-05 03:31:41.515  WARN 6108 --- [nio-8033-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [feign.FeignException$InternalServerError: [500] during [POST] to [http://chen-order-biz/seata/seataTest] [IOdrTestService#seataTest()]: [{"timestamp":"2023-05-04T19:31:40.585+00:00","status":500,"error":"Internal Server Error","trace":"java.lang.ArithmeticException: / by zero\n\tat com.chen.biz.order.controller.SeataController.seataTes... (5719 bytes)]]
2023-05-05 03:53:16.650  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:03:23.543  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:13:35.594  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:23:41.850  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:33:49.545  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:43:56.545  INFO 6108 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default

chen-test-biz:

Rule Type: master-slave
2023-05-05 03:31:40.007  INFO 5716 --- [nio-8022-exec-2] ShardingSphere-SQL                       : SQL: INSERT INTO T_TS_TABLE1  ( ID,USER_NAME ) VALUES( ?,? ) ::: DataSources: master
2023-05-05 03:31:40.090  INFO 5716 --- [nio-8022-exec-2] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.090  INFO 5716 --- [nio-8022-exec-2] ShardingSphere-SQL                       : SQL: SELECT ID, USER_NAME FROM T_TS_TABLE1 WHERE (id) in ( (?) ) ::: DataSources: master
2023-05-05 03:31:40.122  INFO 5716 --- [nio-8022-exec-2] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.122  INFO 5716 --- [nio-8022-exec-2] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:41.105  INFO 5716 --- [ch_RMROLE_1_2_8] i.s.c.r.p.c.RmBranchRollbackProcessor    : rm handle branch rollback process:xid=192.168.1.101:8091:2126087229109981194,branchId=2126087229109981195,branchType=AT,resourceId=jdbc:mysql://localhost:3306/chen,applicationData=null
2023-05-05 03:31:41.107  INFO 5716 --- [ch_RMROLE_1_2_8] io.seata.rm.AbstractRMHandler            : Branch Rollbacking: 192.168.1.101:8091:2126087229109981194 2126087229109981195 jdbc:mysql://localhost:3306/chen
2023-05-05 03:31:41.108  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:41.108  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:41.229  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:41.229  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : SQL: SELECT * FROM T_TS_TABLE1 WHERE (id) in ( (?) ) FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:41.243  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:41.243  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : SQL: DELETE FROM T_TS_TABLE1 WHERE id = ?   ::: DataSources: master
2023-05-05 03:31:41.275  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:41.278  INFO 5716 --- [ch_RMROLE_1_2_8] ShardingSphere-SQL                       : SQL: DELETE FROM undo_log WHERE branch_id = ? AND xid = ? ::: DataSources: master
2023-05-05 03:31:41.361  INFO 5716 --- [ch_RMROLE_1_2_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981195, undo_log deleted with GlobalFinished
2023-05-05 03:31:41.371  INFO 5716 --- [ch_RMROLE_1_2_8] io.seata.rm.AbstractRMHandler

chen-order-biz:

2023-05-05 03:31:31.536  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : SQL: SELECT * FROM t_odr_table1 LIMIT 1 ::: DataSources: slave0
2023-05-05 03:31:40.405  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.405  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : SQL: INSERT INTO T_ODR_TABLE1  ( ID,USER_NAME ) VALUES( ?,? ) ::: DataSources: master
2023-05-05 03:31:40.475  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.475  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : SQL: SELECT ID, USER_NAME FROM T_ODR_TABLE1 WHERE (id) in ( (?) ) ::: DataSources: master
2023-05-05 03:31:40.506  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.507  INFO 5845 --- [nio-8044-exec-4] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:40.580 ERROR 5845 --- [nio-8044-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ArithmeticException: / by zero] with root cause

java.lang.ArithmeticException: / by zero
    at com.chen.biz.order.controller.SeataController.seataTest(SeataController.java:27) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.23.jar:5.3.23]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:696) ~[tomcat-embed-core-9.0.68.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.23.jar:5.3.23]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.68.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at com.chen.frame.common.http.CorsFilter.doFilter(CorsFilter.java:25) ~[classes/:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.23.jar:5.3.23]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.23.jar:5.3.23]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.23.jar:5.3.23]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.23.jar:5.3.23]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96) ~[spring-boot-actuator-2.6.13.jar:2.6.13]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.23.jar:5.3.23]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.23.jar:5.3.23]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.23.jar:5.3.23]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.68.jar:9.0.68]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]

2023-05-05 03:31:40.649  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.c.r.p.c.RmBranchRollbackProcessor    : rm handle branch rollback process:xid=192.168.1.101:8091:2126087229109981194,branchId=2126087229109981196,branchType=AT,resourceId=jdbc:mysql://localhost:3306/chen,applicationData=null
2023-05-05 03:31:40.649  INFO 5845 --- [ch_RMROLE_1_3_8] io.seata.rm.AbstractRMHandler            : Branch Rollbacking: 192.168.1.101:8091:2126087229109981194 2126087229109981196 jdbc:mysql://localhost:3306/chen
2023-05-05 03:31:40.650  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.650  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.657  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.658  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:40.691  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981196, undo_log inserted, retry rollback
2023-05-05 03:31:40.728  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.728  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.744  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.744  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:40.776  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981196, undo_log inserted, retry rollback
2023-05-05 03:31:40.824  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.824  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.830  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.831  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:40.841  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981196, undo_log inserted, retry rollback
2023-05-05 03:31:40.872  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.873  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.892  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.892  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: DataSources: master
2023-05-05 03:31:40.928  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981196, undo_log inserted, retry rollback
2023-05-05 03:31:40.953  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.953  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.968  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.969  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: SELECT * FROM T_ODR_TABLE1 WHERE (id) in ( (?) ) FOR UPDATE ::: DataSources: slave0
2023-05-05 03:31:40.982  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:40.982  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: DELETE FROM T_ODR_TABLE1 WHERE id = ?   ::: DataSources: master
2023-05-05 03:31:41.054  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:31:41.055  INFO 5845 --- [ch_RMROLE_1_3_8] ShardingSphere-SQL                       : SQL: DELETE FROM undo_log WHERE branch_id = ? AND xid = ? ::: DataSources: master
2023-05-05 03:31:41.080  INFO 5845 --- [ch_RMROLE_1_3_8] i.s.r.d.undo.AbstractUndoLogManager      : xid 192.168.1.101:8091:2126087229109981194 branch 2126087229109981196, undo_log deleted with GlobalFinished
2023-05-05 03:31:41.097  INFO 5845 --- [ch_RMROLE_1_3_8] io.seata.rm.AbstractRMHandler            : Branch Rollbacked result: PhaseTwo_Rollbacked
2023-05-05 03:32:31.540  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:32:31.541  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : SQL: SELECT * FROM t_odr_table1 LIMIT 1 ::: DataSources: slave0
2023-05-05 03:33:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:33:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : SQL: SELECT * FROM t_odr_table1 LIMIT 1 ::: DataSources: slave0
2023-05-05 03:34:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:34:31.538  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : SQL: SELECT * FROM t_odr_table1 LIMIT 1 ::: DataSources: slave0
2023-05-05 03:35:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : Rule Type: master-slave
2023-05-05 03:35:31.537  INFO 5845 --- [MetaChecker_1_1] ShardingSphere-SQL                       : SQL: SELECT * FROM t_odr_table1 LIMIT 1 ::: DataSources: slave0
2023-05-05 03:53:16.661  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:03:23.543  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:13:35.588  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:23:41.854  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:33:49.545  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default
2023-05-05 04:43:56.541  INFO 5845 --- [ncesChangeEvent] i.s.d.r.nacos.NacosRegistryServiceImpl   : receive empty server list,cluster:default

关键配置:nacos添加如下配置

my_test_tx_group 默认集群配置 
nacos:
data id: service.vgroupMapping.my_test_tx_group
group: SEATA_GROUP
值 :default

undo表:

CREATE TABLE `undo_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int(11) NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  `ext` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

nacos 配置:
DATA ID:service.vgroupMapping.my_test_tx_group
Group: SEATA_GROUP
配置格式: text
配置内容: default

欢迎您的到来,感谢您的支持!

为您推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注