作者:提着变形金刚的Oceannk_737 | 来源:互联网 | 2023-02-01 11:49
项目集成背景springCloud-eureka-feign-mybatis-seata想更清楚的理解全局事务框架SeaTa,可以参考资料 https:www.jianshu.co
项目集成背景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版本)
博主的百度云盘有有存两个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
解压完成后我们得到了几个文件夹。
2.配置Seata Server
seata server
所有的配置都在conf
文件夹内,该文件夹内有两个文件我们必须要详细介绍下。
seata server
默认使用file
(文件方式)进行存储事务日志
、事务运行信息
,我们可以通过-m db
脚本参数的形式来指定,目前仅支持file
、db
这两种方式。
- 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
## 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