diff --git a/DISCLAIMER b/DISCLAIMER new file mode 100644 index 0000000000000000000000000000000000000000..cf7b29dc7d67457de0badafa1fa3e59898036912 --- /dev/null +++ b/DISCLAIMER @@ -0,0 +1,5 @@ +Apache ShardingSphere (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC. +Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, +communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. +While incubation status is not necessarily a reflection of the completeness or stability of the code, +it does indicate that the project has yet to be fully endorsed by the ASF. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..a77e91cee522b2b6d47e7e98d452275e1f7a42c5 --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +Apache ShardingSphere (incubating) +Copyright 2018-2019 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). diff --git a/pom.xml b/pom.xml index f53aaa82ae14f56e2d63ab46387e728f44155674..9d72f758d6629035b0bb655d9a96706ed7750873 100644 --- a/pom.xml +++ b/pom.xml @@ -491,6 +491,7 @@ + apache-shardingsphere-incubating-${project.version} kr.motd.maven diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-test/pom.xml b/sharding-core/sharding-core-parse/sharding-core-parse-test/pom.xml index 8b5877d391c76c0b45d3e89d68150841d253ca23..8f17df83f7524b2d3b0eda94e87aa778c74cb1bf 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-test/pom.xml +++ b/sharding-core/sharding-core-parse/sharding-core-parse-test/pom.xml @@ -26,6 +26,10 @@ sharding-core-parse-test ${project.artifactId} + + true + + org.apache.shardingsphere diff --git a/sharding-proxy/pom.xml b/sharding-proxy/pom.xml index 2b93a6bf89596b8654ab5c1edf74ccefb2615232..d74f022374483acd76d943faec00ec449f73ca3c 100644 --- a/sharding-proxy/pom.xml +++ b/sharding-proxy/pom.xml @@ -34,8 +34,4 @@ sharding-proxy-backend sharding-proxy-bootstrap - - - false - diff --git a/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandler.java b/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandler.java index 5a7a0cc536643784a5b34f37ce7dcbeaa98d3663..7146c39d89f0436e9e51cbaa90e2256cdfa7d1f6 100644 --- a/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandler.java +++ b/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandler.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.shardingproxy.backend.communication.DatabaseCom import org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection; import org.apache.shardingsphere.shardingproxy.backend.response.BackendResponse; import org.apache.shardingsphere.shardingproxy.backend.response.query.QueryData; +import org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchema; import org.apache.shardingsphere.shardingproxy.backend.schema.LogicSchemas; import org.apache.shardingsphere.shardingproxy.backend.text.TextProtocolBackendHandler; @@ -46,7 +47,12 @@ public final class UnicastBackendHandler implements TextProtocolBackendHandler { @Override public BackendResponse execute() { - databaseCommunicationEngine = databaseCommunicationEngineFactory.newTextProtocolInstance(LogicSchemas.getInstance().getLogicSchemas().values().iterator().next(), sql, backendConnection); + LogicSchema logicSchema = backendConnection.getLogicSchema(); + if (null == logicSchema) { + logicSchema = LogicSchemas.getInstance().getLogicSchemas().values().iterator().next(); + backendConnection.setCurrentSchema(logicSchema.getName()); + } + databaseCommunicationEngine = databaseCommunicationEngineFactory.newTextProtocolInstance(logicSchema, sql, backendConnection); return databaseCommunicationEngine.execute(); } diff --git a/sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandlerTest.java b/sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandlerTest.java index 56dd84ea85d099ad57bda776047fc94ae89d8345..c2ee64086580cbf144a5d85d98bf153bb710171f 100644 --- a/sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandlerTest.java +++ b/sharding-proxy/sharding-proxy-backend/src/test/java/org/apache/shardingsphere/shardingproxy/backend/text/admin/UnicastBackendHandlerTest.java @@ -30,6 +30,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import java.lang.reflect.Field; @@ -39,11 +40,13 @@ import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public final class UnicastBackendHandlerTest { + @Spy private BackendConnection backendConnection = new BackendConnection(TransactionType.LOCAL); @Mock @@ -61,6 +64,7 @@ public final class UnicastBackendHandlerTest { setDatabaseCommunicationEngine(backendHandler); BackendResponse actual = backendHandler.execute(); assertThat(actual, instanceOf(UpdateResponse.class)); + verify(backendConnection).setCurrentSchema(null); backendHandler.execute(); } diff --git a/sharding-proxy/sharding-proxy-bootstrap/pom.xml b/sharding-proxy/sharding-proxy-bootstrap/pom.xml index d0d0282fe111fa3ee6420bb93ff8279c2681e428..15c34803f6cdd1fceb355b4de29344e4bc90ac16 100644 --- a/sharding-proxy/sharding-proxy-bootstrap/pom.xml +++ b/sharding-proxy/sharding-proxy-bootstrap/pom.xml @@ -77,7 +77,7 @@ sharding-opentracing ${project.version} - + com.zaxxer HikariCP-java7 @@ -85,52 +85,19 @@ - ch.qos.logback - logback-classic + org.postgresql + postgresql runtime - org.postgresql - postgresql + mysql + mysql-connector-java + + + + ch.qos.logback + logback-classic runtime - - - - - maven-assembly-plugin - - ${project.parent.artifactId}-${project.parent.version} - - src/main/assembly/assembly.xml - - - - - assembly - package - - single - - - - - - com.spotify - docker-maven-plugin - - shardingsphere/sharding-proxy:4.0.0-RC1 - ${project.basedir}/src/main/docker - - - / - ${project.build.directory} - ${project.build.finalName}.tar.gz - - - - - - diff --git a/sharding-sql-test/pom.xml b/sharding-sql-test/pom.xml index 340fc462263e3d47cd81ad5af6ed05a5c2b9b17e..991186f0ff05627943fbb8f9f8cd3bb91deda88b 100644 --- a/sharding-sql-test/pom.xml +++ b/sharding-sql-test/pom.xml @@ -27,6 +27,6 @@ ${project.artifactId} - false + true diff --git a/shardingsphere-distribution/pom.xml b/shardingsphere-distribution/pom.xml index 7dd1b174cb2f2388f1805f988d1141d0c7e9ad89..4e198a9b3d05e81528e47e7852d21cfae675802c 100644 --- a/shardingsphere-distribution/pom.xml +++ b/shardingsphere-distribution/pom.xml @@ -26,252 +26,15 @@ 4.0.0 shardingsphere-distribution + pom ${project.artifactId} - false + true - - - org.apache.shardingsphere - sharding-core-api - ${project.version} - - - org.apache.shardingsphere - sharding-core-common - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-spi - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-common - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-mysql - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-postgresql - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-oracle - ${project.version} - - - org.apache.shardingsphere - sharding-core-parse-sqlserver - ${project.version} - - - org.apache.shardingsphere - sharding-core-optimize - ${project.version} - - - org.apache.shardingsphere - sharding-core-route - ${project.version} - - - org.apache.shardingsphere - sharding-core-rewrite - ${project.version} - - - org.apache.shardingsphere - sharding-core-execute - ${project.version} - - - org.apache.shardingsphere - sharding-core-merge - ${project.version} - - - org.apache.shardingsphere - sharding-core-entry - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-core - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-orchestration - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-common - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-transport-core - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-transport-mysql - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-transport-postgresql - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-frontend-spi - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-frontend-core - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-frontend-mysql - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-frontend-postgresql - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-backend - ${project.version} - - - org.apache.shardingsphere - sharding-proxy-bootstrap - ${project.version} - - - org.apache.shardingsphere - sharding-transaction-core - ${project.version} - - - org.apache.shardingsphere - sharding-transaction-xa-spi - ${project.version} - - - org.apache.shardingsphere - sharding-transaction-xa-core - ${project.version} - - - org.apache.shardingsphere - sharding-orchestration-core - ${project.version} - - - org.apache.shardingsphere - sharding-orchestration-reg-api - ${project.version} - - - org.apache.shardingsphere - sharding-orchestration-reg-zookeeper-curator - ${project.version} - - - org.apache.shardingsphere - sharding-orchestration-reg-etcd - ${project.version} - - - org.apache.shardingsphere - sharding-opentracing - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-spring-boot-starter - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-spring-namespace - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-orchestration-spring-boot-starter - ${project.version} - - - org.apache.shardingsphere - sharding-jdbc-orchestration-spring-namespace - ${project.version} - - - org.apache.shardingsphere - sharding-transaction-spring - ${project.version} - - - org.apache.shardingsphere - sharding-transaction-spring-boot-starter - ${project.version} - - - - - - release - - apache-shardingsphere-incubating-${project.version} - - - maven-assembly-plugin - - - src - package - - single - - - - src/main/assembly/source-distribution.xml - - - - - bin - package - - single - - - - src/main/assembly/binary-distribution.xml - - - - - - - - - + + shardingsphere-basic-distribution + shardingsphere-proxy-distribution + diff --git a/shardingsphere-distribution/shardingsphere-basic-distribution/pom.xml b/shardingsphere-distribution/shardingsphere-basic-distribution/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..455e3d02e80579ea253b2ab759af45b10a14cfd4 --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-basic-distribution/pom.xml @@ -0,0 +1,272 @@ + + + + + + org.apache.shardingsphere + shardingsphere-distribution + 4.0.0-RC1-SNAPSHOT + + 4.0.0 + shardingsphere-basic-distribution + ${project.artifactId} + + + + org.apache.shardingsphere + sharding-core-api + ${project.version} + + + org.apache.shardingsphere + sharding-core-common + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-spi + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-common + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-mysql + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-postgresql + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-oracle + ${project.version} + + + org.apache.shardingsphere + sharding-core-parse-sqlserver + ${project.version} + + + org.apache.shardingsphere + sharding-core-optimize + ${project.version} + + + org.apache.shardingsphere + sharding-core-route + ${project.version} + + + org.apache.shardingsphere + sharding-core-rewrite + ${project.version} + + + org.apache.shardingsphere + sharding-core-execute + ${project.version} + + + org.apache.shardingsphere + sharding-core-merge + ${project.version} + + + org.apache.shardingsphere + sharding-core-entry + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-core + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-orchestration + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-common + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-transport-core + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-transport-mysql + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-transport-postgresql + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-frontend-spi + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-frontend-core + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-frontend-mysql + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-frontend-postgresql + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-backend + ${project.version} + + + org.apache.shardingsphere + sharding-proxy-bootstrap + ${project.version} + + + org.apache.shardingsphere + sharding-transaction-core + ${project.version} + + + org.apache.shardingsphere + sharding-transaction-xa-spi + ${project.version} + + + org.apache.shardingsphere + sharding-transaction-xa-core + ${project.version} + + + org.apache.shardingsphere + sharding-orchestration-core + ${project.version} + + + org.apache.shardingsphere + sharding-orchestration-reg-api + ${project.version} + + + org.apache.shardingsphere + sharding-orchestration-reg-zookeeper-curator + ${project.version} + + + org.apache.shardingsphere + sharding-orchestration-reg-etcd + ${project.version} + + + org.apache.shardingsphere + sharding-opentracing + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-spring-boot-starter + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-spring-namespace + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-orchestration-spring-boot-starter + ${project.version} + + + org.apache.shardingsphere + sharding-jdbc-orchestration-spring-namespace + ${project.version} + + + org.apache.shardingsphere + sharding-transaction-spring + ${project.version} + + + org.apache.shardingsphere + sharding-transaction-spring-boot-starter + ${project.version} + + + + + + release + + + + maven-assembly-plugin + + + src + package + + single + + + + src/main/assembly/source-distribution.xml + + + + + bin + package + + single + + + + src/main/assembly/binary-distribution.xml + + + + + + + + + + diff --git a/shardingsphere-distribution/src/main/assembly/binary-distribution.xml b/shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/binary-distribution.xml similarity index 89% rename from shardingsphere-distribution/src/main/assembly/binary-distribution.xml rename to shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/binary-distribution.xml index 9193599b113816dc0fcd18d902a19090865da362..539929423dce9f5fa9efde9d7740e99cf85ed649 100644 --- a/shardingsphere-distribution/src/main/assembly/binary-distribution.xml +++ b/shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/binary-distribution.xml @@ -22,12 +22,15 @@ zip true + ${project.build.finalName}-bin-release - ../ + ../../ LICENSE + NOTICE + DISCLAIMER @@ -37,7 +40,6 @@ true false /lib - runtime org.apache.shardingsphere:* diff --git a/shardingsphere-distribution/src/main/assembly/source-distribution.xml b/shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/source-distribution.xml similarity index 94% rename from shardingsphere-distribution/src/main/assembly/source-distribution.xml rename to shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/source-distribution.xml index aa3a1f99d4832fe65fb4438dd23c22c486874c65..7a170f55f71ec377e0f42546de6c208e37c9f2c9 100644 --- a/shardingsphere-distribution/src/main/assembly/source-distribution.xml +++ b/shardingsphere-distribution/shardingsphere-basic-distribution/src/main/assembly/source-distribution.xml @@ -22,17 +22,18 @@ zip true + ${project.build.finalName}-src-release - ../ + ../../ true **/* - .github + **/.github/** **/*.md .travis.yml diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..953aa051c39bc98b01bcbe646211294d8fe4de78 --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml @@ -0,0 +1,103 @@ + + + + + + org.apache.shardingsphere + shardingsphere-distribution + 4.0.0-RC1-SNAPSHOT + + 4.0.0 + shardingsphere-proxy-distribution + ${project.artifactId} + + + + org.apache.shardingsphere + sharding-proxy-bootstrap + ${project.version} + + + + com.zaxxer + HikariCP-java7 + compile + + + + org.postgresql + postgresql + runtime + + + + ch.qos.logback + logback-classic + runtime + + + + + + + com.spotify + docker-maven-plugin + + shardingsphere/sharding-proxy:4.0.0-RC1 + ${project.basedir}/src/main/docker + + + / + ${project.build.directory} + ${project.build.finalName}.tar.gz + + + + + + + + + + release + + + + maven-assembly-plugin + + + src/main/assembly/proxy-distribution.xml + + + + + sharding-proxy + package + + single + + + + + + + + + \ No newline at end of file diff --git a/sharding-proxy/sharding-proxy-bootstrap/src/main/assembly/assembly.xml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/assembly/proxy-distribution.xml similarity index 85% rename from sharding-proxy/sharding-proxy-bootstrap/src/main/assembly/assembly.xml rename to shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/assembly/proxy-distribution.xml index d770efff43f2d761662accecc0b6bf4ff63f3834..224be5fac749f3f0f914e0c5c7d2feec0481e04d 100644 --- a/sharding-proxy/sharding-proxy-bootstrap/src/main/assembly/assembly.xml +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/assembly/proxy-distribution.xml @@ -17,11 +17,12 @@ - assembly + sharding-proxy tar.gz true + ${project.build.finalName}-sharding-proxy @@ -43,6 +44,14 @@ conf 0644 + + ../../ + + LICENSE + NOTICE + DISCLAIMER + + diff --git a/sharding-proxy/sharding-proxy-bootstrap/src/main/docker/Dockerfile b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/docker/Dockerfile similarity index 85% rename from sharding-proxy/sharding-proxy-bootstrap/src/main/docker/Dockerfile rename to shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/docker/Dockerfile index bac3d68ac90c84c5477957080034943dadb8c958..d2b6238f84b41775983086706fa7d18843e892a8 100644 --- a/sharding-proxy/sharding-proxy-bootstrap/src/main/docker/Dockerfile +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/docker/Dockerfile @@ -18,6 +18,6 @@ FROM java:7 MAINTAINER caohao "caohaoch@gmail.com" -ADD sharding-proxy-4.0.0-RC1.tar.gz / -RUN mv /sharding-proxy-4.0.0-RC1 /opt/sharding-proxy +ADD apache-shardingsphere-incubating-4.0.0-RC1-sharding-proxy.tar.gz / +RUN mv /apache-shardingsphere-incubating-4.0.0-RC1-sharding-proxy /opt/sharding-proxy ENTRYPOINT /opt/sharding-proxy/bin/start.sh $PORT && tail -f /opt/sharding-proxy/logs/stdout.log diff --git a/sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/start.bat b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/start.bat similarity index 100% rename from sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/start.bat rename to shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/start.bat diff --git a/sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/start.sh b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/start.sh similarity index 100% rename from sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/start.sh rename to shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/start.sh diff --git a/sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/stop.sh b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/stop.sh similarity index 100% rename from sharding-proxy/sharding-proxy-bootstrap/src/main/resources/bin/stop.sh rename to shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/stop.sh diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-master_slave.yaml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-master_slave.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bf261d29559f69181a39a556cb7318bc56481ace --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-master_slave.yaml @@ -0,0 +1,61 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +###################################################################################################### +# +# Here you can configure the rules for the proxy. +# This example is configuration of master-slave rule. +# +# If you want to use master-slave, please refer to this file; +# if you want to use sharding, please refer to the config-sharding.yaml. +# +###################################################################################################### +# +#schemaName: master_slave_db +# +#dataSources: +# master_ds: +# url: jdbc:mysql://127.0.0.1:3306/demo_ds_master?serverTimezone=UTC&useSSL=false +# username: root +# password: +# connectionTimeoutMilliseconds: 30000 +# idleTimeoutMilliseconds: 60000 +# maxLifetimeMilliseconds: 1800000 +# maxPoolSize: 50 +# slave_ds_0: +# url: jdbc:mysql://127.0.0.1:3306/demo_ds_slave_0?serverTimezone=UTC&useSSL=false +# username: root +# password: +# connectionTimeoutMilliseconds: 30000 +# idleTimeoutMilliseconds: 60000 +# maxLifetimeMilliseconds: 1800000 +# maxPoolSize: 50 +# slave_ds_1: +# url: jdbc:mysql://127.0.0.1:3306/demo_ds_slave_1?serverTimezone=UTC&useSSL=false +# username: root +# password: +# connectionTimeoutMilliseconds: 30000 +# idleTimeoutMilliseconds: 60000 +# maxLifetimeMilliseconds: 1800000 +# maxPoolSize: 50 +# +#masterSlaveRule: +# name: ms_ds +# masterDataSourceName: master_ds +# slaveDataSourceNames: +# - slave_ds_0 +# - slave_ds_1 diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-sharding.yaml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-sharding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1c6106c8306efcb6bfbcabc860dfe85d0c549d1b --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/config-sharding.yaml @@ -0,0 +1,75 @@ +# +# 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. +# + +###################################################################################################### +# +# Here you can configure the rules for the proxy. +# This example is configuration of sharding rule. +# +# If you want to use sharding, please refer to this file; +# if you want to use master-slave, please refer to the config-master_slave.yaml. +# +###################################################################################################### +# +#schemaName: sharding_db +# +#dataSources: +# ds_0: +# url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false +# username: root +# password: +# connectionTimeoutMilliseconds: 30000 +# idleTimeoutMilliseconds: 60000 +# maxLifetimeMilliseconds: 1800000 +# maxPoolSize: 50 +# ds_1: +# url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false +# username: root +# password: +# connectionTimeoutMilliseconds: 30000 +# idleTimeoutMilliseconds: 60000 +# maxLifetimeMilliseconds: 1800000 +# maxPoolSize: 50 +# +#shardingRule: +# tables: +# t_order: +# actualDataNodes: ds_${0..1}.t_order_${0..1} +# tableStrategy: +# inline: +# shardingColumn: order_id +# algorithmExpression: t_order_${order_id % 2} +# keyGenerator: +# type: SNOWFLAKE +# column: order_id +# t_order_item: +# actualDataNodes: ds_${0..1}.t_order_item_${0..1} +# tableStrategy: +# inline: +# shardingColumn: order_id +# algorithmExpression: t_order_item_${order_id % 2} +# keyGenerator: +# type: SNOWFLAKE +# column: order_item_id +# bindingTables: +# - t_order,t_order_item +# defaultDatabaseStrategy: +# inline: +# shardingColumn: user_id +# algorithmExpression: ds_${user_id % 2} +# defaultTableStrategy: +# none: diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f774cb6bb13cb84937ba6c7f83aa0cf3218e8cc0 --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml @@ -0,0 +1,45 @@ +# +# 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. +# + +###################################################################################################### +# +# If you want to configure orchestration, authorization and proxy properties, please refer to this file. +# +###################################################################################################### + +#orchestration: +# name: orchestration_ds +# overwrite: true +# registry: +# serverLists: localhost:2181 +# namespace: orchestration +# +#authentication: +# username: root +# password: root +# +#props: +# max.connections.size.per.query: 1 +# acceptor.size: 16 # The default value is available processors count * 2. +# executor.size: 16 # Infinite by default. +# proxy.frontend.flush.threshold: 128 # The default value is 128. +# # LOCAL: Proxy will run with LOCAL transaction. +# # XA: Proxy will run with XA transaction. +# # BASE: Proxy will run with B.A.S.E transaction. +# proxy.transaction.type: LOCAL +# proxy.opentracing.enabled: false +# sql.show: false diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/logback.xml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/logback.xml new file mode 100644 index 0000000000000000000000000000000000000000..9caaafba2ea3b9dbca47af44abc3e536cacd2ae4 --- /dev/null +++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/logback.xml @@ -0,0 +1,33 @@ + + + + + + + [%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n + + + + + + + + + + +