提交 d1703bf7 编写于 作者: 武汉红喜's avatar 武汉红喜

upgrade to org.apache.shardingsphere

上级 8f8b027a
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<description>shardingjdbc demo</description> <description>shardingjdbc demo</description>
<properties> <properties>
<shardingsphere.version>4.0.0-RC1</shardingsphere.version> <shardingsphere.version>4.0.0-RC2</shardingsphere.version>
</properties> </properties>
<dependencies> <dependencies>
......
...@@ -12,13 +12,13 @@ spring: ...@@ -12,13 +12,13 @@ spring:
names: ds0,ds1 names: ds0,ds1
ds0: ds0:
type: org.apache.commons.dbcp.BasicDataSource type: org.apache.commons.dbcp.BasicDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://db.hongxi.org:3306/demo_ds_0 url: jdbc:mysql://db.hongxi.org:3306/demo_ds_0
username: root username: root
password: n36bxXMnHina password: n36bxXMnHina
ds1: ds1:
type: org.apache.commons.dbcp.BasicDataSource type: org.apache.commons.dbcp.BasicDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://db.hongxi.org:3306/demo_ds_1 url: jdbc:mysql://db.hongxi.org:3306/demo_ds_1
username: root username: root
password: n36bxXMnHina password: n36bxXMnHina
...@@ -46,167 +46,159 @@ spring: ...@@ -46,167 +46,159 @@ spring:
--- ---
spring: spring:
profiles: sharding-db profiles: sharding-db
sharding: shardingsphere:
jdbc: sharding:
config: default-database-strategy:
sharding: inline:
default-database-strategy: algorithm-expression: ds_${user_id % 2}
inline: sharding-column: user_id
algorithm-expression: ds_${user_id % 2} tables:
sharding-column: user_id t_order:
tables: actual-data-nodes: ds_${0..1}.t_order
t_order: key-generator-column-name: order_id
actual-data-nodes: ds_${0..1}.t_order t_order_item:
key-generator-column-name: order_id actual-data-nodes: ds_${0..1}.t_order_item
t_order_item: key-generator-column-name: order_item_id
actual-data-nodes: ds_${0..1}.t_order_item datasource:
key-generator-column-name: order_item_id ds_0:
datasource: driver-class-name: com.mysql.cj.jdbc.Driver
ds_0: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_0
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_0 ds_1:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_1: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_1
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_1 names: ds_0,ds_1
username: root
names: ds_0,ds_1
--- ---
spring: spring:
profiles: sharding-tbl profiles: sharding-tbl
sharding: shardingsphere:
jdbc: sharding:
config: tables:
sharding: t_order:
tables: actual-data-nodes: ds.t_order_${0..1}
t_order: key-generator-column-name: order_id
actual-data-nodes: ds.t_order_${0..1} table-strategy:
key-generator-column-name: order_id inline:
table-strategy: algorithm-expression: t_order_${order_id % 2}
inline: sharding-column: order_id
algorithm-expression: t_order_${order_id % 2} t_order_item:
sharding-column: order_id actual-data-nodes: ds.t_order_item_${0..1}
t_order_item: key-generator-column-name: order_item_id
actual-data-nodes: ds.t_order_item_${0..1} table-strategy:
key-generator-column-name: order_item_id inline:
table-strategy: algorithm-expression: t_order_item_${order_id % 2}
inline: sharding-column: order_id
algorithm-expression: t_order_item_${order_id % 2} datasource:
sharding-column: order_id ds:
datasource: driver-class-name: com.mysql.cj.jdbc.Driver
ds: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds names: ds
username: root
names: ds
--- ---
spring: spring:
profiles: masterslave profiles: masterslave
sharding: shardingsphere:
jdbc: masterslave:
config: load-balance-algorithm-type: round_robin
masterslave: master-data-source-name: ds_master
load-balance-algorithm-type: round_robin name: ds_ms
master-data-source-name: ds_master slave-data-source-names: ds_slave_0,ds_slave_1
name: ds_ms datasource:
slave-data-source-names: ds_slave_0,ds_slave_1 ds_master:
datasource: driver-class-name: com.mysql.cj.jdbc.Driver
ds_master: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master ds_slave_0:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_slave_0: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_slave_0
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_slave_0 ds_slave_1:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_slave_1: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_slave_1
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_slave_1 names: ds_master,ds_slave_0,ds_slave_1
username: root
names: ds_master,ds_slave_0,ds_slave_1
--- ---
spring: spring:
profiles: sharding-masterslave profiles: sharding-masterslave
sharding: shardingsphere:
jdbc: sharding:
config: default-database-strategy:
sharding: inline:
default-database-strategy: algorithm-expression: ds_${user_id % 2}
inline: sharding-column: user_id
algorithm-expression: ds_${user_id % 2} master-slave-rules:
sharding-column: user_id ds_0:
master-slave-rules: master-data-source-name: ds_master_0
ds_0: slave-data-source-names: ds_master_0_slave_0, ds_master_0_slave_1
master-data-source-name: ds_master_0 ds_1:
slave-data-source-names: ds_master_0_slave_0, ds_master_0_slave_1 master-data-source-name: ds_master_1
ds_1: slave-data-source-names: ds_master_1_slave_0, ds_master_1_slave_1
master-data-source-name: ds_master_1 tables:
slave-data-source-names: ds_master_1_slave_0, ds_master_1_slave_1 t_order:
tables: actual-data-nodes: ds_${0..1}.t_order_${0..1}
t_order: key-generator-column-name: order_id
actual-data-nodes: ds_${0..1}.t_order_${0..1} table-strategy:
key-generator-column-name: order_id inline:
table-strategy: algorithm-expression: t_order_${order_id % 2}
inline: sharding-column: order_id
algorithm-expression: t_order_${order_id % 2} t_order_item:
sharding-column: order_id actual-data-nodes: ds_${0..1}.t_order_item_${0..1}
t_order_item: key-generator-column-name: order_item_id
actual-data-nodes: ds_${0..1}.t_order_item_${0..1} table-strategy:
key-generator-column-name: order_item_id inline:
table-strategy: algorithm-expression: t_order_item_${order_id % 2}
inline: sharding-column: order_id
algorithm-expression: t_order_item_${order_id % 2} datasource:
sharding-column: order_id ds_master_0:
datasource: driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_0: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_0
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_0 ds_master_0_slave_0:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_0_slave_0: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0 ds_master_0_slave_1:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_0_slave_1: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_0_slave_1 ds_master_1:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_1: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_1
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_1 ds_master_1_slave_0:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_1_slave_0: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_1_slave_0 ds_master_1_slave_1:
username: root driver-class-name: com.mysql.cj.jdbc.Driver
ds_master_1_slave_1: password: ''
driver-class-name: com.mysql.jdbc.Driver type: org.apache.commons.dbcp.BasicDataSource
password: '' url: jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1
type: org.apache.commons.dbcp.BasicDataSource username: root
url: jdbc:mysql://localhost:3306/demo_ds_master_1_slave_1 names: ds_master_0,ds_master_1,ds_master_0_slave_0,ds_master_0_slave_1,ds_master_1_slave_0,ds_master_1_slave_1
username: root \ No newline at end of file
names: ds_master_0,ds_master_1,ds_master_0_slave_0,ds_master_0_slave_1,ds_master_1_slave_0,ds_master_1_slave_1
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册