1 分布式事务seata just do it by yourself, keep in mind.
https://github.com/seata/seata-samples/tree/master/springboot-dubbo-seata
2 部署结果
3 项目结构启动
4 测试结果:
// curl -H "Content-Type:application/json" -X POST -d '{"userId":"1","commodityCode":"C201901140001","name":"风 扇","count":2,"amount":"100"}' localhost:8104/business/dubbo/buy
// mysql 存储
// 回滚信息 瞬时状态
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