You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/02/08 03:56:37 UTC

[GitHub] [shardingsphere] huanghao495430759 commented on a change in pull request #9378: Fix#9286

huanghao495430759 commented on a change in pull request #9378:
URL: https://github.com/apache/shardingsphere/pull/9378#discussion_r571767255



##########
File path: docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/mix.cn.md
##########
@@ -3,4 +3,83 @@ title = "混合规则"
 weight = 6
 +++
 
-TODO
+混合配置的规则项之间的叠加使用是通过数据源名称和表名称关联的。
+
+如果前一个规则是面向数据源聚合的,下一个规则在配置数据源时,则需要使用前一个规则配置的聚合后的逻辑数据源名称;
+同理,如果前一个规则是面向表聚合的,下一个规则在配置表时,则需要使用前一个规则配置的聚合后的逻辑表名称。
+
+## 配置项说明
+```properties
+# 数据源配置
+# 数据源名称,多数据源以逗号分隔
+spring.shardingsphere.datasource.names= primary-ds0,primary-ds1,primary-ds0-replica0,primary-ds1-replica0
+
+spring.shardingsphere.datasource.primary-ds0.url= # 数据库 URL 连接
+spring.shardingsphere.datasource.primary-ds0.type=  # 数据库连接池类名称
+spring.shardingsphere.datasource.primary-ds0.driver-class-name= # 数据库驱动类名
+spring.shardingsphere.datasource.primary-ds0.username= # 数据库用户名
+spring.shardingsphere.datasource.primary-ds0.password= # 数据库密码
+spring.shardingsphere.datasource.primary-ds0.xxx=  # 数据库连接池的其它属性
+
+spring.shardingsphere.datasource.primary-ds1.url= # 数据库 URL 连接
+... 忽略其他数据库配置项
+
+spring.shardingsphere.datasource.primary-ds0-replica0.url= # 数据库 URL 连接
+... 忽略其他数据库配置项
+
+spring.shardingsphere.datasource.primary-ds1-replica0.url= # 数据库 URL 连接
+... 忽略其他数据库配置项
+
+# 分片规则配置
+# 分库策略
+spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=user_id
+spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=default-database-strategy-inline
+spring.shardingsphere.rules.sharding.binding-tables= # 绑定表名称,多个表之间以逗号分隔
+spring.shardingsphere.rules.sharding.broadcast-tables= # 广播表名称,多个表之间以逗号分隔
+
+# 分表策略
+# 数据源名称 `ds` 使用读写分离配置的逻辑数据源名称
+spring.shardingsphere.rules.sharding.tables.t_user.actual-data-nodes=ds.t_user_$->{0..1}
+spring.shardingsphere.rules.sharding.tables.t_user.table-strategy.standard.sharding-column=user_id
+spring.shardingsphere.rules.sharding.tables.t_user.table-strategy.standard.sharding-algorithm-name=user-table-strategy-inline
+
+# 数据加密配置
+# `t_user` 使用分片规则配置的逻辑表名称
+spring.shardingsphere.rules.encrypt.tables.t_user.columns.user_name.cipher-column=user_name
+spring.shardingsphere.rules.encrypt.tables.t_user.columns.user_name.encryptor-name=name-encryptor
+spring.shardingsphere.rules.encrypt.tables.t_user.columns.pwd.cipher-column=pwd
+spring.shardingsphere.rules.encrypt.tables.t_user.columns.pwd.encryptor-name=pwd-encryptor
+
+# 数据加密算法配置
+spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.type=AES
+spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.props.aes-key-value=123456abc
+spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor.type=AES
+spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor.props.aes-key-value=123456abc
+
+# 分布式序列算法配置
+spring.shardingsphere.rules.sharding.tables.t_user.key-generate-strategy.column=user_id
+spring.shardingsphere.rules.sharding.tables.t_user.key-generate-strategy.key-generator-name=snowflake
+
+# 分片算法配置
+spring.shardingsphere.rules.sharding.sharding-algorithms.default-database-strategy-inline.type=INLINE
+# 数据源名称 `ds` 使用读写分离配置的逻辑数据源名称

Review comment:
       Oh,it is my mistake,I should be comment what the inline expression means instead of `ds` means .




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org