# Seata实现分布式事务 **Repository Path**: sikecode/Seata ## Basic Information - **Project Name**: Seata实现分布式事务 - **Description**: Seate 实现分布式事务 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-05-08 - **Last Updated**: 2025-05-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Seata实现分布式事务 Seate版本 0.9 nacos版本 2.1 gitee:https://gitee.com/HelloWorldLHY/Seata # nacos配置中心新建配置文件 1.service-order-dev.yaml ```java server: port: 8084 spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql:///shop?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true username: root password: 123456 ``` 2.service-product-dev.yaml ```java server: port: 8081 spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql:///shop?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-order=default service-product与service-order均为微服务名称 初始化seata 的nacos配置 注意: 这里要保证nacos是已经正常运行的 cd conf nacos-config.sh 127.0.0.1 执行成功后可以打开Nacos的控制台,在配置列表中,可以看到初始化了很多Group为SEATA_GROUP 的配置。 ## 2.启动Seata服务 cd bin seata-server.bat -p 9000 -m file ## 3.初始化数据表 新建数据库shop 运行shop.sql ## 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" } }