Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
4543e4a7
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4543e4a7
编写于
4月 04, 2019
作者:
L
liya.cookie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
complete broadcast table fro rawjdbc
上级
1b8e8fd7
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
120 addition
and
88 deletion
+120
-88
example-common/repository-api/src/main/java/io/shardingsphere/example/common/DataSourceUtil.java
...java/io/shardingsphere/example/common/DataSourceUtil.java
+1
-1
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/JavaRangeConfigurationExample.java
...ple/sharding/data/jdbc/JavaRangeConfigurationExample.java
+2
-1
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/YamlConfigurationExample.java
.../example/sharding/data/jdbc/YamlConfigurationExample.java
+2
-1
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/YamlRangeConfigurationExample.java
...ple/sharding/data/jdbc/YamlRangeConfigurationExample.java
+2
-1
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesAndTablesConfigurationPrecise.java
...onfig/ShardingDatabasesAndTablesConfigurationPrecise.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesAndTablesConfigurationRange.java
.../config/ShardingDatabasesAndTablesConfigurationRange.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesConfigurationPrecise.java
...ta/jdbc/config/ShardingDatabasesConfigurationPrecise.java
+4
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesConfigurationRange.java
...data/jdbc/config/ShardingDatabasesConfigurationRange.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingMasterSlaveConfigurationPrecise.java
.../jdbc/config/ShardingMasterSlaveConfigurationPrecise.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingMasterSlaveConfigurationRange.java
...ta/jdbc/config/ShardingMasterSlaveConfigurationRange.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingTablesConfigurationPrecise.java
.../data/jdbc/config/ShardingTablesConfigurationPrecise.java
+6
-9
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingTablesConfigurationRange.java
...ng/data/jdbc/config/ShardingTablesConfigurationRange.java
+5
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/master-slave.yaml
...dbc-example/src/main/resources/META-INF/master-slave.yaml
+4
-4
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-range.yaml
...src/main/resources/META-INF/sharding-databases-range.yaml
+8
-3
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables-range.yaml
...n/resources/META-INF/sharding-databases-tables-range.yaml
+7
-2
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
...rc/main/resources/META-INF/sharding-databases-tables.yaml
+9
-4
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases.yaml
...ample/src/main/resources/META-INF/sharding-databases.yaml
+8
-3
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-master-slave-range.yaml
.../main/resources/META-INF/sharding-master-slave-range.yaml
+11
-6
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-master-slave.yaml
...le/src/main/resources/META-INF/sharding-master-slave.yaml
+13
-8
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-tables-range.yaml
...le/src/main/resources/META-INF/sharding-tables-range.yaml
+6
-1
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-tables.yaml
...-example/src/main/resources/META-INF/sharding-tables.yaml
+7
-2
未找到文件。
example-common/repository-api/src/main/java/io/shardingsphere/example/common/DataSourceUtil.java
浏览文件 @
4543e4a7
...
...
@@ -29,7 +29,7 @@ public class DataSourceUtil {
private
static
final
String
USER_NAME
=
"root"
;
private
static
final
String
PASSWORD
=
"
liya76133951
"
;
private
static
final
String
PASSWORD
=
""
;
public
static
DataSource
createDataSource
(
final
String
dataSourceName
)
{
HikariDataSource
result
=
new
HikariDataSource
();
...
...
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/JavaRangeConfigurationExample.java
浏览文件 @
4543e4a7
...
...
@@ -17,6 +17,7 @@
package
io.shardingsphere.example.sharding.data.jdbc
;
import
io.shardingsphere.example.common.jdbc.repository.CountryRepositroyImpl
;
import
io.shardingsphere.example.common.jdbc.repository.OrderItemRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.repository.RangeOrderRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.service.CommonServiceImpl
;
...
...
@@ -47,6 +48,6 @@ public class JavaRangeConfigurationExample {
}
private
static
CommonService
getCommonService
(
final
DataSource
dataSource
)
{
return
new
CommonServiceImpl
(
new
RangeOrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
));
return
new
CommonServiceImpl
(
new
RangeOrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
)
,
new
CountryRepositroyImpl
(
dataSource
)
);
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/YamlConfigurationExample.java
浏览文件 @
4543e4a7
...
...
@@ -17,6 +17,7 @@
package
io.shardingsphere.example.sharding.data.jdbc
;
import
io.shardingsphere.example.common.jdbc.repository.CountryRepositroyImpl
;
import
io.shardingsphere.example.common.jdbc.repository.OrderItemRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.repository.OrderRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.service.CommonServiceImpl
;
...
...
@@ -48,6 +49,6 @@ public class YamlConfigurationExample {
}
private
static
CommonService
getCommonService
(
final
DataSource
dataSource
)
{
return
new
CommonServiceImpl
(
new
OrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
));
return
new
CommonServiceImpl
(
new
OrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
)
,
new
CountryRepositroyImpl
(
dataSource
)
);
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/YamlRangeConfigurationExample.java
浏览文件 @
4543e4a7
...
...
@@ -17,6 +17,7 @@
package
io.shardingsphere.example.sharding.data.jdbc
;
import
io.shardingsphere.example.common.jdbc.repository.CountryRepositroyImpl
;
import
io.shardingsphere.example.common.jdbc.repository.OrderItemRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.repository.RangeOrderRepositoryImpl
;
import
io.shardingsphere.example.common.jdbc.service.CommonServiceImpl
;
...
...
@@ -48,6 +49,6 @@ public class YamlRangeConfigurationExample {
}
private
static
CommonService
getCommonService
(
final
DataSource
dataSource
)
{
return
new
CommonServiceImpl
(
new
RangeOrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
));
return
new
CommonServiceImpl
(
new
RangeOrderRepositoryImpl
(
dataSource
),
new
OrderItemRepositoryImpl
(
dataSource
)
,
new
CountryRepositroyImpl
(
dataSource
)
);
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesAndTablesConfigurationPrecise.java
浏览文件 @
4543e4a7
...
...
@@ -41,6 +41,7 @@ public final class ShardingDatabasesAndTablesConfigurationPrecise implements Exa
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
InlineShardingStrategyConfiguration
(
"user_id"
,
"demo_ds_${user_id % 2}"
));
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
new
PreciseModuloShardingTableAlgorithm
()));
return
ShardingDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
shardingRuleConfig
,
new
Properties
());
...
...
@@ -48,12 +49,14 @@ public final class ShardingDatabasesAndTablesConfigurationPrecise implements Exa
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"demo_ds_${0..1}.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds_${0..1}.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds_${0..1}.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -62,8 +65,4 @@ public final class ShardingDatabasesAndTablesConfigurationPrecise implements Exa
result
.
put
(
"demo_ds_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesAndTablesConfigurationRange.java
浏览文件 @
4543e4a7
...
...
@@ -43,6 +43,7 @@ public final class ShardingDatabasesAndTablesConfigurationRange implements Examp
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"user_id"
,
new
PreciseModuloShardingDatabaseAlgorithm
(),
new
RangeModuloShardingDatabaseAlgorithm
()));
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
...
...
@@ -52,12 +53,14 @@ public final class ShardingDatabasesAndTablesConfigurationRange implements Examp
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"demo_ds_${0..1}.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds_${0..1}.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds_${0..1}.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -66,8 +69,4 @@ public final class ShardingDatabasesAndTablesConfigurationRange implements Examp
result
.
put
(
"demo_ds_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesConfigurationPrecise.java
浏览文件 @
4543e4a7
...
...
@@ -45,12 +45,14 @@ public final class ShardingDatabasesConfigurationPrecise implements ExampleConfi
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -59,8 +61,4 @@ public final class ShardingDatabasesConfigurationPrecise implements ExampleConfi
result
.
put
(
"demo_ds_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingDatabasesConfigurationRange.java
浏览文件 @
4543e4a7
...
...
@@ -40,6 +40,7 @@ public final class ShardingDatabasesConfigurationRange implements ExampleConfigu
ShardingRuleConfiguration
shardingRuleConfig
=
new
ShardingRuleConfiguration
();
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"user_id"
,
new
PreciseModuloShardingDatabaseAlgorithm
(),
new
RangeModuloShardingDatabaseAlgorithm
()));
return
ShardingDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
shardingRuleConfig
,
new
Properties
());
...
...
@@ -47,12 +48,14 @@ public final class ShardingDatabasesConfigurationRange implements ExampleConfigu
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -61,8 +64,4 @@ public final class ShardingDatabasesConfigurationRange implements ExampleConfigu
result
.
put
(
"demo_ds_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingMasterSlaveConfigurationPrecise.java
浏览文件 @
4543e4a7
...
...
@@ -45,6 +45,7 @@ public final class ShardingMasterSlaveConfigurationPrecise implements ExampleCon
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"user_id"
,
new
PreciseModuloShardingDatabaseAlgorithm
()));
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
new
PreciseModuloShardingTableAlgorithm
()));
shardingRuleConfig
.
setMasterSlaveRuleConfigs
(
getMasterSlaveRuleConfigurations
());
...
...
@@ -53,12 +54,14 @@ public final class ShardingMasterSlaveConfigurationPrecise implements ExampleCon
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"ds_${0..1}.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"ds_${0..1}.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"ds_${0..1}.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
List
<
MasterSlaveRuleConfiguration
>
getMasterSlaveRuleConfigurations
()
{
...
...
@@ -77,8 +80,4 @@ public final class ShardingMasterSlaveConfigurationPrecise implements ExampleCon
result
.
put
(
"demo_ds_master_1_slave_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_master_1_slave_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingMasterSlaveConfigurationRange.java
浏览文件 @
4543e4a7
...
...
@@ -47,6 +47,7 @@ public final class ShardingMasterSlaveConfigurationRange implements ExampleConfi
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"user_id"
,
new
PreciseModuloShardingDatabaseAlgorithm
(),
new
RangeModuloShardingDatabaseAlgorithm
()));
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
...
...
@@ -57,12 +58,14 @@ public final class ShardingMasterSlaveConfigurationRange implements ExampleConfi
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"ds_${0..1}.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"ds_${0..1}.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"ds_${0..1}.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
List
<
MasterSlaveRuleConfiguration
>
getMasterSlaveRuleConfigurations
()
{
...
...
@@ -81,8 +84,4 @@ public final class ShardingMasterSlaveConfigurationRange implements ExampleConfi
result
.
put
(
"demo_ds_master_1_slave_1"
,
DataSourceUtil
.
createDataSource
(
"demo_ds_master_1_slave_1"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingTablesConfigurationPrecise.java
浏览文件 @
4543e4a7
...
...
@@ -40,20 +40,21 @@ public final class ShardingTablesConfigurationPrecise implements ExampleConfigur
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
new
PreciseModuloShardingTableAlgorithm
()));
Properties
properties
=
new
Properties
();
properties
.
put
(
"sql.show"
,
true
);
return
ShardingDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
shardingRuleConfig
,
properties
);
return
ShardingDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
shardingRuleConfig
,
new
Properties
());
}
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"demo_ds.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -61,8 +62,4 @@ public final class ShardingTablesConfigurationPrecise implements ExampleConfigur
result
.
put
(
"demo_ds"
,
DataSourceUtil
.
createDataSource
(
"demo_ds"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/java/io/shardingsphere/example/sharding/data/jdbc/config/ShardingTablesConfigurationRange.java
浏览文件 @
4543e4a7
...
...
@@ -41,6 +41,7 @@ public final class ShardingTablesConfigurationRange implements ExampleConfigurat
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderTableRuleConfiguration
());
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
getOrderItemTableRuleConfiguration
());
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
shardingRuleConfig
.
getBroadcastTables
().
add
(
"t_country"
);
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
new
PreciseModuloShardingTableAlgorithm
(),
new
RangeModuloShardingTableAlgorithm
()));
return
ShardingDataSourceFactory
.
createDataSource
(
createDataSourceMap
(),
shardingRuleConfig
,
new
Properties
());
...
...
@@ -48,12 +49,14 @@ public final class ShardingTablesConfigurationRange implements ExampleConfigurat
private
static
TableRuleConfiguration
getOrderTableRuleConfiguration
()
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order"
,
"demo_ds.t_order_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
getKeyGeneratorConfiguration
(
));
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
()
));
return
result
;
}
private
static
TableRuleConfiguration
getOrderItemTableRuleConfiguration
()
{
return
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds.t_order_item_${[0, 1]}"
);
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
"t_order_item"
,
"demo_ds.t_order_item_${[0, 1]}"
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_item_id"
,
new
Properties
()));
return
result
;
}
private
static
Map
<
String
,
DataSource
>
createDataSourceMap
()
{
...
...
@@ -61,8 +64,4 @@ public final class ShardingTablesConfigurationRange implements ExampleConfigurat
result
.
put
(
"demo_ds"
,
DataSourceUtil
.
createDataSource
(
"demo_ds"
));
return
result
;
}
private
static
KeyGeneratorConfiguration
getKeyGeneratorConfiguration
()
{
return
new
KeyGeneratorConfiguration
(
"SNOWFLAKE"
,
"order_id"
,
new
Properties
());
}
}
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/master-slave.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_master
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_slave_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_slave_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_slave_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_slave_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_slave_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_slave_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -21,4 +21,4 @@ masterSlaveRule:
slaveDataSourceNames
:
[
ds_slave_0
,
ds_slave_1
]
props
:
sql.show
:
tru
e
sql.show
:
fals
e
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-range.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -19,8 +19,13 @@ shardingRule:
column
:
order_id
t_order_item
:
actualDataNodes
:
ds_${0..1}.t_order_item
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
standard
:
...
...
@@ -31,4 +36,4 @@ shardingRule:
none
:
props
:
sql.show
:
tru
e
sql.show
:
fals
e
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables-range.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -29,8 +29,13 @@ shardingRule:
shardingColumn
:
order_id
preciseAlgorithmClassName
:
io.shardingsphere.example.algorithm.PreciseModuloShardingTableAlgorithm
rangeAlgorithmClassName
:
io.shardingsphere.example.algorithm.RangeModuloShardingTableAlgorithm
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
standard
:
...
...
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -26,9 +26,14 @@ shardingRule:
tableStrategy
:
inline
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
algorithmExpression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
inline
:
...
...
@@ -38,4 +43,4 @@ shardingRule:
none
:
props
:
sql.show
:
tru
e
sql.show
:
fals
e
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -19,8 +19,13 @@ shardingRule:
column
:
order_id
t_order_item
:
actualDataNodes
:
ds_${0..1}.t_order_item
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
inline
:
...
...
@@ -30,4 +35,4 @@ shardingRule:
none
:
props
:
sql.show
:
tru
e
sql.show
:
fals
e
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-master-slave-range.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_master_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_0_slave_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_0_slave_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1_slave_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1_slave_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -49,8 +49,13 @@ shardingRule:
shardingColumn
:
order_id
preciseAlgorithmClassName
:
io.shardingsphere.example.algorithm.PreciseModuloShardingTableAlgorithm
rangeAlgorithmClassName
:
io.shardingsphere.example.algorithm.RangeModuloShardingTableAlgorithm
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
standard
:
...
...
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-master-slave.yaml
浏览文件 @
4543e4a7
dataSources
:
ds_master_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_0_slave_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_0_slave_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1_slave_0
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
ds_master_1_slave_1
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -46,9 +46,14 @@ shardingRule:
tableStrategy
:
inline
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
algorithmExpression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
defaultDatabaseStrategy
:
inline
:
...
...
@@ -66,4 +71,4 @@ shardingRule:
loadBalanceAlgorithmType
:
ROUND_ROBIN
props
:
sql.show
:
tru
e
sql.show
:
fals
e
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-tables-range.yaml
浏览文件 @
4543e4a7
dataSources
:
ds
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -24,8 +24,13 @@ shardingRule:
shardingColumn
:
order_id
preciseAlgorithmClassName
:
io.shardingsphere.example.algorithm.PreciseModuloShardingTableAlgorithm
rangeAlgorithmClassName
:
io.shardingsphere.example.algorithm.RangeModuloShardingTableAlgorithm
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
props
:
sql.show
:
false
sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-tables.yaml
浏览文件 @
4543e4a7
dataSources
:
ds
:
!!com.zaxxer.hikari.HikariDataSource
driverClassName
:
com.mysql.jdbc.Driver
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds
jdbcUrl
:
jdbc:mysql://localhost:3306/demo_ds
?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username
:
root
password
:
...
...
@@ -22,8 +22,13 @@ shardingRule:
inline
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
broadcastTables
:
-
t_country
props
:
sql.show
:
tru
e
sql.show
:
fals
e
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录