Seata分布式事务管理

时间:2021-5-25 作者:qvyue

Seata 是一款开源的分布式事务解决方案,致力于在微服务架构下提供高性能和简单易用的分布式事务服务

1.下载 :http://seata.io/zh-cn/blog/download.html

Seata分布式事务管理

2.修改配置

1.file.conf 自定义事务组名称,事务日志存储模式改为db,数据库连接信息

1.自定义事务组名称
service {
  #vgroup->rgroup
  vgroup_mapping.my_test_tx_group = "my_tx_group"
  #only support single node
  default.grouplist = "127.0.0.1:8091"
  #degrade current not support
  enableDegrade = false
  #disable
  disable = false
  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
  max.commit.retry.timeout = "-1"
  max.rollback.retry.timeout = "-1"
}
## 2.store mode: file、db、redis
  mode = "db"
## 3.database store property
  db {
    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) 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 = "root"
    password = "1234"
    minConn = 5
    maxConn = 30
    globalTable = "global_table"
    branchTable = "branch_table"
    lockTable = "lock_table"
    queryLimit = 100
    maxWait = 5000
  }

2.创建名为seata的数据库并执行seata自带的db_store.sql

Seata分布式事务管理

3.修改registry.conf

# 1.file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"

  nacos {
    #2.
    serverAddr = "127.0.0.1:8848"
    namespace = ""
    cluster = "default"
  }

3.启动:先启动nacos,再启动seata

Seata分布式事务管理
声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:qvyue@qq.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。