中文社区征文活动启动一周啦,我们陆陆续续收到了很多同学的优秀作品,今天为大家推荐其中的一篇,来自【ID:wsm12138】同学的实践心得。
同时欢迎更多的小伙伴参与,我们将持续为大家更新优秀文章。
About SEATA 柔性事务
【参考】 Seata 柔性事务 — ShardingSphere:Seata 柔性事务 :: ShardingSphere
服务构建
- 服务规划
服务 | IP | 备注 |
---|---|---|
Sysbench | 127.0.0.1 | Version:1.0.20 |
MySQL | 127.0.0.1 | Version:5.7.26 |
ShardingSphere-Proxy | 127.0.0.1 | GitHub - apache/shardingsphere:GitHub - apache/shardingsphere: Build criterion and ecosystem above multi-model databases |
Seata | 127.0.0.1 | Version:1.4.2 |
- ShardingSphere-Proxy 构建配置
PROXY 获取
【参考】
1、How to Set Up Your DEV Environment:
2、Nightly Build: Index of /Proxy/
3、官网下载:下载 :: ShardingSphere
CONF 相关
SERVER.YAML
######################################################################################################
#
# If you want to configure governance, authorization and proxy properties, please refer to this file.
#
######################################################################################################
# mode:
# type: Cluster
# repository:
# type: Zookeeper
# props:
# namespace: governance_ds
# server-lists: localhost:2181
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
# maxRetries: 3
# operationTimeoutMilliseconds: 500
# overwrite: true
rules:
- !AUTHORITY
users:
- root@%:root
- sharding@:sharding
provider:
type: NATIVE
#scaling:
# blockQueueSize: 10000
# workerThread: 40
- !TRANSACTION
defaultType: BASE
providerType: Seata
props:
max-connections-size-per-query: 1
sql-show: true
# executor-size: 16 # Infinite by default.
# proxy-frontend-flush-threshold: 128 # The default value is 128.
# # LOCAL: Proxy will run with LOCAL transaction.
# # XA: Proxy will run with XA transaction.
# # BASE: Proxy will run with B.A.S.E transaction.
# proxy-transaction-type: LOCAL
# xa-transaction-manager-type: Atomikos
# proxy-opentracing-enabled: false
# proxy-hint-enabled: false
# sql-show: false
# check-table-metadata-enabled: false
# lock-wait-timeout-milliseconds: 50000 # The maximum time to wait for a lock
# # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
# # The default value is -1, which means set the minimum value for different JDBC drivers.
# proxy-backend-query-fetch-size: -1
CONFIG-SHARDING.YAML
schemaName: sbtest_sharding
dataSources:
ds_0:
url: jdbc:mysql://127.0.0.1:3306/sbtest_sharding?useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=8192&prepStmtCacheSqlLimit=1024
use