chengyonghu commented on issue #21558:
URL:
https://github.com/apache/shardingsphere/issues/21558#issuecomment-1286410465
## `shardingsphere configuration`
```
spring:
shardingsphere:
datasource:
ds-0:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url:
jdbc:mysql://192.168.0.xx2:3307/xx?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
username: root
password: xx
names: ds-0
rules:
sharding:
# 设置绑定表
binding-tables:
- icloud_user_picture
tables:
# 个人图片基本信息表
icloud_user_picture: # 逻辑表名称
actualDataNodes: ds-0.icloud_user_picture_$->{0..1} # 由数据源名 +
表名组成(参考 Inline 语法规则)
tableStrategy: # 分表策略,同分库策略
standard:
shardingColumn: user_id #分配键
shardingAlgorithmName: icloud_user_picture_inline #分片规则
keyGenerateStrategy: # 分布式序列策略
column: picture_id # 自增列名称,缺省表示不使用自增主键生成器
keyGeneratorName: leaf # 分布式序列算法名称
# 分片规则
sharding-algorithms:
icloud_sys_log_inline:
type: CLASS_BASED
props:
strategy: STANDARD
algorithmClassName:
com.ydtx.camera.icloud.config.CustomPreciseShardingAlgorithm
icloud_user_picture_inline:
type: inline
props:
algorithm-expression: icloud_user_picture_$->{user_id % 2}
keyGenerators:
leaf:
type: "LEAF"
props:
sql-show: true
```
## seata configuration
```
seata:
registry:
type: nacos
config:
type: nacos
nacos:
server-addr: 127.0.0.1:8848
group: SEATA_GROUP
username: nacos
password: nacos
#对应nacos配置 service.vgroupMapping.XXXX
tx-service-group: camera-icloud-tx-group
application-id: camera-icloud
use-jdk-proxy: true
```
@FlyingZC
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]