项目集成背景springCloud-eureka-feign-mybatis-seata

想更清楚的理解全局事务框架SeaTa,可以参考资料 https://www.jianshu.com/p/044e95223a17,我认为介绍的很详细,下面来搭建集成并测试结果 参考:https://segmentfault.com/a/1190000020639849

一、安装部署Seata Server

Seata目前在github托管开源源代码,源码地址:https://github.com/seata/seata

1.下载Seata Server

很多博客中文章中都给出了下载地址:Seata Server最新版本下载     https://github.com/seata/seata/releases/tag/v1.2.0  两个安装包,.zip支持Windows;  .tar.gz支持Linux(这里下载的是1.2.0版本)

分布式事务处理----seata

 博主的百度云盘有有存两个1.2.0版本的安装包,可以直接下载:

seata-server-1.2.0.zip

链接:https://pan.baidu.com/s/11UudlHOorckhXgNwv1GsuA
提取码:g38r

seata-server-1.2.0.tar.gz

链接:https://pan.baidu.com/s/1gh5ogjph7wP6NfCFw2Vqvw
提取码:t4ik

 Linux系统下我们通过命令  tar -xvf 来解压tar.gz压缩文件:

tar -xvf seata-server-1.2.0.tar.gz

分布式事务处理----seata

 

 

解压完成后我们得到了几个文件夹。

  • bin

    存放各个系统的seata server启动脚本

  • conf

    存在seata server启动时所需要的配置信息、数据库模式下所需要的建表语句

  • lib

    运行seata server所需要的依赖包列表

2.配置Seata Server

seata server所有的配置都在conf文件夹内,该文件夹内有两个文件我们必须要详细介绍下。

seata server默认使用file(文件方式)进行存储事务日志事务运行信息,我们可以通过-m db脚本参数的形式来指定,目前仅支持filedb这两种方式。

  • file.conf

    该文件用于配置存储方式透传事务信息的NIO等信息,默认对应registry.conf文件内的file方式配置。

  • registry.conf

    seata server核心配置文件,可以通过该文件配置服务注册方式配置读取方式

    注册方式目前支持file 、nacos 、eureka、redis、zk、consul、etcd3、sofa等方式,默认为file,对应读取file.co读取配置信息的方式支持file、nacos 、apollo、zk、consul、etcd3等方式,默认为file,对应读取file.conf## transaction log store, only used in seata-server

file.conf

 

分布式事务处理----seata
## transaction log store, only used in seata-server
store {
  ## store mode: file、db
  mode = "file"

  ## file store property
  file {
    ## store location dir
    dir = "sessionStore"
    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
    maxBranchSessionSize = 16384
    # globe session size , if exceeded throws exceptions
    maxGlobalSessionSize = 512
    # file buffer size , if exceeded allocate new buffer
    fileWriteBufferCacheSize = 16384
    # when recover batch read size
    sessionReloadReadSize = 100
    # async, sync
    flushDiskMode = async
  }

  ## database store property
  db {
    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
    datasource = "druid"
    ## mysql/oracle/postgresql/h2/oceanbase etc.
    dbType = "mysql"
    driverClassName = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://127.0.0.1:3306/seata"
    user = "mysql"
    password = "mysql"
    minConn = 5
    maxConn = 30
    globalTable = "global_table"
    branchTable = "branch_table"
    lockTable = "lock_table"
    queryLimit = 100
    maxWait = 5000
  }
}
View Code

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-04-16
  • 2021-10-08
  • 2021-11-23
猜你喜欢
  • 2021-09-27
  • 2021-07-03
  • 2021-12-05
  • 2021-06-13
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案