From d5e45e74c9410c00fd613261e3ad25c6a4a3dac4 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <773861846@qq.com> Date: Sat, 4 Jun 2022 07:54:46 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=20ShardingSphere-JD?= =?UTF-8?q?BC=20=E7=9A=84=E6=A8=A1=E5=BC=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7a06a9e..fa82642 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,8 +20,28 @@ spring: url: jdbc:mysql://localhost:3306/novel_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai username: root password: test123456 - # 分库分表配置 + # ShardingSphere-JDBC 配置 + # 配置是 ShardingSphere-JDBC 中唯一与应用开发者交互的模块, + # 通过它可以快速清晰的理解 ShardingSphere-JDBC 所提供的功能。 shardingsphere: + # 是否开启分库分表 + enabled: false + props: + # 是否在日志中打印 SQL + sql-show: true + # 模式配置 + mode: + # 单机模式 + type: Standalone + repository: + # 文件持久化 + type: File + props: + # 元数据存储路径 + path: .shardingsphere + # 使用本地配置覆盖持久化配置 + overwrite: true + # 数据源配置 datasource: names: ds_0 ds_0: @@ -30,10 +50,12 @@ spring: jdbcUrl: jdbc:mysql://localhost:3306/novel_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai username: root password: test123456 + # 规则配置 rules: + # 数据分片 sharding: tables: - # book_content表 + # book_content 表 book_content: # 数据节点 actual-data-nodes: ds_$->{0}.book_content$->{0..9} @@ -51,12 +73,6 @@ spring: props: # 分片算法的行表达式 algorithm-expression: book_content$->{chapter_id % 10} - props: - # 是否在日志中打印 SQL - sql-show: true - # 是否开启分库分表 - enabled: false - config: activate: