You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/06/27 05:40:41 UTC
[shardingsphere] branch master updated: Fix syntax error in shadow sample project configuration file (#18624)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 b1053e3556d Fix syntax error in shadow sample project configuration file (#18624)
b1053e3556d is described below
commit b1053e3556d52d985d08a39092585cc298bb8557
Author: 小马哥 <77...@users.noreply.github.com>
AuthorDate: Mon Jun 27 13:40:34 2022 +0800
Fix syntax error in shadow sample project configuration file (#18624)
* Fix syntax error in shadow sample project configuration file
* Delete root password
* Delete SQL_PARSER
---
.../resources/META-INF/zookeeper/local/shadow.yaml | 45 +++++++++++++++++++---
.../application-local-zookeeper-shadow.properties | 27 +++++++++++--
2 files changed, 63 insertions(+), 9 deletions(-)
diff --git a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
index 58bd5793904..843ff056b35 100644
--- a/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/single-feature-example/cluster-mode-example/cluster-mode-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
@@ -31,7 +31,7 @@ dataSources:
jdbcUrl: jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: root
password:
- ds_0:
+ 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
@@ -40,11 +40,44 @@ dataSources:
rules:
- !SHADOW
- column: shadow
- sourceDataSourceNames:
- - ds
- shadowDataSourceNames:
- - ds_0
+ dataSources:
+ shadowDataSource:
+ sourceDataSourceName: ds
+ shadowDataSourceName: shadow-ds
+ tables:
+ t_user:
+ dataSourceNames:
+ - shadowDataSource
+ shadowAlgorithmNames:
+ - user-id-insert-match-algorithm
+ - user-id-select-match-algorithm
+ - user-id-update-match-algorithm
+ - user-id-delete-match-algorithm
+ - simple-hint-algorithm
+ shadowAlgorithms:
+ user-id-insert-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: insert
+ column: user_type
+ value: 1
+ user-id-select-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: select
+ column: user_type
+ value: 1
+ user-id-delete-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: delete
+ 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/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 5e20db2a956..2bf8e7a8c10 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
@@ -35,8 +35,29 @@ 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.column=shadow
-spring.shardingsphere.rules.shadow.source-data-source-names=ds
-spring.shardingsphere.rules.shadow.shadow-data-source-names=shadow-ds
+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