You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/11/30 14:39:36 UTC
[shardingsphere] branch master updated: Refactor cluster-mode-example with ShardingSphereDriver (#22542)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new f6a202bfde5 Refactor cluster-mode-example with ShardingSphereDriver (#22542)
f6a202bfde5 is described below
commit f6a202bfde51b00dcfb02453e32697fc3c736324
Author: ChenJiaHao <37...@users.noreply.github.com>
AuthorDate: Wed Nov 30 22:39:29 2022 +0800
Refactor cluster-mode-example with ShardingSphereDriver (#22542)
* Refactor with ShardingSphereDriver
* Format
* Add TODO
* Fix
* Remove password
* Add blank line
* Fix file name
---
.../pom.xml | 2 +-
.../application-cloud-zookeeper-encrypt.properties | 6 +-
...-cloud-zookeeper-readwrite-splitting.properties | 6 +-
.../application-cloud-zookeeper-shadow.properties | 6 +-
...-zookeeper-sharding-databases-tables.properties | 8 +-
.../application-local-zookeeper-encrypt.properties | 22 +----
...-local-zookeeper-readwrite-splitting.properties | 31 +------
.../application-local-zookeeper-shadow.properties | 47 +---------
...-zookeeper-sharding-databases-tables.properties | 58 +-----------
.../src/main/resources/application.properties | 6 +-
...dow.properties => cloud-zookeeper-encrypt.yaml} | 11 ++-
...es => cloud-zookeeper-readwrite-splitting.yaml} | 11 ++-
...adow.properties => cloud-zookeeper-shadow.yaml} | 11 ++-
...cloud-zookeeper-sharding-databases-tables.yaml} | 11 ++-
...ion.properties => local-zookeeper-encrypt.yaml} | 40 ++++++--
.../local-zookeeper-readwrite-splitting.yaml | 60 ++++++++++++
.../src/main/resources/local-zookeeper-shadow.yaml | 81 ++++++++++++++++
.../local-zookeeper-sharding-databases-tables.yaml | 102 +++++++++++++++++++++
.../pom.xml | 2 +-
.../ClusterModeSpringNamespaceMybatisExample.java | 5 +-
.../zookeeper/cloud/application-encrypt.xml | 15 ++-
.../cloud/application-readwrite-splitting.xml | 10 +-
.../zookeeper/cloud/application-shadow.xml | 9 +-
.../application-sharding-databases-tables.xml | 10 +-
.../zookeeper/local/application-encrypt.xml | 36 +-------
.../local/application-readwrite-splitting.xml | 44 +--------
.../zookeeper/local/application-shadow.xml | 72 +--------------
.../application-sharding-databases-tables.xml | 73 +--------------
.../main/resources/cloud-zookeeper-encrypt.yaml} | 11 ++-
.../cloud-zookeeper-readwrite-splitting.yaml} | 11 ++-
.../main/resources/cloud-zookeeper-shadow.yaml} | 11 ++-
...cloud-zookeeper-sharding-databases-tables.yaml} | 11 ++-
.../main/resources/local-zookeeper-encrypt.yaml | 60 ++++++++++++
.../local-zookeeper-readwrite-splitting.yaml | 61 ++++++++++++
.../src/main/resources/local-zookeeper-shadow.yaml | 81 ++++++++++++++++
.../local-zookeeper-sharding-databases-tables.yaml | 89 ++++++++++++++++++
36 files changed, 683 insertions(+), 447 deletions(-)
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/pom.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/pom.xml
index d1b285fe48e..15d0d430ade 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/pom.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/pom.xml
@@ -36,7 +36,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
+ <artifactId>shardingsphere-jdbc-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-encrypt.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-encrypt.properties
index 5f488b35611..9bb1889c15b 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-encrypt.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-encrypt.properties
@@ -15,7 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_encrypt
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:cloud-zookeeper-encrypt.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-readwrite-splitting.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-readwrite-splitting.properties
index 0d48c2cdedc..4b9df21a259 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-readwrite-splitting.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-readwrite-splitting.properties
@@ -15,7 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_readwrite_ds
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:cloud-zookeeper-readwrite-splitting.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
index f29f5e8dca8..a3ebe10712d 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
@@ -15,7 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:cloud-zookeeper-shadow.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-sharding-databases-tables.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-sharding-databases-tables.properties
index ee0a64a6b93..3fbcfac5414 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-sharding-databases-tables.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-sharding-databases-tables.properties
@@ -15,9 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.database.name=sharding-databases-tables
-
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_sharding
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:cloud-zookeeper-sharding-databases-tables.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-encrypt.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-encrypt.properties
index 91d43ce0d61..7ab2446289b 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-encrypt.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-encrypt.properties
@@ -15,23 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_encrypt
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
-
-spring.shardingsphere.datasource.name=ds-encrypt
-
-spring.shardingsphere.datasource.ds-encrypt.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.ds-encrypt.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.ds-encrypt.jdbc-url=jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.ds-encrypt.username=root
-spring.shardingsphere.datasource.ds-encrypt.password=
-
-spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.type=AES
-spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.props.aes-key-value=123456
-spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.cipher-column=status
-spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.encryptor-name=status-encryptor
-
-spring.shardingsphere.props.query.with.cipher.comlum=true
-spring.shardingsphere.props.sql-show=true
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:local-zookeeper-encrypt.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-readwrite-splitting.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-readwrite-splitting.properties
index af8c781ef36..9564fa2df02 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-readwrite-splitting.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-readwrite-splitting.properties
@@ -15,32 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_readwrite_ds
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
-
-spring.shardingsphere.datasource.names=write-ds,read-ds-0,read-ds-1
-
-spring.shardingsphere.datasource.write-ds.jdbc-url=jdbc:mysql://localhost:3306/demo_write_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.write-ds.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.write-ds.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.write-ds.username=root
-spring.shardingsphere.datasource.write-ds.password=
-
-spring.shardingsphere.datasource.read-ds-0.jdbc-url=jdbc:mysql://localhost:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.read-ds-0.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.read-ds-0.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.read-ds-0.username=root
-spring.shardingsphere.datasource.read-ds-0.password=
-
-spring.shardingsphere.datasource.read-ds-1.jdbc-url=jdbc:mysql://localhost:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.read-ds-1.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.read-ds-1.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.read-ds-1.username=root
-spring.shardingsphere.datasource.read-ds-1.password=
-
-spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.static-strategy.write-data-source-name=write-ds
-spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.static-strategy.read-data-source-names=read-ds-0,read-ds-1
-spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.load-balancer-name=round_robin
-spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin.type=ROUND_ROBIN
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:local-zookeeper-readwrite-splitting.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-shadow.properties
index 439d9da298a..ea0cd79f925 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-shadow.properties
@@ -15,48 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
-
-spring.shardingsphere.datasource.name=ds,shadow-ds
-
-spring.shardingsphere.datasource.shadow-ds.jdbc-url=jdbc:mysql://localhost:3306/shadow_demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.shadow-ds.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.shadow-ds.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.shadow-ds.username=root
-spring.shardingsphere.datasource.shadow-ds.password=
-
-spring.shardingsphere.datasource.ds.jdbc-url=jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.ds.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.ds.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.ds.username=root
-spring.shardingsphere.datasource.ds.password=
-
-spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.source-data-source-name=ds
-spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-source-name=shadow-ds
-
-spring.shardingsphere.rules.shadow.tables.t_user.data-source-names=shadow-data-source
-spring.shardingsphere.rules.shadow.tables.t_user.shadow-algorithm-names=user-id-insert-match-algorithm,user-id-delete-match-algorithm,user-id-select-match-algorithm,simple-hint-algorithm
-
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.type=VALUE_MATCH
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.operation=insert
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.column=user_type
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.value=1
-
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.type=VALUE_MATCH
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.operation=delete
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.column=user_type
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.value=1
-
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.type=VALUE_MATCH
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.operation=select
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.column=user_type
-spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.value=1
-
-spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.type=SIMPLE_HINT
-spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.props.shadow=true
-spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.props.foo=bar
-
-spring.shardingsphere.props.sql-show=true
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:local-zookeeper-shadow.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-sharding-databases-tables.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-sharding-databases-tables.properties
index 25517fb5951..6a22124a323 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-sharding-databases-tables.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-local-zookeeper-sharding-databases-tables.properties
@@ -15,59 +15,5 @@
# limitations under the License.
#
-spring.shardingsphere.database.name=sharding-databases-tables
-
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_sharding
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
-
-spring.shardingsphere.datasource.names=ds-0,ds-1
-
-spring.shardingsphere.datasource.ds-0.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.ds-0.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.ds-0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.ds-0.username=root
-spring.shardingsphere.datasource.ds-0.password=
-spring.shardingsphere.datasource.ds-0.max-active=16
-
-spring.shardingsphere.datasource.ds-1.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.ds-1.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.ds-1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
-spring.shardingsphere.datasource.ds-1.username=root
-spring.shardingsphere.datasource.ds-1.password=
-spring.shardingsphere.datasource.ds-1.max-active=16
-
-spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=user_id
-spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=database-inline
-
-spring.shardingsphere.rules.sharding.binding-tables[0]=t_order,t_order_item
-spring.shardingsphere.rules.sharding.broadcast-tables=t_address
-
-spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds-$->{0..1}.t_order_$->{0..1}
-spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
-spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=t-order-inline
-
-spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id
-spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake
-
-spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=ds-$->{0..1}.t_order_item_$->{0..1}
-spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id
-spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-algorithm-name=t-order-item-inline
-
-spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.column=order_item_id
-spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.key-generator-name=snowflake
-
-spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE
-spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.props.algorithm-expression=ds-$->{user_id % 2}
-spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.type=INLINE
-spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.props.algorithm-expression=t_order_$->{order_id % 2}
-spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.type=INLINE
-spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.props.algorithm-expression=t_order_item_$->{order_id % 2}
-
-spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
-
-spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.type=AES
-spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.props.aes-key-value=123456
-spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.cipher-column=status
-spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.encryptor-name=status-encryptor
+spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
+spring.datasource.url=jdbc:shardingsphere:classpath:local-zookeeper-sharding-databases-tables.yaml
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties
index 7895ab43eb3..0f46739430d 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties
@@ -16,11 +16,11 @@
#
mybatis.config-location=classpath:META-INF/mybatis-config.xml
+# TODO Fix ShardingSphereDrive cluster mode start
+#spring.profiles.active=local-zookeeper-sharding-databases-tables
+spring.profiles.active=cloud-zookeeper-sharding-databases-tables
-spring.profiles.active=local-zookeeper-sharding-databases-tables
#spring.profiles.active=local-zookeeper-readwrite-splitting
-
-#spring.profiles.active=cloud-zookeeper-sharding-databases-tables
#spring.profiles.active=cloud-zookeeper-readwrite-splitting
#spring.profiles.active=local-zookeeper-encrypt
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
index f29f5e8dca8..019df212d1f 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_encrypt
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
index f29f5e8dca8..34f73337f5c 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_readwrite_ds
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
index f29f5e8dca8..31f7c2b27b7 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_shadow
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
index f29f5e8dca8..d45f8649eb2 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_sharding
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml
similarity index 52%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml
index 7895ab43eb3..9a14a90654e 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml
@@ -15,16 +15,36 @@
# limitations under the License.
#
-mybatis.config-location=classpath:META-INF/mybatis-config.xml
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_encrypt
+ server-lists: localhost:2181
-spring.profiles.active=local-zookeeper-sharding-databases-tables
-#spring.profiles.active=local-zookeeper-readwrite-splitting
+dataSources:
+ ds_encrypt:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
-#spring.profiles.active=cloud-zookeeper-sharding-databases-tables
-#spring.profiles.active=cloud-zookeeper-readwrite-splitting
+rules:
+- !ENCRYPT
+ tables:
+ t_order:
+ columns:
+ status:
+ cipherColumn: status
+ encryptorName: status_encryptor
+ encryptors:
+ status_encryptor:
+ type: AES
+ props:
+ aes-key-value: 123456
-#spring.profiles.active=local-zookeeper-encrypt
-#spring.profiles.active=cloud-zookeeper-encrypt
-
-#spring.profiles.active=local-zookeeper-shadow
-#spring.profiles.active=cloud-zookeeper-shadow
+props:
+ queryWithCipherColumn: true
+ sql-show: true
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml
new file mode 100644
index 00000000000..8068fbfdb6a
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_readwrite_ds
+ server-lists: localhost:2181
+
+databaseName: sharding_databases_tables
+
+dataSources:
+ write_ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_write_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ read_ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ read_ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !READWRITE_SPLITTING
+ dataSources:
+ readwrite_ds:
+ staticStrategy:
+ writeDataSourceName: write_ds
+ readDataSourceNames:
+ - read_ds_0
+ - read_ds_1
+ loadBalancerName: round_robin
+ loadBalancers:
+ round_robin:
+ type: ROUND_ROBIN
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml
new file mode 100644
index 00000000000..9f82acfe3cb
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml
@@ -0,0 +1,81 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_shadow
+ server-lists: localhost:2181
+
+dataSources:
+ ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ shadow_ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/shadow_demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !SHADOW
+ dataSources:
+ shadow_data_source:
+ productionDataSourceName: ds
+ shadowDataSourceName: shadow_ds
+ tables:
+ t_user:
+ dataSourceNames:
+ - shadow_data_source
+ shadowAlgorithmNames:
+ - user_id_insert_match_algorithm
+ - user_id_delete_match_algorithm
+ - user_id_select_match_algorithm
+ - simple_hint_algorithm
+ shadowAlgorithms:
+ user_id_insert_match_algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: insert
+ column: user_type
+ value: '1'
+ user_id_delete_match_algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: delete
+ column: user_type
+ value: '1'
+ user_id_select_match_algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: select
+ column: user_type
+ value: '1'
+ simple_hint_algorithm:
+ type: SIMPLE_HINT
+ props:
+ shadow: 'true'
+ foo: bar
+
+props:
+ sql-show: true
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml
new file mode 100644
index 00000000000..fc979df3896
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml
@@ -0,0 +1,102 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_sharding
+ server-lists: localhost:2181
+
+databaseName: sharding_databases_tables
+
+dataSources:
+ ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !SHARDING
+ tables:
+ t_order:
+ actualDataNodes: ds_$->{0..1}.t_order_$->{0..1}
+ tableStrategy:
+ standard:
+ shardingColumn: order_id
+ shardingAlgorithmName: t_order_inline
+ keyGenerateStrategy:
+ column: order_id
+ keyGeneratorName: snowflake
+ t_order_item:
+ actualDataNodes: ds_$->{0..1}.t_order_item_$->{0..1}
+ tableStrategy:
+ standard:
+ shardingColumn: order_id
+ shardingAlgorithmName: t_order_item_inline
+ keyGenerateStrategy:
+ column: order_item_id
+ keyGeneratorName: snowflake
+ bindingTables:
+ - t_order
+ - t_order_item
+ broadcastTables:
+ - t_address
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: database-inline
+
+ shardingAlgorithms:
+ database-inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_$->{user_id % 2}
+ t_order_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_order_$->{order_id % 2}
+ t_order_item_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_order_item_$->{order_id % 2}
+
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+- !ENCRYPT
+ tables:
+ t_order:
+ columns:
+ status:
+ cipherColumn: status
+ encryptorName: status-encryptor
+
+ encryptors:
+ status-encryptor:
+ type: AES
+ props:
+ aes-key-value: 123456
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/pom.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/pom.xml
index 4d26c18d0a7..bf26c8298f3 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/pom.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/pom.xml
@@ -41,7 +41,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId>
+ <artifactId>shardingsphere-jdbc-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/java/org/apache/shardingsphere/example/cluster/mode/spring/namespace/mybatis/ClusterModeSpringNamespaceMybatisExample.java b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/java/org/apache/shardingsphere/example/cluster/mode/spring/namespace/mybatis/Cluste [...]
index a4f1832444a..6ddee9eee91 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/java/org/apache/shardingsphere/example/cluster/mode/spring/namespace/mybatis/ClusterModeSpringNamespaceMybatisExample.java
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/java/org/apache/shardingsphere/example/cluster/mode/spring/namespace/mybatis/ClusterModeSpringNamespaceMybatisExample.java
@@ -28,10 +28,11 @@ import java.sql.SQLException;
public final class ClusterModeSpringNamespaceMybatisExample {
- private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
+ // TODO Fix ShardingSphereDrive cluster mode start
+// private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType shardingType = ShardingType.SHARDING_READWRITE_SPLITTING;
// private static ShardingType shardingType = ShardingType.ENCRYPT;
-// private static ShardingType shardingType = ShardingType.SHADOW;
+ private static ShardingType shardingType = ShardingType.SHADOW;
private static boolean loadConfigFromRegCenter = false;
// private static boolean loadConfigFromRegCenter = true;
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
index 05cbba12836..0407dd44785 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
@@ -20,20 +20,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
-
+ http://www.springframework.org/schema/tx/spring-tx.xsd
+ ">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <shardingsphere:data-source id="encryptDataSource">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- </shardingsphere:data-source>
+
+ <bean id="encryptDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:cloud-zookeeper-encrypt.yaml" />
+ </bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="encryptDataSource" />
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
index 817ae592465..a6a88af2db1 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
@@ -29,11 +29,11 @@
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
-
- <shardingsphere:data-source id="readWriteSplittingDataSource">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- </shardingsphere:data-source>
+
+ <bean id="readWriteSplittingDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:cloud-zookeeper-readwrite-splitting.yaml" />
+ </bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="readWriteSplittingDataSource" />
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
index 2d975ca8dcb..a5e758cf267 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
@@ -28,13 +28,12 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
-
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <shardingsphere:data-source id="shadowDataSource">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- </shardingsphere:data-source>
+ <bean id="shadowDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:cloud-zookeeper-shadow.yaml" />
+ </bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="shadowDataSource" />
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
index c8758fd1af9..49f61816d7b 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
@@ -29,12 +29,12 @@
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/datasource
http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <shardingsphere:data-source id="shardingDatabasesTablesDataSource" database-name="sharding-databases-tables">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- </shardingsphere:data-source>
+
+ <bean id="shardingDatabasesTablesDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:cloud-zookeeper-sharding-databases-tables.yaml" />
+ </bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="shardingDatabasesTablesDataSource" />
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
index dd684384191..f0b97280623 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
@@ -20,48 +20,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:encrypt="http://shardingsphere.apache.org/schema/shardingsphere/encrypt"
- xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/encrypt
- http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encrypt.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
+ ">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <bean id="demo_ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
+ <bean id="encryptDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:local-zookeeper-encrypt.yaml" />
</bean>
- <encrypt:encrypt-algorithm id="name_encryptor" type="AES">
- <props>
- <prop key="aes-key-value">123456</prop>
- </props>
- </encrypt:encrypt-algorithm>
- <encrypt:encrypt-algorithm id="pwd_encryptor" type="assistedTest" />
-
- <encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="username" cipher-column="username" encrypt-algorithm-ref="name_encryptor" />
- <encrypt:column logic-column="pwd" cipher-column="pwd" assisted-query-column="assisted_query_pwd" encrypt-algorithm-ref="pwd_encryptor" />
- </encrypt:table>
- </encrypt:rule>
-
- <shardingsphere:data-source id="encryptDataSource" data-source-names="demo_ds" rule-refs="encryptRule">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- <props>
- <prop key="sql-show">true</prop>
- </props>
- </shardingsphere:data-source>
-
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="encryptDataSource" />
</bean>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
index 327ca60e9e3..f3211ad8dfc 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
@@ -20,56 +20,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:readwrite-splitting="http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting"
- xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting
- http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting/readwrite-splitting.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
+ ">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <bean id="demo_write_ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_write_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
+ <bean id="readWriteSplittingDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:local-zookeeper-readwrite-splitting.yaml" />
</bean>
- <bean id="demo_read_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <bean id="demo_read_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <readwrite-splitting:load-balance-algorithm id="randomStrategy" type="RANDOM" />
-
- <readwrite-splitting:rule id="readWriteSplittingRule">
- <readwrite-splitting:data-source-rule id="demo_ds" load-balance-algorithm-ref="randomStrategy">
- <readwrite-splitting:static-strategy id="staticStrategy" write-data-source-name="demo_write_ds" read-data-source-names="demo_read_ds_0, demo_read_ds_1" />
- </readwrite-splitting:data-source-rule>
- </readwrite-splitting:rule>
-
- <shardingsphere:data-source id="readWriteSplittingDataSource" data-source-names="demo_write_ds, demo_read_ds_0, demo_read_ds_1" rule-refs="readWriteSplittingRule">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- <props>
- <prop key="sql-show">true</prop>
- </props>
- </shardingsphere:data-source>
-
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="readWriteSplittingDataSource" />
</bean>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
index 7028c7ea942..1c16a64cdba 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
@@ -20,82 +20,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow"
- xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/shadow
- http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
+ ">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <bean id="shadow_demo_ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/shadow_demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
+ <bean id="shadowDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:local-zookeeper-shadow.yaml" />
</bean>
-
- <bean id="demo_ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <shadow:rule id="shadowRule">
- <shadow:data-source id="shadow-data-source" source-data-source-name="demo_ds" shadow-data-source-name="shadow_demo_ds" />
- <shadow:shadow-table name="t_user" data-sources="shadow-data-source">
- <shadow:algorithm shadow-algorithm-ref="user-id-insert-match-algorithm" />
- <shadow:algorithm shadow-algorithm-ref="user-id-delete-match-algorithm" />
- <shadow:algorithm shadow-algorithm-ref="user-id-select-match-algorithm" />
- <shadow:algorithm shadow-algorithm-ref="simple-hint-algorithm" />
- </shadow:shadow-table>
- </shadow:rule>
-
- <shadow:shadow-algorithm id="user-id-insert-match-algorithm" type="REGEX_MATCH">
- <props>
- <prop key="operation">insert</prop>
- <prop key="column">user_type</prop>
- <prop key="regex">[1]</prop>
- </props>
- </shadow:shadow-algorithm>
-
- <shadow:shadow-algorithm id="user-id-delete-match-algorithm" type="REGEX_MATCH">
- <props>
- <prop key="operation">delete</prop>
- <prop key="column">user_type</prop>
- <prop key="regex">[1]</prop>
- </props>
- </shadow:shadow-algorithm>
-
- <shadow:shadow-algorithm id="user-id-select-match-algorithm" type="REGEX_MATCH">
- <props>
- <prop key="operation">select</prop>
- <prop key="column">user_type</prop>
- <prop key="regex">[1]</prop>
- </props>
- </shadow:shadow-algorithm>
-
- <shadow:shadow-algorithm id="simple-hint-algorithm" type="SIMPLE_HINT">
- <props>
- <prop key="shadow">true</prop>
- <prop key="foo">bar</prop>
- </props>
- </shadow:shadow-algorithm>
-
- <shardingsphere:data-source id="shadowDataSource" data-source-names="demo_ds,shadow_demo_ds" rule-refs="shadowRule">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- <props>
- <prop key="sql-show">true</prop>
- </props>
- </shardingsphere:data-source>
-
+
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="shadowDataSource" />
</bean>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
index 551c310171a..5bf7787a6ab 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
@@ -20,83 +20,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding"
- xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/sharding
- http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/datasource http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd">
- <import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
+ ">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
- <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8" />
- <property name="username" value="root" />
- <property name="password" value="" />
+
+ <bean id="shardingDatabasesTablesDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
+ <property name="url" value="jdbc:shardingsphere:classpath:local-zookeeper-sharding-databases-tables.yaml" />
</bean>
- <sharding:sharding-algorithm id="databaseInlineStrategyShardingAlgorithm" type="INLINE">
- <props>
- <prop key="algorithm-expression">demo_ds_${user_id % 2}</prop>
- </props>
- </sharding:sharding-algorithm>
-
- <sharding:sharding-algorithm id="orderInlineStrategyShardingAlgorithm" type="INLINE">
- <props>
- <prop key="algorithm-expression">t_order_${order_id % 2}</prop>
- </props>
- </sharding:sharding-algorithm>
-
- <sharding:sharding-algorithm id="orderItemInlineStrategyShardingAlgorithm" type="INLINE">
- <props>
- <prop key="algorithm-expression">t_order_item_${order_id % 2}</prop>
- </props>
- </sharding:sharding-algorithm>
-
- <sharding:standard-strategy id="databaseStrategy" sharding-column="user_id" algorithm-ref="databaseInlineStrategyShardingAlgorithm" />
-
- <sharding:standard-strategy id="orderTableStrategy" sharding-column="order_id" algorithm-ref="orderInlineStrategyShardingAlgorithm" />
-
- <sharding:standard-strategy id="orderItemTableStrategy" sharding-column="order_id" algorithm-ref="orderItemInlineStrategyShardingAlgorithm" />
-
- <sharding:key-generate-algorithm id="snowflakeAlgorithm" type="SNOWFLAKE">
- </sharding:key-generate-algorithm>
-
- <sharding:key-generate-strategy id="orderKeyGenerator" column="order_id" algorithm-ref="snowflakeAlgorithm" />
- <sharding:key-generate-strategy id="itemKeyGenerator" column="order_item_id" algorithm-ref="snowflakeAlgorithm" />
-
- <sharding:rule id="shardingRule">
- <sharding:table-rules>
- <sharding:table-rule logic-table="t_order" actual-data-nodes="demo_ds_${0..1}.t_order_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderTableStrategy" key-generate-strategy-ref="orderKeyGenerator" />
- <sharding:table-rule logic-table="t_order_item" actual-data-nodes="demo_ds_${0..1}.t_order_item_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderItemTableStrategy" key-generate-strategy-ref="itemKeyGenerator" />
- </sharding:table-rules>
- <sharding:binding-table-rules>
- <sharding:binding-table-rule logic-tables="t_order, t_order_item" />
- </sharding:binding-table-rules>
- <sharding:broadcast-table-rules>
- <sharding:broadcast-table-rule table="t_address" />
- </sharding:broadcast-table-rules>
- </sharding:rule>
-
- <shardingsphere:data-source id="shardingDatabasesTablesDataSource" database-name="sharding-databases-tables" data-source-names="demo_ds_0, demo_ds_1" rule-refs="shardingRule">
- <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
- <props>
- <prop key="sql-show">true</prop>
- </props>
- </shardingsphere:data-source>
-
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="shardingDatabasesTablesDataSource" />
</bean>
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
index f29f5e8dca8..019df212d1f 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-encrypt.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_encrypt
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
index f29f5e8dca8..34f73337f5c 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-readwrite-splitting.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_readwrite_ds
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
index f29f5e8dca8..31f7c2b27b7 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-shadow.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_shadow
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
similarity index 76%
copy from examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
copy to examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
index f29f5e8dca8..d45f8649eb2 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-boot-mybatis-example/src/main/resources/application-cloud-zookeeper-shadow.properties
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/cloud-zookeeper-sharding-databases-tables.yaml
@@ -15,7 +15,10 @@
# limitations under the License.
#
-spring.shardingsphere.mode.type=Cluster
-spring.shardingsphere.mode.repository.type=ZooKeeper
-spring.shardingsphere.mode.repository.props.namespace=demo_spring_boot_ds_shadow
-spring.shardingsphere.mode.repository.props.server-lists=localhost:2181
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_sharding
+ server-lists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml
new file mode 100644
index 00000000000..498e0ee9a13
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-encrypt.yaml
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_encrypt
+ server-lists: localhost:2181
+
+dataSources:
+ demo_ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !ENCRYPT
+ tables:
+ t_user:
+ columns:
+ username:
+ cipherColumn: username
+ encryptorName: name_encryptor
+ pwd:
+ cipherColumn: pwd
+ assistedQueryColumn: assisted_query_pwd
+ assistedQueryEncryptorName: assisted_encryptor
+ encryptorName: pwd_encryptor
+ encryptors:
+ name_encryptor:
+ type: AES
+ props:
+ aes-key-value: 123456
+ pwd_encryptor:
+ type: assistedTest
+ assisted_encryptor:
+ type: AES
+ props:
+ aes-key-value: 123456abc
+
+props:
+ sql-show: true
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml
new file mode 100644
index 00000000000..6c97ce20dfe
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-readwrite-splitting.yaml
@@ -0,0 +1,61 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_readwrite_ds
+ server-lists: localhost:2181
+
+dataSources:
+ write_ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_write_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ read_ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ read_ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !READWRITE_SPLITTING
+ dataSources:
+ demo_ds:
+ staticStrategy:
+ writeDataSourceName: write_ds
+ readDataSourceNames:
+ - read_ds_0
+ - read_ds_1
+ loadBalancerName: randomStrategy
+ loadBalancers:
+ randomStrategy:
+ type: RANDOM
+
+props:
+ sql-show: true
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml
new file mode 100644
index 00000000000..b3244eb0474
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-shadow.yaml
@@ -0,0 +1,81 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_shadow
+ server-lists: localhost:2181
+
+dataSources:
+ ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ shadow_ds:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/shadow_demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !SHADOW
+ dataSources:
+ shadow_data_source:
+ productionDataSourceName: ds
+ shadowDataSourceName: shadow_ds
+ tables:
+ t_user:
+ dataSourceNames:
+ - shadow_data_source
+ shadowAlgorithmNames:
+ - user_id_insert_match_algorithm
+ - user_id_delete_match_algorithm
+ - user_id_select_match_algorithm
+ - simple_hint_algorithm
+ shadowAlgorithms:
+ user_id_insert_match_algorithm:
+ type: REGEX_MATCH
+ props:
+ operation: insert
+ column: user_type
+ regex: [1]
+ user_id_delete_match_algorithm:
+ type: REGEX_MATCH
+ props:
+ operation: delete
+ column: user_type
+ regex: [1]
+ user_id_select_match_algorithm:
+ type: REGEX_MATCH
+ props:
+ operation: select
+ column: user_type
+ regex: [1]
+ simple_hint_algorithm:
+ type: SIMPLE_HINT
+ props:
+ shadow: true
+ foo: bar
+
+props:
+ sql-show: true
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml
new file mode 100644
index 00000000000..e4a2fd469a3
--- /dev/null
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-spring-namespace-mybatis-example/src/main/resources/local-zookeeper-sharding-databases-tables.yaml
@@ -0,0 +1,89 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: demo_spring_boot_ds_sharding
+ server-lists: localhost:2181
+
+dataSources:
+ demo_ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+ demo_ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password:
+
+rules:
+- !SHARDING
+ tables:
+ t_order:
+ actualDataNodes: demo_ds_$->{0..1}.t_order_$->{0..1}
+ tableStrategy:
+ standard:
+ shardingColumn: order_id
+ shardingAlgorithmName: t_order_inline
+ keyGenerateStrategy:
+ column: order_id
+ keyGeneratorName: snowflake
+ t_order_item:
+ actualDataNodes: demo_ds_$->{0..1}.t_order_item_$->{0..1}
+ tableStrategy:
+ standard:
+ shardingColumn: order_id
+ shardingAlgorithmName: t_order_item_inline
+ keyGenerateStrategy:
+ column: order_item_id
+ keyGeneratorName: snowflake
+ bindingTables:
+ - t_order,t_order_item
+ broadcastTables:
+ - t_address
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: database_inline
+
+ shardingAlgorithms:
+ database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: demo_ds_$->{user_id % 2}
+ t_order_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_order_$->{order_id % 2}
+ t_order_item_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_order_item_$->{order_id % 2}
+
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+
+props:
+ spl-show: true