Seata is an open source distributed transaction solution that delivers high performance and easy to use distributed transaction services under a microservices architecture.
Installation
mysql:
1 | docker run -d -p 3306:3306 --restart=always --name mysql \ |
https://seata.io/zh-cn/docs/ops/deploy-by-docker.html
#Copying out configs from docker container:1
2
3docker run -d -p 8091:8091 -p 7091:7091 --name seata-server seataio/seata-server:latest
docker cp seata-serve:/seata-server/resources ./config
docker rm -vf seata-server
1 | #Nacos: |
application.yml1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70server:
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: 192.168.101.82:8848
namespace:
group: SEATA_GROUP
username: nacos
password: nacos
registry:
# support: nacos, eureka, redis, zk, consul, etcd3, sofa
type: nacos
nacos:
application: seata-server
server-addr: 192.168.101.82:8848
group: SEATA_GROUP
namespace:
cluster: default
username: nacos
password: nacos
store:
# support: file 、 db 、 redis
mode: db
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.101.82:3306/seata-server?rewriteBatchedStatements=true
user: root
password: Aa123#@!
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
The scripts are located at: https://github.com/seata/seata/tree/develop/script
Demo
https://seata.io/zh-cn/docs/user/quickstart.html
https://github.com/seata/seata-samples/tree/master/dubbo
Nacos
https://nacos.io/zh-cn/docs/quick-start-spring-boot.html
https://github.com/nacos-group/nacos-examples.git
Shardingsphere-proxy
1 | mkdir /data/shardingsphere-proxy/conf /data/ext-lib |
cat server.yaml:
1 | rules: |
一个库一个配置文件。
config-sharding-test.yaml:
1 | schemaName: seata_test |
cat config-sharding-account.yaml:
1 | schemaName: account_dev |
自定义分片规则:
1 | #https://shardingsphere.apache.org/document/5.2.1/cn/user-manual/shardingsphere-proxy/startup/bin/ |
Reference
- https://help.aliyun.com/document_detail/157850.html
- https://www.macrozheng.com/cloud/seata.html
- https://github.com/macrozheng/springcloud-learning
- https://seata.io/zh-cn/docs/ops/deploy-guide-beginner.html
- https://github.com/seata/seata/tree/v1.5.1/script
- https://nacos.io/zh-cn/docs/what-is-nacos.html
- http://c.biancheng.net/springcloud/seata.html
- http://c.biancheng.net/springcloud/nacos.html
- https://www.apolloconfig.com/#/zh/README