Seata实现分布式事务

Seata实现分布式事务

Seate版本 0.9 window版

链接:https://pan.baidu.com/s/10LciCPIykjmLfKGPXlomZw
提取码:aspu

nacos版本 1.2.1 window版

链接:https://pan.baidu.com/s/1tJDgBQ2_S19VweJ9DDp0KQ
提取码:8848

访问路径 localhost:8848

gitee:https://gitee.com/HelloWorldLHY/seata-demo.git

github:

nacos配置中心新建配置文件

1.service-order-dev.yaml

server:
  port: 8082
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql:///moni?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
    username: root
    password: 123456

1.初始化Seata在nacos的配置

修改seata\conf\nacos-config.txt 内容

service.vgroup_mapping.service-product=default
service.vgroup_mapping.service-storage=default
service.vgroup_mapping.service-account=default

service-product,service-account与service-storage均为微服务名称

初始化seata 的nacos配置
注意: 这里要保证nacos是已经正常运行的

cd conf
nacos-config.sh 127.0.0.1

执行成功后可以打开Nacos的控制台,在配置列表中,可以看到初始化了很多Group为SEATA_GROUP 的配置。

如果在nacos 中存在service.vgroup_mapping.service-storage 等配置

说明配置生效

2.启动Seata服务

cd bin
seata-server.bat -p 9000 -m file

3.初始化数据表

新建数据库moni
运行moni.sql

注意:undo_log表 为分布式事务seata所用表 基于此表实现回滚

4.在resources下添加Seata的配置文件 registry.conf

registry {
      type = "nacos"
      nacos {
          serverAddr = "localhost"
          namespace = "public"
          cluster = "default"
      }
}
config {
      type = "nacos"
      nacos {
           serverAddr = "localhost"
           namespace = "public"
           cluster = "default"
     }
}
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值