【分布式技术】--分布式事务Seata-2

1 分布式事务seata just do it by yourself, keep in mind.

https://github.com/seata/seata-samples/tree/master/springboot-dubbo-seata

0

0

0

2 部署结果

// http://172.16.208.224:8848/nacos/index.html#/serviceManagement?serverId=center&group=&dataId=&namespace=&pageSize=&pageNo=&appName=

0

3  项目结构启动

0

4 测试结果:

// curl -H "Content-Type:application/json" -X POST -d '{"userId":"1","commodityCode":"C201901140001","name":"风 扇","count":2,"amount":"100"}' localhost:8104/business/dubbo/buy

0

// mysql 存储

0

// 回滚信息 瞬时状态

0

5 小结:

// 注意事项

172.16.208.142作为seata server ; 172.16.208.137 作为mysql ; 172.16.208.224 作为注册中心; 192.168.12.76 部署多个分布式服务;

细节配置:

//seata server: file.conf #替换

172.16.208.142 ---> /root/seata-server/seata/bin #启动

sh seata-server.sh -p 8091 -h 127.0.0.1 -m file #启动

#only support when registry.type=file, please don't set multiple addresses #file.conf替换

default.grouplist = "172.16.208.142:8091"

// mysql : application.properties #替换

172.16.208.137

// nacos: 172.16.208.224 application.properties #替换

父pom替换版本

mysql

mysql-connector-java

runtime

8.0.11

//mysql connector for 8.0+

spring.datasource.url=jdbc:mysql://172.16.208.137:3306/seata?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页