Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
程序猿小郑
microservices-platform
提交
b1fc258a
microservices-platform
项目概览
程序猿小郑
/
microservices-platform
与 Fork 源项目一致
Fork自
zlt2000 / microservices-platform
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
microservices-platform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1fc258a
编写于
7月 20, 2020
作者:
zlt2000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新seata-demo的代码,适配seata1.3
上级
9c53c5ee
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
163 addition
and
134 deletion
+163
-134
zlt-demo/seata-demo/README.md
zlt-demo/seata-demo/README.md
+60
-1
zlt-demo/seata-demo/account-service/src/main/resources/application.yml
...a-demo/account-service/src/main/resources/application.yml
+17
-5
zlt-demo/seata-demo/account-service/src/main/resources/bootstrap.yml
...ata-demo/account-service/src/main/resources/bootstrap.yml
+5
-2
zlt-demo/seata-demo/account-service/src/main/resources/registry.conf
...ata-demo/account-service/src/main/resources/registry.conf
+0
-26
zlt-demo/seata-demo/business-service/src/main/resources/application.yml
...-demo/business-service/src/main/resources/application.yml
+16
-6
zlt-demo/seata-demo/business-service/src/main/resources/bootstrap.yml
...ta-demo/business-service/src/main/resources/bootstrap.yml
+10
-2
zlt-demo/seata-demo/business-service/src/main/resources/registry.conf
...ta-demo/business-service/src/main/resources/registry.conf
+0
-26
zlt-demo/seata-demo/order-service/src/main/resources/application.yml
...ata-demo/order-service/src/main/resources/application.yml
+17
-5
zlt-demo/seata-demo/order-service/src/main/resources/bootstrap.yml
...seata-demo/order-service/src/main/resources/bootstrap.yml
+5
-2
zlt-demo/seata-demo/order-service/src/main/resources/registry.conf
...seata-demo/order-service/src/main/resources/registry.conf
+0
-26
zlt-demo/seata-demo/pom.xml
zlt-demo/seata-demo/pom.xml
+11
-0
zlt-demo/seata-demo/storage-service/src/main/resources/application.yml
...a-demo/storage-service/src/main/resources/application.yml
+17
-5
zlt-demo/seata-demo/storage-service/src/main/resources/bootstrap.yml
...ata-demo/storage-service/src/main/resources/bootstrap.yml
+5
-2
zlt-demo/seata-demo/storage-service/src/main/resources/registry.conf
...ata-demo/storage-service/src/main/resources/registry.conf
+0
-26
未找到文件。
zlt-demo/seata-demo/README.md
浏览文件 @
b1fc258a
## **详细的原理和部署细节请查看**
[
Spring Cloud同步场景分布式事务怎样做?试试Seata
](
https://mp.weixin.qq.com/s/0yCmHzlXDC9BkbUuEt0_fQ
)
## 测试环境
*
mysql 5.7
*
seata 1.3
*
nacos 1.3
> **注意**:如果nacos使用低于1.3的版本不需要配置username和password;如果使用1.3以上版本必需开启 `nacos.core.auth.enabled=true` 并且配置username和password,否则读取不到seata-server
## 配置中心的配置如下
**config.txt**
```
properties
service.vgroupMapping.test_tx_service_group
=
default
store.mode
=
db
store.db.datasource
=
druid
store.db.dbType
=
mysql
store.db.url
=
jdbc:mysql://192.168.28.130:3306/seata?useUnicode=true
store.db.driverClassName
=
com.mysql.jdbc.Driver
store.db.user
=
root
store.db.password
=
root
store.db.minConn
=
5
store.db.maxConn
=
30
store.db.globalTable
=
global_table
store.db.branchTable
=
branch_table
store.db.queryLimit
=
100
store.db.lockTable
=
lock_table
store.db.maxWait
=
5000
```
>根据自己的环境修改 url、user、password 配置值
## 说明
## seata的配置如下
**registry.conf**
```
json
registry
{
#
file
、nacos
、eureka、redis、zk、consul、etcd
3
、sofa
type
=
"nacos"
nacos
{
application
=
"seata-server"
serverAddr
=
"192.168.28.130:8848"
group
=
"SEATA_GROUP"
namespace
=
""
cluster
=
"default"
username
=
"nacos"
password
=
"nacos"
}
}
config
{
#
file、nacos
、apollo、zk、consul、etcd
3
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130:8848"
namespace
=
""
group
=
"SEATA_GROUP"
username
=
"nacos"
password
=
"nacos"
}
}
```
## 说明
**包括以下5个模块,分别是**
*
`business-service`
:业务服务
...
...
zlt-demo/seata-demo/account-service/src/main/resources/application.yml
浏览文件 @
b1fc258a
...
...
@@ -4,8 +4,20 @@ spring:
username
:
root
password
:
1q2w3e4r
driver-class-name
:
com.mysql.cj.jdbc.Driver
cloud
:
alibaba
:
seata
:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应,默认是${spring.application.name}-fescar-service-group
tx-service-group
:
account-service-group
\ No newline at end of file
seata
:
tx-service-group
:
test_tx_service_group
config
:
type
:
nacos
nacos
:
serverAddr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
registry
:
type
:
nacos
nacos
:
server-addr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/account-service/src/main/resources/bootstrap.yml
浏览文件 @
b1fc258a
...
...
@@ -4,7 +4,10 @@ server:
spring
:
application
:
name
:
account-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
nacos
:
discovery
:
server-addr
:
192.168.28.130:8848
\ No newline at end of file
server-addr
:
192.168.28.130:8848
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/account-service/src/main/resources/registry.conf
已删除
100644 → 0
浏览文件 @
9c53c5ee
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
zlt-demo/seata-demo/business-service/src/main/resources/application.yml
浏览文件 @
b1fc258a
spring
:
cloud
:
alibaba
:
seata
:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应,默认是${spring.application.name}-fescar-service-group
tx-service-group
:
business-service-group
\ No newline at end of file
seata
:
tx-service-group
:
test_tx_service_group
config
:
type
:
nacos
nacos
:
serverAddr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
registry
:
type
:
nacos
nacos
:
server-addr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/business-service/src/main/resources/bootstrap.yml
浏览文件 @
b1fc258a
...
...
@@ -4,7 +4,15 @@ server:
spring
:
application
:
name
:
business-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
nacos
:
discovery
:
server-addr
:
192.168.28.130:8848
\ No newline at end of file
server-addr
:
192.168.28.130:8848
username
:
nacos
password
:
nacos
ribbon
:
ConnectTimeout
:
100000
ReadTimeout
:
1000000
OkToRetryOnAllOperations
:
false
\ No newline at end of file
zlt-demo/seata-demo/business-service/src/main/resources/registry.conf
已删除
100644 → 0
浏览文件 @
9c53c5ee
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
zlt-demo/seata-demo/order-service/src/main/resources/application.yml
浏览文件 @
b1fc258a
...
...
@@ -4,8 +4,20 @@ spring:
username
:
root
password
:
1q2w3e4r
driver-class-name
:
com.mysql.cj.jdbc.Driver
cloud
:
alibaba
:
seata
:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应,默认是${spring.application.name}-fescar-service-group
tx-service-group
:
order-service-group
\ No newline at end of file
seata
:
tx-service-group
:
test_tx_service_group
config
:
type
:
nacos
nacos
:
serverAddr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
registry
:
type
:
nacos
nacos
:
server-addr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/order-service/src/main/resources/bootstrap.yml
浏览文件 @
b1fc258a
...
...
@@ -4,7 +4,10 @@ server:
spring
:
application
:
name
:
order-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
nacos
:
discovery
:
server-addr
:
192.168.28.130:8848
\ No newline at end of file
server-addr
:
192.168.28.130:8848
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/order-service/src/main/resources/registry.conf
已删除
100644 → 0
浏览文件 @
9c53c5ee
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
zlt-demo/seata-demo/pom.xml
浏览文件 @
b1fc258a
...
...
@@ -9,6 +9,17 @@
<artifactId>
seata-demo
</artifactId>
<description>
seata分布式事务demo
</description>
<packaging>
pom
</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
io.seata
</groupId>
<artifactId>
seata-spring-boot-starter
</artifactId>
<version>
1.3.0
</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<!-- 业务服务(TM) -->
<module>
business-service
</module>
...
...
zlt-demo/seata-demo/storage-service/src/main/resources/application.yml
浏览文件 @
b1fc258a
...
...
@@ -4,8 +4,20 @@ spring:
username
:
root
password
:
1q2w3e4r
driver-class-name
:
com.mysql.cj.jdbc.Driver
cloud
:
alibaba
:
seata
:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应,默认是${spring.application.name}-fescar-service-group
tx-service-group
:
storage-service-group
\ No newline at end of file
seata
:
tx-service-group
:
test_tx_service_group
config
:
type
:
nacos
nacos
:
serverAddr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
registry
:
type
:
nacos
nacos
:
server-addr
:
${spring.cloud.nacos.server-addr}
group
:
SEATA_GROUP
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/storage-service/src/main/resources/bootstrap.yml
浏览文件 @
b1fc258a
...
...
@@ -4,7 +4,10 @@ server:
spring
:
application
:
name
:
storage-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
nacos
:
discovery
:
server-addr
:
192.168.28.130:8848
\ No newline at end of file
server-addr
:
192.168.28.130:8848
username
:
nacos
password
:
nacos
\ No newline at end of file
zlt-demo/seata-demo/storage-service/src/main/resources/registry.conf
已删除
100644 → 0
浏览文件 @
9c53c5ee
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"192.168.28.130"
namespace
=
"public"
cluster
=
"default"
}
file
{
name
=
"file.conf"
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录