当前位置:   article > 正文

seata的使用(SpringBoot项目整合seata)_seata console ui

seata console ui

1、解压 seata-server-1.7.1.zip

在这里插入图片描述

2、启动 双击 seata-server.bat

在这里插入图片描述

Active code page: 65001
"E:\seata-server-1.7.1\seata/logs"
"apm-skywalking not enabled"
[0.042s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:E:\seata-server-1.7.1\seata/logs/seata_gc.log instead.
[0.048s][info   ][gc] Using G1
[2.012s][info   ][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 7.485ms
███████╗███████╗ █████╗ ████████╗ █████╗
██╔════╝██╔════╝██╔══██╗╚══██╔══╝██╔══██╗
███████╗█████╗  ███████║   ██║   ███████║
╚════██║██╔══╝  ██╔══██║   ██║   ██╔══██║
███████║███████╗██║  ██║   ██║   ██║  ██║
╚══════╝╚══════╝╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝


19:02:02.543  INFO --- [                     main] [ta.config.ConfigurationFactory] [                load]  [] : load Configuration from :Spring Configuration
19:02:02.579  INFO --- [                     main] [ta.config.ConfigurationFactory] [  buildConfiguration]  [] : load Configuration from :Spring Configuration
19:02:02.607  INFO --- [                     main] [seata.server.ServerApplication] [         logStarting]  [] : Starting ServerApplication v1.7.1 using Java 17 on DESKTOP-JRQ5NMD with PID 18200 (E:\seata-server-1.7.1\seata\target\seata-server.jar started by dgq in E:\seata-server-1.7.1\seata\bin)
19:02:02.608  INFO --- [                     main] [seata.server.ServerApplication] [ogStartupProfileInfo]  [] : No active profile set, falling back to 1 default profile: "default"
[2.735s][info   ][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->15M(2048M) 7.046ms
[3.947s][info   ][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 125M->18M(2048M) 5.283ms
19:02:04.685  INFO --- [                     main] [mbedded.tomcat.TomcatWebServer] [          initialize]  [] : Tomcat initialized with port(s): 7091 (http)
19:02:04.698  INFO --- [                     main] [oyote.http11.Http11NioProtocol] [                 log]  [] : Initializing ProtocolHandler ["http-nio-7091"]
19:02:04.698  INFO --- [                     main] [.catalina.core.StandardService] [                 log]  [] : Starting service [Tomcat]
19:02:04.700  INFO --- [                     main] [e.catalina.core.StandardEngine] [                 log]  [] : Starting Servlet engine: [Apache Tomcat/9.0.62]
19:02:04.797  INFO --- [                     main] [rBase.[Tomcat].[localhost].[/]] [                 log]  [] : Initializing Spring embedded WebApplicationContext
19:02:04.797  INFO --- [                     main] [letWebServerApplicationContext] [ebApplicationContext]  [] : Root WebApplicationContext: initialization completed in 2129 ms
19:02:05.445  INFO --- [                     main] [vlet.WelcomePageHandlerMapping] [              <init>]  [] : Adding welcome page: class path resource [static/index.html]
19:02:05.745  INFO --- [                     main] [oyote.http11.Http11NioProtocol] [                 log]  [] : Starting ProtocolHandler ["http-nio-7091"]
19:02:05.782  INFO --- [                     main] [mbedded.tomcat.TomcatWebServer] [               start]  [] : Tomcat started on port(s): 7091 (http) with context path ''
19:02:05.797  INFO --- [                     main] [seata.server.ServerApplication] [          logStarted]  [] : Started ServerApplication in 4.46 seconds (JVM running for 5.421)
19:02:06.087  INFO --- [                     main] [a.server.session.SessionHolder] [                init]  [] : use session store mode: file
19:02:06.103  INFO --- [                     main] [rver.lock.LockerManagerFactory] [                init]  [] : use lock store mode: file
19:02:06.289  INFO --- [                     main] [rpc.netty.NettyServerBootstrap] [               start]  [] : Server started, service listen port: 8091
19:02:06.303  INFO --- [                     main] [io.seata.server.ServerRunner  ] [                 run]  [] :
 you can visit seata console UI on http://127.0.0.1:7091.
 log path: C:\Users\dgq/logs/seata.
19:02:06.303  INFO --- [                     main] [io.seata.server.ServerRunner  ] [                 run]  [] : seata server started in 503 millSeconds

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

在这里插入图片描述

3、启动 seata 控制台用户界面

you can visit seata console UI on http://127.0.0.1:7091

在这里插入图片描述
在这里插入图片描述

4、所有分布式事务相关数据库要有undo-log

seata快速开始:https://seata.apache.org/zh-cn/docs/user/quickstart/
在这里插入图片描述
在这里插入图片描述

CREATE TABLE IF NOT EXISTS `undo_log`
(
    `branch_id`     BIGINT       NOT NULL COMMENT 'branch transaction id',
    `xid`           VARCHAR(128) NOT NULL COMMENT 'global transaction id',
    `context`       VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
    `rollback_info` LONGBLOB     NOT NULL COMMENT 'rollback info',
    `log_status`    INT(11)      NOT NULL COMMENT '0:normal status,1:defense status',
    `log_created`   DATETIME(6)  NOT NULL COMMENT 'create datetime',
    `log_modified`  DATETIME(6)  NOT NULL COMMENT 'modify datetime',
    UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT transaction mode undo table';
ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`);

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

在这里插入图片描述

5、项目引入seata依赖

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
        </dependency>
        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
        </dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

在这里插入图片描述

6、项目添加seata配置

seata: 
  tx-service-group: guli_tx_group
  service:
    vgroup-mapping:
      guli_tx_group: default
    grouplist:
      default: localhost:8091
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

在这里插入图片描述

7、代码实现:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/1007830
推荐阅读
相关标签
  

闽ICP备14008679号