From 6a90e643e663eee1f71748d6e65d9d95ccfccfab Mon Sep 17 00:00:00 2001 From: slievrly Date: Thu, 17 Oct 2019 17:13:57 +0800 Subject: [PATCH] update seata version and sample Signed-off-by: slievrly --- spring-cloud-alibaba-dependencies/pom.xml | 2 +- .../src/main/resources/file.conf | 21 ++++++++++++------- .../src/main/resources/registry.conf | 5 ++--- .../src/main/resources/file.conf | 21 ++++++++++++------- .../src/main/resources/registry.conf | 5 ++--- .../src/main/resources/file.conf | 21 ++++++++++++------- .../src/main/resources/registry.conf | 5 ++--- .../seata-example/readme-zh.md | 10 ++++++--- .../src/main/resources/file.conf | 21 ++++++++++++------- .../src/main/resources/registry.conf | 5 ++--- 10 files changed, 68 insertions(+), 48 deletions(-) diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml index 6af3af715..fbba7fd05 100644 --- a/spring-cloud-alibaba-dependencies/pom.xml +++ b/spring-cloud-alibaba-dependencies/pom.xml @@ -20,7 +20,7 @@ 1.6.3 3.1.0 - 0.7.1 + 0.9.0 1.1.1 0.8.0 1.0.9 diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf index d686eeec4..0777ae8a8 100644 --- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf +++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf @@ -4,7 +4,7 @@ transport { #NIO NATIVE server = "NIO" #enable heartbeat - heartbeat = true + heartbeat = false #thread factory for netty thread-factory { boss-thread-prefix = "NettyBoss" @@ -46,17 +46,22 @@ client { retry.times = 30 } report.retry.count = 5 + tm.commit.retry.count = 1 + tm.rollback.retry.count = 1 } transaction { undo.data.validation = true undo.log.serialization = "jackson" + undo.log.save.days = 7 + #schedule delete expired undo_log in milliseconds + undo.log.delete.period = 86400000 + undo.log.table = "undo_log" } -## metrics settings -metrics { - enabled = false - registry-type = "compact" - # multi exporters use comma divided - exporter-list = "prometheus" - exporter-prometheus-port = 9898 +support { + ## spring + spring { + # auto proxy the DataSource bean + datasource.autoproxy = false + } } \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf index 6dbeb22be..b98f5704a 100644 --- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf +++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf @@ -4,7 +4,7 @@ registry { nacos { serverAddr = "localhost" - namespace = "public" + namespace = "" cluster = "default" } eureka { @@ -50,8 +50,7 @@ config { nacos { serverAddr = "localhost" - namespace = "public" - cluster = "default" + namespace = "" } consul { serverAddr = "127.0.0.1:8500" diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf index b3047ec36..a6e431bcb 100644 --- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf +++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf @@ -4,7 +4,7 @@ transport { #NIO NATIVE server = "NIO" #enable heartbeat - heartbeat = true + heartbeat = false #thread factory for netty thread-factory { boss-thread-prefix = "NettyBoss" @@ -46,17 +46,22 @@ client { retry.times = 30 } report.retry.count = 5 + tm.commit.retry.count = 1 + tm.rollback.retry.count = 1 } transaction { undo.data.validation = true undo.log.serialization = "jackson" + undo.log.save.days = 7 + #schedule delete expired undo_log in milliseconds + undo.log.delete.period = 86400000 + undo.log.table = "undo_log" } -## metrics settings -metrics { - enabled = false - registry-type = "compact" - # multi exporters use comma divided - exporter-list = "prometheus" - exporter-prometheus-port = 9898 +support { + ## spring + spring { + # auto proxy the DataSource bean + datasource.autoproxy = false + } } \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf index 6dbeb22be..b98f5704a 100644 --- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf +++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf @@ -4,7 +4,7 @@ registry { nacos { serverAddr = "localhost" - namespace = "public" + namespace = "" cluster = "default" } eureka { @@ -50,8 +50,7 @@ config { nacos { serverAddr = "localhost" - namespace = "public" - cluster = "default" + namespace = "" } consul { serverAddr = "127.0.0.1:8500" diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf index 22184e044..89f553444 100644 --- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf +++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf @@ -4,7 +4,7 @@ transport { #NIO NATIVE server = "NIO" #enable heartbeat - heartbeat = true + heartbeat = false #thread factory for netty thread-factory { boss-thread-prefix = "NettyBoss" @@ -46,17 +46,22 @@ client { retry.times = 30 } report.retry.count = 5 + tm.commit.retry.count = 1 + tm.rollback.retry.count = 1 } transaction { undo.data.validation = true undo.log.serialization = "jackson" + undo.log.save.days = 7 + #schedule delete expired undo_log in milliseconds + undo.log.delete.period = 86400000 + undo.log.table = "undo_log" } -## metrics settings -metrics { - enabled = false - registry-type = "compact" - # multi exporters use comma divided - exporter-list = "prometheus" - exporter-prometheus-port = 9898 +support { + ## spring + spring { + # auto proxy the DataSource bean + datasource.autoproxy = false + } } \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf index 6dbeb22be..b98f5704a 100644 --- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf +++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf @@ -4,7 +4,7 @@ registry { nacos { serverAddr = "localhost" - namespace = "public" + namespace = "" cluster = "default" } eureka { @@ -50,8 +50,7 @@ config { nacos { serverAddr = "localhost" - namespace = "public" - cluster = "default" + namespace = "" } consul { serverAddr = "127.0.0.1:8500" diff --git a/spring-cloud-alibaba-examples/seata-example/readme-zh.md b/spring-cloud-alibaba-examples/seata-example/readme-zh.md index cc18b5595..2723de586 100644 --- a/spring-cloud-alibaba-examples/seata-example/readme-zh.md +++ b/spring-cloud-alibaba-examples/seata-example/readme-zh.md @@ -99,12 +99,16 @@ CREATE TABLE `account_tbl` ( 点击这个页面 [https://github.com/seata/seata/releases](https://github.com/seata/seata/releases),下载最新版本的 Seata Server 端. -进入解压之后的 bin 目录,执行如下命令来启动 +进入解压之后的 bin 目录,执行如下命令来启动, 所有启动参数为可选项。 ```$shell -sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db) +sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db) -h $HOST -e $ENV ``` - +-p seata-server 监听服务端口号 +-m 存储模式,可选值:file、db。file 用于单点模式,db用于ha模式,当使用db存储模式,需要修改配置中store配置节点的数据库配置,同时在数据库中初始化[global_table、branch_table和 +lock_table](https://github.com/seata/seata/blob/develop/server/src/main/resources/db_store.sql) +-h 用于解决seata-server和业务侧跨网络问题,其配置的host值直接显示到注册中心的服务可用地址host,当跨网络时这里需要配置为公网IP或NATIP,若都在同一局域网则无需配置 +-e 用于解决多环境配置中心隔离问题 在这个示例中,采用如下命令来启动 Seata Server ```$shell diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf index 930a65c0f..2915b99c3 100644 --- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf +++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf @@ -4,7 +4,7 @@ transport { #NIO NATIVE server = "NIO" #enable heartbeat - heartbeat = true + heartbeat = false #thread factory for netty thread-factory { boss-thread-prefix = "NettyBoss" @@ -46,17 +46,22 @@ client { retry.times = 30 } report.retry.count = 5 + tm.commit.retry.count = 1 + tm.rollback.retry.count = 1 } transaction { undo.data.validation = true undo.log.serialization = "jackson" + undo.log.save.days = 7 + #schedule delete expired undo_log in milliseconds + undo.log.delete.period = 86400000 + undo.log.table = "undo_log" } -## metrics settings -metrics { - enabled = false - registry-type = "compact" - # multi exporters use comma divided - exporter-list = "prometheus" - exporter-prometheus-port = 9898 +support { + ## spring + spring { + # auto proxy the DataSource bean + datasource.autoproxy = false + } } \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf index 6dbeb22be..b98f5704a 100644 --- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf +++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf @@ -4,7 +4,7 @@ registry { nacos { serverAddr = "localhost" - namespace = "public" + namespace = "" cluster = "default" } eureka { @@ -50,8 +50,7 @@ config { nacos { serverAddr = "localhost" - namespace = "public" - cluster = "default" + namespace = "" } consul { serverAddr = "127.0.0.1:8500"