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 96e2b1c remove nacos configCenter support (#9581)
96e2b1c is described below
commit 96e2b1c961bd2fa754ea0f5354632f74abd45181
Author: xiaoyu <[email protected]>
AuthorDate: Thu Mar 4 10:49:18 2021 +0800
remove nacos configCenter support (#9581)
* remove nacos configCenter support
---
.../governance-raw-jdbc-example/pom.xml | 9 -
.../raw/jdbc/JavaConfigurationExampleMain.java | 13 +-
.../GovernanceRepositoryConfigurationUtil.java | 14 +-
.../resources/META-INF/nacos/cloud/encrypt.yaml | 29 ----
.../META-INF/nacos/cloud/replica-query.yaml | 29 ----
.../resources/META-INF/nacos/cloud/shadow.yaml | 30 ----
.../nacos/cloud/sharding-databases-tables.yaml | 29 ----
.../resources/META-INF/nacos/local/encrypt.yaml | 55 ------
.../META-INF/nacos/local/replica-query.yaml | 60 -------
.../resources/META-INF/nacos/local/shadow.yaml | 53 ------
.../nacos/local/sharding-databases-tables.yaml | 96 -----------
.../governance-spring-boot-example/pom.xml | 9 -
.../application-cloud-nacos-encrypt.properties | 27 ---
...pplication-cloud-nacos-replica-query.properties | 27 ---
.../application-cloud-nacos-shadow.properties | 27 ---
...loud-nacos-sharding-databases-tables.properties | 27 ---
.../application-local-nacos-encrypt.properties | 41 -----
...pplication-local-nacos-replica-query.properties | 50 ------
.../application-local-nacos-shadow.properties | 45 -----
...ocal-nacos-sharding-databases-tables.properties | 71 --------
.../src/main/resources/application.properties | 15 +-
.../governance-spring-namespace-example/pom.xml | 9 -
.../governance/spring/namespace/ExampleMain.java | 1 -
.../META-INF/nacos/cloud/application-encrypt.xml | 52 ------
.../nacos/cloud/application-replica-query.xml | 51 ------
.../META-INF/nacos/cloud/application-shadow.xml | 52 ------
.../application-sharding-databases-tables.xml | 51 ------
.../META-INF/nacos/local/application-encrypt.xml | 80 ---------
.../nacos/local/application-replica-query.xml | 82 ---------
.../META-INF/nacos/local/application-shadow.xml | 71 --------
.../application-sharding-databases-tables.xml | 114 -------------
.../resources/META-INF/nacos/registry-center.xml | 40 -----
pom.xml | 2 -
.../pom.xml | 1 -
.../pom.xml | 42 -----
.../repository/nacos/NacosProperties.java | 32 ----
.../repository/nacos/NacosPropertyKey.java | 46 -----
.../repository/nacos/NacosRepository.java | 173 -------------------
...vernance.repository.api.ConfigurationRepository | 18 --
.../repository/nacos/NacosPropertiesTest.java | 46 -----
.../repository/nacos/NacosRepositoryTest.java | 187 ---------------------
.../src/test/resources/logback-test.xml | 33 ----
42 files changed, 8 insertions(+), 1931 deletions(-)
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/pom.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/pom.xml
index cbc65ff..0f5854a 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/pom.xml
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/pom.xml
@@ -47,14 +47,5 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-governance-repository-zookeeper-curator</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- <version>1.0.0</version>
- </dependency>
</dependencies>
</project>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/JavaConfigurationExampleMain.java
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/JavaConfigurationExampleMain.java
index fe378c8..de4cd1e 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/JavaConfigurationExampleMain.java
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/JavaConfigurationExampleMain.java
@@ -31,7 +31,6 @@ import
org.apache.shardingsphere.example.governance.raw.jdbc.config.local.LocalE
import
org.apache.shardingsphere.example.governance.raw.jdbc.config.local.LocalReplicaQueryConfiguration;
import
org.apache.shardingsphere.example.governance.raw.jdbc.config.local.LocalShadowConfiguration;
import
org.apache.shardingsphere.example.governance.raw.jdbc.config.local.LocalShardingDatabasesAndTablesConfiguration;
-import org.apache.shardingsphere.example.type.RegistryCenterType;
import org.apache.shardingsphere.example.type.ShardingType;
import
org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
@@ -41,7 +40,6 @@ import java.sql.SQLException;
/*
* 1. Please make sure primary replica data replication sync on MySQL is
running correctly. Otherwise this example will query empty data from replica.
* 2. Please make sure sharding-governance-center-zookeeper-curator in your
pom if registryCenterType = RegistryCenterType.ZOOKEEPER.
- * 3. Please make sure sharding-governance-center-nacos in your pom if
registryCenterType = RegistryCenterType.NACOS.
*/
public final class JavaConfigurationExampleMain {
@@ -53,9 +51,6 @@ public final class JavaConfigurationExampleMain {
private static boolean loadConfigFromRegCenter = false;
// private static boolean loadConfigFromRegCenter = true;
- private static RegistryCenterType registryCenterType =
RegistryCenterType.ZOOKEEPER;
-// private static RegistryCenterType registryCenterType =
RegistryCenterType.NACOS;
-
public static void main(final String[] args) throws Exception {
DataSource dataSource = getDataSource(shardingType,
loadConfigFromRegCenter);
try {
@@ -66,7 +61,7 @@ public final class JavaConfigurationExampleMain {
}
private static DataSource getDataSource(final ShardingType shardingType,
final boolean loadConfigFromRegCenter) throws SQLException {
- GovernanceConfiguration governanceConfig =
getGovernanceConfiguration(registryCenterType, shardingType);
+ GovernanceConfiguration governanceConfig =
getGovernanceConfiguration(shardingType);
ExampleConfiguration config;
switch (shardingType) {
case SHARDING_DATABASES_AND_TABLES:
@@ -88,10 +83,8 @@ public final class JavaConfigurationExampleMain {
return config.getDataSource();
}
- private static GovernanceConfiguration getGovernanceConfiguration(final
RegistryCenterType registryCenterType, final ShardingType shardingType) {
- return RegistryCenterType.ZOOKEEPER == registryCenterType
- ?
GovernanceRepositoryConfigurationUtil.getZooKeeperConfiguration(!loadConfigFromRegCenter,
shardingType)
- :
GovernanceRepositoryConfigurationUtil.getNacosConfiguration(!loadConfigFromRegCenter,
shardingType);
+ private static GovernanceConfiguration getGovernanceConfiguration(final
ShardingType shardingType) {
+ return
GovernanceRepositoryConfigurationUtil.getZooKeeperConfiguration(!loadConfigFromRegCenter,
shardingType);
}
private static ExampleService getExampleService(final DataSource
dataSource) {
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/GovernanceRepositoryConfigurationUtil.java
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/GovernanceRepositoryConfigurationUtil.java
index e879921..44bb256 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/GovernanceRepositoryConfigurationUtil.java
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/GovernanceRepositoryConfigurationUtil.java
@@ -27,8 +27,6 @@ public final class GovernanceRepositoryConfigurationUtil {
private static final String ZOOKEEPER_CONNECTION_STRING = "localhost:2181";
- private static final String NACOS_CONNECTION_STRING = "localhost:8848";
-
public static GovernanceConfiguration getZooKeeperConfiguration(final
boolean overwrite, final ShardingType shardingType) {
GovernanceCenterConfiguration governanceCenterConfig = new
GovernanceCenterConfiguration("ZooKeeper", ZOOKEEPER_CONNECTION_STRING, new
Properties());
switch (shardingType) {
@@ -46,21 +44,17 @@ public final class GovernanceRepositoryConfigurationUtil {
}
public static GovernanceConfiguration getNacosConfiguration(final boolean
overwrite, final ShardingType shardingType) {
- Properties nacosProperties = new Properties();
- nacosProperties.setProperty("group", "SHARDING_SPHERE_DEFAULT_GROUP");
- nacosProperties.setProperty("timeout", "3000");
- GovernanceCenterConfiguration nacosConfig = new
GovernanceCenterConfiguration("Nacos", NACOS_CONNECTION_STRING,
nacosProperties);
Properties zookeeperProperties = new Properties();
GovernanceCenterConfiguration zookeeperConfig = new
GovernanceCenterConfiguration("ZooKeeper", ZOOKEEPER_CONNECTION_STRING,
zookeeperProperties);
switch (shardingType) {
case SHARDING_DATABASES_AND_TABLES:
- return new
GovernanceConfiguration("governance-zookeeper-sharding-data-source",
zookeeperConfig, nacosConfig, overwrite);
+ return new
GovernanceConfiguration("governance-zookeeper-sharding-data-source",
zookeeperConfig, overwrite);
case REPLICA_QUERY:
- return new
GovernanceConfiguration("governance-zookeeper-replica-query-data-source",
zookeeperConfig, nacosConfig, overwrite);
+ return new
GovernanceConfiguration("governance-zookeeper-replica-query-data-source",
zookeeperConfig, overwrite);
case ENCRYPT:
- return new
GovernanceConfiguration("governance-zookeeper-encrypt-data-source",
zookeeperConfig, nacosConfig, overwrite);
+ return new
GovernanceConfiguration("governance-zookeeper-encrypt-data-source",
zookeeperConfig, overwrite);
case SHADOW:
- return new
GovernanceConfiguration("governance-zookeeper-shadow-data-source",
zookeeperConfig, nacosConfig, overwrite);
+ return new
GovernanceConfiguration("governance-zookeeper-shadow-data-source",
zookeeperConfig, overwrite);
default:
throw new
UnsupportedOperationException(shardingType.toString());
}
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
deleted file mode 100644
index 3908b9f..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-
-governance:
- name: demo_zookeeper_yaml_ds_encrypt
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: false
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/replica-query.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/replica-query.yaml
deleted file mode 100644
index 3c3d2a4..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/replica-query.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-
-governance:
- name: demo_zookeeper_yaml_pr_ds
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: false
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
deleted file mode 100644
index 19b60a9..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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.
-#
-
-governance:
- name: demo_zookeeper_yaml_ds_shadow
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- props:
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: false
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
deleted file mode 100644
index 33e8e6e..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-
-governance:
- name: demo_zookeeper_yaml_ds_sharding
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: false
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
deleted file mode 100644
index 5d9cb18..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# 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.
-#
-
-dataSources:
- unique_ds:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/demo_ds
- username: root
- password:
-
-rules:
-- !ENCRYPT
- tables:
- t_order:
- columns:
- status:
- cipherColumn: status
- encryptorName: status_encryptor
- encryptors:
- status_encryptor:
- type: AES
- props:
- aes-key-value: 123456abc
-
-props:
- query-with-cipher-column: true
- sql-show: false
-
-governance:
- name: demo_zookeeper_yaml_ds_encrypt
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: true
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/replica-query.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/replica-query.yaml
deleted file mode 100644
index e00e5a7..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/replica-query.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# 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.
-#
-
-dataSources:
- primary_ds:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/demo_primary_ds
- username: root
- password:
- replica_ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/demo_replica_ds_0
- username: root
- password:
- replica_ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/demo_replica_ds_1
- username: root
- password:
-
-rules:
-- !REPLICA_QUERY
- dataSources:
- pr_ds:
- name: pr_ds
- primaryDataSourceName: primary_ds
- replicaDataSourceNames: [replica_ds_0, replica_ds_1]
-
-props:
- sql-show: true
-
-governance:
- name: demo_zookeeper_yaml_pr_ds
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: true
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
deleted file mode 100644
index 24dd726..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# 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.
-#
-
-governance:
- name: demo_zookeeper_yaml_ds_shadow
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: false
-
-dataSources:
- ds:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/demo_ds
- username: root
- password: root
- ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl: jdbc:mysql://localhost:3306/shadow_demo_ds
- username: root
- password: root
-
-rules:
-- !SHADOW
- column: shadow
- sourceDataSourceNames:
- - ds
- shadowDataSourceNames:
- - ds_0
-props:
- sql-show: true
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
deleted file mode 100644
index 54d21a6..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# 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.
-#
-
-dataSources:
- ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl:
jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
- username: root
- password:
- ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.mysql.jdbc.Driver
- jdbcUrl:
jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
- 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
- bindingTables:
- - t_order,t_order_item
- broadcastTables:
- - t_address
-
- defaultDatabaseStrategy:
- standard:
- shardingColumn: user_id
- shardingAlgorithmName: database_inline
- defaultTableStrategy:
- none:
-
- 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
- props:
- worker-id: 123
-
-props:
- sql-show: true
-
-governance:
- name: demo_zookeeper_yaml_ds_sharding
- registryCenter:
- type: ZooKeeper
- serverLists: localhost:2181
- additionalConfigCenter:
- type: Nacos
- serverLists: localhost:8848
- props:
- group: SHARDING_SPHERE_DEFAULT_GROUP
- timeout: 3000
- overwrite: true
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/pom.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/pom.xml
index 7f11c84..3982cb0 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/pom.xml
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/pom.xml
@@ -43,15 +43,6 @@
<artifactId>shardingsphere-governance-repository-zookeeper-curator</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-encrypt.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-encrypt.properties
deleted file mode 100644
index 2894a1c..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-encrypt.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# 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.
-#GovernanceSpringBootRegistryShardingTest
-
-spring.shardingsphere.governance.name=demo1_spring_boot_ds_encrypt
-spring.shardingsphere.governance.overwrite=false
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
-spring.shardingsphere.governance.additional-config-center.props.group=SHARDING_SPHERE_DEFAULT_GROUP
-spring.shardingsphere.governance.additional-config-center.props.operationTimeoutMilliseconds=3000
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-replica-query.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-replica-query.properties
deleted file mode 100644
index 45bb28f..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-replica-query.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.governance.name=demo1_spring_boot_pr_ds
-spring.shardingsphere.governance.overwrite=false
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
-spring.shardingsphere.governance.additional-config-center.props.group=SHARDING_SPHERE_DEFAULT_GROUP
-spring.shardingsphere.governance.additional-config-center.props.operationTimeoutMilliseconds=3000
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-shadow.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-shadow.properties
deleted file mode 100644
index d4b6607..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-shadow.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.governance.name=demo1_spring_boot_ds_shadow
-spring.shardingsphere.governance.overwrite=false
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
-spring.shardingsphere.governance.additional-config-center.props.group=SHARDING_SPHERE_DEFAULT_GROUP
-spring.shardingsphere.governance.additional-config-center.props.operationTimeoutMilliseconds=3000
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties
deleted file mode 100644
index 9449bc6..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.governance.name=demo1_spring_boot_ds_sharding
-spring.shardingsphere.governance.overwrite=false
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
-spring.shardingsphere.governance.additional-config-center.group=SHARDING_SPHERE_DEFAULT_GROUP
-spring.shardingsphere.governance.additional-config-center.operationTimeoutMilliseconds=3000
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-encrypt.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-encrypt.properties
deleted file mode 100644
index ddcf591..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-encrypt.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# 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.
-#
-
-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
-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.shardingsphere.governance.name=demo1_spring_boot_ds_encrypt
-spring.shardingsphere.governance.overwrite=true
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-replica-query.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-replica-query.properties
deleted file mode 100644
index 43ce311..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-replica-query.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.datasource.names=primary_ds,replica_ds_0,replica_ds_1
-
-spring.shardingsphere.datasource.primary_ds.jdbc-url=jdbc:mysql://localhost:3306/demo_primary_ds
-spring.shardingsphere.datasource.primary_ds.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.primary_ds.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.primary_ds.username=root
-spring.shardingsphere.datasource.primary_ds.password=
-
-spring.shardingsphere.datasource.replica_ds_0.jdbc-url=jdbc:mysql://localhost:3306/demo_replica_ds_0
-spring.shardingsphere.datasource.replica_ds_0.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.replica_ds_0.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.replica_ds_0.username=root
-spring.shardingsphere.datasource.replica_ds_0.password=
-
-spring.shardingsphere.datasource.replica_ds_1.jdbc-url=jdbc:mysql://localhost:3306/demo_replica_ds_1
-spring.shardingsphere.datasource.replica_ds_1.type=com.zaxxer.hikari.HikariDataSource
-spring.shardingsphere.datasource.replica_ds_1.driver-class-name=com.mysql.jdbc.Driver
-spring.shardingsphere.datasource.replica_ds_1.username=root
-spring.shardingsphere.datasource.replica_ds_1.password=
-
-spring.shardingsphere.rules.replica-query.load-balancers.round_robin.type=ROUND_ROBIN
-spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=primary_ds
-spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=replica_ds_0,replica_ds_1
-spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round_robin
-
-spring.shardingsphere.governance.name=demo1_spring_boot_pr_ds
-spring.shardingsphere.governance.overwrite=true
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-shadow.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-shadow.properties
deleted file mode 100644
index 718043a..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-shadow.properties
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.datasource.name=shadow_ds,ds
-
-spring.shardingsphere.datasource.shadow_ds.jdbc-url=jdbc:mysql://localhost:3306/shadow_demo_ds
-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
-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.column=shadow
-spring.shardingsphere.rules.shadow.source-data-source-names=ds
-spring.shardingsphere.rules.shadow.shadow-data-source-names=shadow_ds
-
-spring.shardingsphere.props.sql-show=true
-
-spring.shardingsphere.governance.name=demo1_spring_boot_ds_shadow
-spring.shardingsphere.governance.overwrite=true
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties
deleted file mode 100644
index 1b96b3c..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# 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.
-#
-
-spring.shardingsphere.datasource.names=ds_0,ds_1
-
-spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
-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.username=root
-spring.shardingsphere.datasource.ds_0.password=
-spring.shardingsphere.datasource.ds_0.max-active=16
-
-spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
-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.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=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.sharding.key-generators.snowflake.props.worker-id=123
-
-spring.shardingsphere.governance.name=demo1_spring_boot_ds_sharding
-spring.shardingsphere.governance.overwrite=true
-
-spring.shardingsphere.governance.registry-center.type=ZooKeeper
-spring.shardingsphere.governance.registry-center.server-lists=localhost:2181
-
-spring.shardingsphere.governance.additional-config-center.type=Nacos
-spring.shardingsphere.governance.additional-config-center.server-lists=localhost:8848
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application.properties
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application.properties
index 1ad4bcb..b9595e2 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application.properties
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-boot-example/src/main/resources/application.properties
@@ -29,17 +29,4 @@
spring.profiles.active=local-zookeeper-sharding-databases-tables
#spring.profiles.active=cloud-zookeeper-encrypt
#spring.profiles.active=local-zookeeper-shadow
-#spring.profiles.active=cloud-zookeeper-shadow
-
-
-#spring.profiles.active=local-nacos-sharding-databases-tables
-#spring.profiles.active=local-nacos-replica-query
-
-#spring.profiles.active=cloud-nacos-sharding-databases-tables
-#spring.profiles.active=cloud-nacos-replica-query
-
-#spring.profiles.active=local-nacos-encrypt
-#spring.profiles.active=cloud-nacos-encrypt
-
-#spring.profiles.active=local-nacos-shadow
-#spring.profiles.active=cloud-nacos-shadow
+#spring.profiles.active=cloud-zookeeper-shadow
\ No newline at end of file
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/pom.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/pom.xml
index 3a7728c..6a26449 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/pom.xml
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/pom.xml
@@ -51,14 +51,5 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-governance-repository-zookeeper-curator</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-nacos</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- <version>1.0.0</version>
- </dependency>
</dependencies>
</project>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/governance/spring/namespace/ExampleMain.java
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/governance/spring/namespace/ExampleMain.java
index 44105c0..1e1bb3f 100644
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/governance/spring/namespace/ExampleMain.java
+++
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/governance/spring/namespace/ExampleMain.java
@@ -37,7 +37,6 @@ public final class ExampleMain {
// private static boolean loadConfigFromRegCenter = true;
private static RegistryCenterType registryCenterType =
RegistryCenterType.ZOOKEEPER;
-// private static RegistryCenterType registryCenterType =
RegistryCenterType.NACOS;
public static void main(final String[] args) throws SQLException {
try (ConfigurableApplicationContext applicationContext = new
ClassPathXmlApplicationContext(getApplicationFile())) {
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-encrypt.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-encrypt.xml
deleted file mode 100644
index 34845c3..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-encrypt.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
-
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <governance:data-source id="encryptDataSource" reg-center-ref="regCenter"
config-center-ref="confCenter" />
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="encryptDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="encryptDataSource"/>
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-replica-query.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-replica-query.xml
deleted file mode 100644
index df88fb1..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-replica-query.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <governance:data-source id="replicaQueryDataSource"
reg-center-ref="regCenter" data-source-names="" rule-refs="" />
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="replicaQueryDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="replicaQueryDataSource" />
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-shadow.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-shadow.xml
deleted file mode 100644
index 4fb8c7b..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-shadow.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
-
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <governance:data-source id="shadowDataSource" reg-center-ref="regCenter"
config-center-ref="confCenter" />
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="shadowDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="shadowDataSource"/>
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml
deleted file mode 100644
index dd992f6..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <governance:data-source id="shardingDatabasesTablesDataSource"
reg-center-ref="regCenter" rule-refs="shardingRule"/>
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-encrypt.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-encrypt.xml
deleted file mode 100644
index cc7c91b..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-encrypt.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <bean id="demo_ds_encrypt" 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"/>
- <property name="username" value="root"/>
- <property name="password" value=""/>
- </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="MD5" />
-
- <encrypt:rule id="encryptRule">
- <encrypt:table name="t_user">
- <encrypt:column logic-column="user_name" cipher-column="user_name"
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>
-
- <governance:data-source id="encryptDataSource"
data-source-names="demo_ds_encrypt" reg-center-ref="regCenter"
config-center-ref="confCenter" rule-refs="encryptRule">
- <props>
- <prop key="query-with-cipher-column">true</prop>
- </props>
- </governance:data-source>
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="encryptDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="encryptDataSource" />
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-replica-query.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-replica-query.xml
deleted file mode 100644
index 492d710..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-replica-query.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:replica-query="http://shardingsphere.apache.org/schema/shardingsphere/replica-query"
-
xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/replica-query
-
http://shardingsphere.apache.org/schema/shardingsphere/replica-query/replica-query.xsd
-
http://shardingsphere.apache.org/schema/shardingsphere/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <import resource="classpath*:META-INF/nacos/registry-center.xml" />
- <context:component-scan
base-package="org.apache.shardingsphere.example.core.mybatis" />
-
- <bean id="demo_primary_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_primary_ds" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <bean id="demo_replica_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_replica_ds_0" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <bean id="demo_replica_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_replica_ds_1" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </bean>
-
- <replica-query:load-balance-algorithm id="randomStrategy" type="RANDOM" />
-
- <replica-query:rule id="replicaQueryRule">
- <replica-query:data-source-rule id="demo_ds"
primary-data-source-name="demo_primary_ds"
replica-data-source-names="demo_replica_ds_0, demo_replica_ds_1"
load-balance-algorithm-ref="randomStrategy" />
- </replica-query:rule>
-
- <governance:data-source id="replicaQueryDataSource"
data-source-names="demo_primary_ds, demo_replica_ds_0, demo_replica_ds_1"
rule-refs="replicaQueryRule" reg-center-ref="regCenter"
config-center-ref="confCenter" />
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="replicaQueryDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="replicaQueryDataSource" />
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-shadow.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-shadow.xml
deleted file mode 100644
index 5dfbfa3..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-shadow.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <import resource="classpath*:META-INF/nacos/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" />
- <property name="username" value="root" />
- <property name="password" value="" />
- </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" />
- <property name="username" value="root" />
- <property name="password" value=""/>
- </bean>
-
- <shadow:rule id="shadowRule" column="shadow"
sourceDataSourceNames="demo_ds" shadowDataSourceNames="shadow_demo_ds"/>
-
- <governance:data-source id="shadowDataSource"
data-source-names="demo_ds,shadow_demo_ds" reg-center-ref="regCenter"
rule-refs="shadowRule"/>
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="shadowDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="shadowDataSource"/>
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml
deleted file mode 100644
index 717feda..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- 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"
-
xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding"
-
xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- 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/datasource
-
http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
-
http://shardingsphere.apache.org/schema/shardingsphere/sharding
-
http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd
-
http://shardingsphere.apache.org/schema/shardingsphere/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <import resource="classpath*:META-INF/nacos/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?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC"
/>
- <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?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC"
/>
- <property name="username" value="root" />
- <property name="password" value="" />
- </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">
- <props>
- <prop key="worker-id">123</prop>
- </props>
- </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>
-
- <governance:data-source id="shardingDatabasesTablesDataSource"
data-source-names="demo_ds_0, demo_ds_1" reg-center-ref="regCenter"
rule-refs="shardingRule"/>
-
- <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
- </bean>
- <tx:annotation-driven />
-
- <bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
- <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
- <property name="mapperLocations"
value="classpath*:META-INF/mappers/*.xml" />
- </bean>
-
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
value="org.apache.shardingsphere.example.core.mybatis.repository" />
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-</beans>
diff --git
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml
b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml
deleted file mode 100644
index 448cc51..0000000
---
a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- xmlns="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
-
http://www.springframework.org/schema/beans/spring-beans.xsd
-
http://shardingsphere.apache.org/schema/shardingsphere/governance
-
http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <governance:reg-center id="confCenter" type="Nacos"
server-lists="localhost:8848">
- <props>
- <prop key="max-retries">3</prop>
- <prop key="operation-timeout-milliseconds">3000</prop>
- </props>
- </governance:reg-center>
-
- <governance:reg-center id="regCenter" type="ZooKeeper"
server-lists="localhost:2181">
- <props>
- <prop key="max-retries">3</prop>
- <prop key="operation-timeout-milliseconds">3000</prop>
- </props>
- </governance:reg-center>
-</beans>
diff --git a/pom.xml b/pom.xml
index b289ec9..ff3908a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,8 +78,6 @@
<btm.version>2.1.3</btm.version>
<curator.version>5.1.0</curator.version>
- <apollo.client.version>1.5.0</apollo.client.version>
- <nacos.client.verison>1.1.4</nacos.client.verison>
<jetcd.version>0.5.0</jetcd.version>
<lombok.version>1.18.16</lombok.version>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
index bd9fd63..19a0e69 100644
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
+++
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
@@ -30,6 +30,5 @@
<modules>
<module>shardingsphere-governance-repository-zookeeper-curator</module>
<module>shardingsphere-governance-repository-etcd</module>
- <module>shardingsphere-governance-repository-nacos</module>
</modules>
</project>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/pom.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/pom.xml
deleted file mode 100644
index fe5af49..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-provider</artifactId>
- <version>5.0.0-RC1-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-governance-repository-nacos</artifactId>
- <name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.alibaba.nacos</groupId>
- <artifactId>nacos-client</artifactId>
- <version>${nacos.client.verison}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosProperties.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosProperties.java
deleted file mode 100644
index acd859e..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.governance.repository.nacos;
-
-import org.apache.shardingsphere.infra.properties.TypedProperties;
-
-import java.util.Properties;
-
-/**
- * Typed properties of Nacos.
- */
-public final class NacosProperties extends TypedProperties<NacosPropertyKey> {
-
- public NacosProperties(final Properties props) {
- super(NacosPropertyKey.class, props);
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosPropertyKey.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosPropertyKey.java
deleted file mode 100644
index 4b5e0bc..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosPropertyKey.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.governance.repository.nacos;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.properties.TypedPropertyKey;
-
-/**
- * Typed property key of Nacos.
- */
-@RequiredArgsConstructor
-@Getter
-public enum NacosPropertyKey implements TypedPropertyKey {
-
- /**
- * Nacos config service group name.
- */
- GROUP("group", "SHARDING_SPHERE_DEFAULT_GROUP", String.class),
-
- /**
- * Get config data timeout value.
- */
- TIMEOUT("timeout", String.valueOf(3000), long.class);
-
- private final String key;
-
- private final String defaultValue;
-
- private final Class<?> type;
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
deleted file mode 100644
index 6381dc1..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.governance.repository.nacos;
-
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.PropertyKeyConst;
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.config.listener.Listener;
-import com.alibaba.nacos.api.exception.NacosException;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.Executor;
-
-/**
- * Governance repository of Nacos.
- */
-@Slf4j
-public final class NacosRepository implements ConfigurationRepository {
-
- private ConfigService configService;
-
- private NacosProperties nacosProperties;
-
- @Getter
- @Setter
- private Properties props = new Properties();
-
- /**
- * Initialize nacos instance.
- *
- * @param config config center configuration
- */
- @Override
- public void init(final String name, final GovernanceCenterConfiguration
config) {
- try {
- nacosProperties = new NacosProperties(props);
- Properties props = new Properties();
- props.setProperty(PropertyKeyConst.SERVER_ADDR,
config.getServerLists());
- props.setProperty(PropertyKeyConst.NAMESPACE, null == name ? "" :
name);
- configService = NacosFactory.createConfigService(props);
- } catch (final NacosException ex) {
- log.error("Init nacos config center exception for: {}",
ex.toString());
- }
- }
-
- /**
- * Get data from nacos instance.
- *
- * @param key key of data
- * @return value of data
- */
- @Override
- public String get(final String key) {
- try {
- String dataId = pathToKey(key);
- String group = nacosProperties.getValue(NacosPropertyKey.GROUP);
- long timeoutMs =
nacosProperties.getValue(NacosPropertyKey.TIMEOUT);
- return configService.getConfig(dataId, group, timeoutMs);
- } catch (final NacosException ex) {
- log.debug("Nacos get config value exception for: {}",
ex.toString());
- return null;
- }
- }
-
- /**
- * Get node's sub-nodes list.
- *
- * @param key key of data
- * @return sub-nodes name list
- */
- @Override
- public List<String> getChildrenKeys(final String key) {
- return null;
- }
-
- /**
- * Persist data.
- *
- * @param key key of data
- * @param value value of data
- */
- @Override
- public void persist(final String key, final String value) {
- try {
- String dataId = pathToKey(key);
- String group = nacosProperties.getValue(NacosPropertyKey.GROUP);
- configService.publishConfig(dataId, group, value);
- } catch (final NacosException ex) {
- log.debug("Nacos persist config exception for: {}", ex.toString());
- }
- }
-
- /**
- * Watch key or path of the config server.
- *
- * @param key key of data
- * @param listener data changed event listener
- */
- @Override
- public void watch(final String key, final DataChangedEventListener
listener) {
- try {
- String dataId = pathToKey(key);
- String group = nacosProperties.getValue(NacosPropertyKey.GROUP);
- configService.addListener(dataId, group, new Listener() {
-
- @Override
- public Executor getExecutor() {
- return null;
- }
-
- @Override
- public void receiveConfigInfo(final String configInfo) {
- listener.onChange(new DataChangedEvent(key, configInfo,
Type.UPDATED));
- }
- });
- } catch (final NacosException ex) {
- log.debug("Nacos watch key exception for: {}", ex.toString());
- }
- }
-
- @Override
- public void delete(final String key) {
- try {
- String dataId = pathToKey(key);
- configService.removeConfig(dataId,
nacosProperties.getValue(NacosPropertyKey.GROUP));
- } catch (final NacosException ex) {
- log.debug("Nacos remove config exception for: {}", ex.toString());
- }
- }
-
- private String pathToKey(final String path) {
- String key = path.replace(PATH_SEPARATOR, DOT_SEPARATOR);
- return key.substring(key.indexOf(DOT_SEPARATOR) + 1);
- }
-
- @Override
- public void close() {
- }
-
- /**
- * Get algorithm type.
- *
- * @return type
- */
- @Override
- public String getType() {
- return "Nacos";
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.api.ConfigurationRepository
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/resources/META-INF/services/org.apache.shardingspher
[...]
deleted file mode 100644
index 22e529b..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.api.ConfigurationRepository
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.shardingsphere.governance.repository.nacos.NacosRepository
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosPropertiesTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosProperti
[...]
deleted file mode 100644
index 88204a8..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosPropertiesTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.governance.repository.nacos;
-
-import org.junit.Test;
-
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public final class NacosPropertiesTest {
-
- @Test
- public void assertGetValue() {
- Properties props = new Properties();
- props.setProperty(NacosPropertyKey.GROUP.getKey(),
"SHARDING_SPHERE_TEST_GROUP");
- props.setProperty(NacosPropertyKey.TIMEOUT.getKey(), "6000");
- NacosProperties actual = new NacosProperties(props);
- assertThat(actual.getValue(NacosPropertyKey.GROUP),
is("SHARDING_SPHERE_TEST_GROUP"));
- assertThat(actual.getValue(NacosPropertyKey.TIMEOUT), is(6000L));
- }
-
- @Test
- public void assertGetDefaultValue() {
- Properties props = new Properties();
- NacosProperties actual = new NacosProperties(props);
- assertThat(actual.getValue(NacosPropertyKey.GROUP),
is("SHARDING_SPHERE_DEFAULT_GROUP"));
- assertThat(actual.getValue(NacosPropertyKey.TIMEOUT), is(3000L));
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepositoryTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosReposito
[...]
deleted file mode 100644
index c21f653..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepositoryTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.governance.repository.nacos;
-
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.config.listener.Listener;
-import com.alibaba.nacos.api.exception.NacosException;
-import lombok.SneakyThrows;
-import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.AdditionalAnswers;
-import org.mockito.stubbing.VoidAnswer3;
-
-import java.lang.reflect.Field;
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public final class NacosRepositoryTest {
-
- private static final ConfigurationRepository REPOSITORY = new
NacosRepository();
-
- private final ConfigService configService = mock(ConfigService.class);
-
- private final String group = "SHARDING_SPHERE_DEFAULT_GROUP";
-
- @Before
- public void init() {
- Properties props = new Properties();
- props.setProperty("group", group);
- props.setProperty("timeout", "3000");
- GovernanceCenterConfiguration config = new
GovernanceCenterConfiguration(REPOSITORY.getType(), "127.0.0.1:8848", props);
- REPOSITORY.init("governance", config);
- setConfigService(configService);
- }
-
- @SneakyThrows(ReflectiveOperationException.class)
- private void setConfigService(final ConfigService configService) {
- Field configServiceField =
NacosRepository.class.getDeclaredField("configService");
- configServiceField.setAccessible(true);
- configServiceField.set(REPOSITORY, configService);
- }
-
- @Test
- public void assertPersist() throws NacosException {
- String value = "value";
- REPOSITORY.persist("/sharding/test", value);
- verify(configService).publishConfig("sharding.test", group, value);
- }
-
- @Test
- public void assertGet() throws NacosException {
- String value = "value";
- when(configService.getConfig(eq("sharding.test"), eq(group),
anyLong())).thenReturn(value);
- assertThat(REPOSITORY.get("/sharding/test"), is(value));
- }
-
- @Test
- public void assertWatch() throws NacosException {
- final String expectValue = "expectValue";
- String[] actualValue = {null};
-
doAnswer(AdditionalAnswers.answerVoid(getListenerAnswer(expectValue))).when(configService).addListener(anyString(),
anyString(), any(Listener.class));
- DataChangedEventListener listener = dataChangedEvent -> actualValue[0]
= dataChangedEvent.getValue();
- REPOSITORY.watch("/sharding/test", listener);
- assertThat(actualValue[0], is(expectValue));
- }
-
- @Test
- public void assertGetWithNonExistentKey() {
- assertNull(REPOSITORY.get("/sharding/nonExistentKey"));
- }
-
- @Test
- public void assertGetWhenThrowException() throws NacosException {
-
doThrow(NacosException.class).when(configService).getConfig(eq("sharding.test"),
eq(group), anyLong());
- assertNull(REPOSITORY.get("/sharding/test"));
- }
-
- @Test
- public void assertUpdate() throws NacosException {
- String updatedValue = "newValue";
- REPOSITORY.persist("/sharding/test", updatedValue);
- verify(configService).publishConfig("sharding.test", group,
updatedValue);
- }
-
- @Test
- public void assertWatchUpdatedChangedType() throws NacosException {
- final String expectValue = "expectValue";
- String[] actualValue = {null};
- Type[] actualType = {null};
-
doAnswer(AdditionalAnswers.answerVoid(getListenerAnswer(expectValue))).when(configService).addListener(anyString(),
anyString(), any(Listener.class));
- DataChangedEventListener listener = dataChangedEvent -> {
- actualValue[0] = dataChangedEvent.getValue();
- actualType[0] = dataChangedEvent.getType();
- };
- REPOSITORY.watch("/sharding/test", listener);
- assertThat(actualValue[0], is(expectValue));
- assertThat(actualType[0], is(Type.UPDATED));
- }
-
- @Test
- public void assertWatchDeletedChangedType() throws NacosException {
- Type[] actualType = {null};
-
doAnswer(AdditionalAnswers.answerVoid(getListenerAnswer(null))).when(configService).addListener(anyString(),
anyString(), any(Listener.class));
- DataChangedEventListener listener = dataChangedEvent -> actualType[0]
= dataChangedEvent.getType();
- REPOSITORY.watch("/sharding/test", listener);
- assertThat(actualType[0], is(Type.UPDATED));
- }
-
- @Test
- public void assertDelete() throws NacosException {
- REPOSITORY.delete("/sharding/test");
- verify(configService).removeConfig("sharding.test", group);
- }
-
- @Test
- public void assertDeleteWhenThrowException() throws NacosException {
- when(configService.getConfig(eq("sharding.test"), eq(group),
anyLong())).thenReturn("value");
-
doThrow(NacosException.class).when(configService).removeConfig(eq("sharding.test"),
eq(group));
- REPOSITORY.delete("/sharding/test");
- assertNotNull(REPOSITORY.get("/sharding/test"));
- }
-
- @Test
- public void assertWatchWhenThrowException() throws NacosException {
- Type[] actualType = {null};
-
doThrow(NacosException.class).when(configService).addListener(anyString(),
anyString(), any(Listener.class));
- DataChangedEventListener listener = dataChangedEvent -> actualType[0]
= dataChangedEvent.getType();
- REPOSITORY.watch("/sharding/test", listener);
- assertNull(actualType[0]);
- }
-
- @Test
- public void assertPersistWhenThrowException() throws NacosException {
- String value = "value";
-
doThrow(NacosException.class).when(configService).publishConfig(eq("sharding.test"),
eq(group), eq(value));
- REPOSITORY.persist("/sharding/test", value);
- assertNull(REPOSITORY.get("/sharding/test"));
- }
-
- @Test
- public void assertProps() {
- Properties props = new Properties();
- REPOSITORY.setProps(props);
- assertThat(REPOSITORY.getProps(), is(props));
- }
-
- @Test
- public void assertGetChildrenKeys() {
- assertNull(REPOSITORY.getChildrenKeys("/sharding/test"));
- }
-
- private VoidAnswer3 getListenerAnswer(final String expectValue) {
- return (VoidAnswer3<String, String, Listener>) (dataId, group,
listener) -> listener.receiveConfigInfo(expectValue);
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/resources/logback-test.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/resources/logback-test.xml
deleted file mode 100644
index d90fc4a..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ~ 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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="org.apache.shardingsphere" level="warn" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="error" />
- <appender-ref ref="console" />
- </root>
-</configuration>