From b0db648f93dccc99bef61786784a7f33c71cb90a Mon Sep 17 00:00:00 2001 From: zhangqian Date: Tue, 21 Jun 2022 14:32:06 +0800 Subject: [PATCH] Upgrade to Seata 1.5.1. --- .../seata-example/seata-server/pom.xml | 24 +++++ .../seata/SeataServerApplication.java | 32 +++++++ .../src/main/resources/application.yml | 90 +++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 spring-cloud-alibaba-examples/seata-example/seata-server/pom.xml create mode 100644 spring-cloud-alibaba-examples/seata-example/seata-server/src/main/java/com/alibaba/cloud/examples/seata/SeataServerApplication.java create mode 100644 spring-cloud-alibaba-examples/seata-example/seata-server/src/main/resources/application.yml diff --git a/spring-cloud-alibaba-examples/seata-example/seata-server/pom.xml b/spring-cloud-alibaba-examples/seata-example/seata-server/pom.xml new file mode 100644 index 000000000..f92ea2d3d --- /dev/null +++ b/spring-cloud-alibaba-examples/seata-example/seata-server/pom.xml @@ -0,0 +1,24 @@ + + + + spring-cloud-alibaba-examples + com.alibaba.cloud + ${revision} + ../../pom.xml + + 4.0.0 + seata-server + Spring Cloud Starter Alibaba Seata Example - Seata Server + jar + + + + io.seata + seata-server + 1.5.0 + + + + diff --git a/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/java/com/alibaba/cloud/examples/seata/SeataServerApplication.java b/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/java/com/alibaba/cloud/examples/seata/SeataServerApplication.java new file mode 100644 index 000000000..45b31f0a7 --- /dev/null +++ b/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/java/com/alibaba/cloud/examples/seata/SeataServerApplication.java @@ -0,0 +1,32 @@ +/* + * Copyright 2013-2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.examples.seata; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author ZHANGQIAN + */ +@SpringBootApplication(scanBasePackages = { "io.seata" }) +public class SeataServerApplication { + + public static void main(String[] args) { + SpringApplication.run(io.seata.server.ServerApplication.class, args); + } + +} diff --git a/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/resources/application.yml b/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/resources/application.yml new file mode 100644 index 000000000..6be6719a3 --- /dev/null +++ b/spring-cloud-alibaba-examples/seata-example/seata-server/src/main/resources/application.yml @@ -0,0 +1,90 @@ +base: + config: + mdb: + hostname: #your mysql server ip address + dbname: #your database name for test + port: #your mysql server listening port + username: #your mysql server username + password: #your mysql server password + +server: + port: 7091 + +spring: + application: + name: seata-server + +logging: + config: classpath:logback-spring.xml + file: + path: ${user.home}/logs/seata + extend: + logstash-appender: + destination: 127.0.0.1:4560 + kafka-appender: + bootstrap-servers: 127.0.0.1:9092 + topic: logback_to_logstash + +console: + user: + username: seata + password: seata + +seata: + config: + # support: nacos 、 consul 、 apollo 、 zk 、 etcd3 + type: nacos + nacos: + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + ##if use MSE Nacos with auth, mutex with username/password attribute + #access-key: "" + #secret-key: "" + data-id: seata.properties + registry: + # support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofa + type: nacos + preferred-networks: 30.240.* + nacos: + application: seata-server + server-addr: 127.0.0.1:8848 + cluster: default + username: nacos + password: nacos + store: + # support: file 、 db 、 redis + mode: db + session: + mode: file + lock: + mode: file + file: + dir: sessionStore + max-branch-session-size: 16384 + max-global-session-size: 512 + file-write-buffer-cache-size: 16384 + session-reload-read-size: 100 + flush-disk-mode: async + db: + datasource: druid + db-type: mysql + driver-class-name: com.mysql.jdbc.Driver + url: jdbc:mysql://${base.config.mdb.hostname}:${base.config.mdb.port}/${base.config.mdb.dbname}?rewriteBatchedStatements=true + user: ${base.config.mdb.username} + password: ${base.config.mdb.password} + min-conn: 5 + max-conn: 100 + global-table: global_table + branch-table: branch_table + lock-table: lock_table + distributed-lock-table: distributed_lock + query-limit: 100 + max-wait: 5000 +# server: +# service-port: 8091 #If not configured, the default is '${server.port} + 1000' + security: + secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017 + tokenValidityInMilliseconds: 1800000 + ignore: + urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login