forked from apache/shardingsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docker-compose-maven-plugin for integration test (apache#5742)
* add docker-compose maven plugin * for checkstyle
- Loading branch information
1 parent
5871877
commit 65fcfe0
Showing
11 changed files
with
533 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...sphere-integration-test/shardingsphere-proxy-docker-build/src/main/resources/bin/start.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh | ||
# | ||
# 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. | ||
# | ||
|
||
SERVER_NAME=ShardingSphere-Proxy | ||
|
||
cd `dirname $0` | ||
cd .. | ||
DEPLOY_DIR=`pwd` | ||
|
||
LOGS_DIR=${DEPLOY_DIR}/logs | ||
if [ ! -d ${LOGS_DIR} ]; then | ||
mkdir ${LOGS_DIR} | ||
fi | ||
|
||
STDOUT_FILE=${LOGS_DIR}/stdout.log | ||
EXT_LIB=${DEPLOY_DIR}/ext-lib | ||
|
||
CLASS_PATH=.:${DEPLOY_DIR}/lib/*:${EXT_LIB}/* | ||
|
||
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true " | ||
|
||
JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 " | ||
|
||
MAIN_CLASS=org.apache.shardingsphere.proxy.Bootstrap | ||
|
||
echo "Starting the $SERVER_NAME ..." | ||
|
||
if [ $# == 1 ]; then | ||
MAIN_CLASS=${MAIN_CLASS}" "$1 | ||
echo "The port is $1" | ||
CLASS_PATH=../conf:${CLASS_PATH} | ||
fi | ||
|
||
if [ $# == 2 ]; then | ||
MAIN_CLASS=${MAIN_CLASS}" "$1" "$2 | ||
echo "The port is $1" | ||
echo "The configuration path is $DEPLOY_DIR/$2" | ||
CLASS_PATH=${DEPLOY_DIR}/$2:${CLASS_PATH} | ||
fi | ||
|
||
echo "The classpath is ${CLASS_PATH}" | ||
|
||
nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 & | ||
sleep 1 | ||
echo "Please check the STDOUT file: $STDOUT_FILE" |
51 changes: 51 additions & 0 deletions
51
...gsphere-integration-test/shardingsphere-proxy-docker-build/src/main/resources/bin/stop.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
# | ||
# 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. | ||
# | ||
|
||
SERVER_NAME=ShardingSphere-Proxy | ||
|
||
cd `dirname $0` | ||
cd .. | ||
DEPLOY_DIR=`pwd` | ||
|
||
PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | grep -v grep |awk '{print $2}'` | ||
if [ -z "$PIDS" ]; then | ||
echo "ERROR: The $SERVER_NAME does not started!" | ||
exit 1 | ||
fi | ||
|
||
echo -e "Stopping the $SERVER_NAME ...\c" | ||
for PID in ${PIDS} ; do | ||
kill ${PID} > /dev/null 2>&1 | ||
done | ||
|
||
COUNT=0 | ||
while [ ${COUNT} -lt 1 ]; do | ||
echo -e ".\c" | ||
sleep 1 | ||
COUNT=1 | ||
for PID in ${PIDS} ; do | ||
PID_EXIST=`ps -f -p ${PID} | grep java` | ||
if [ -n "$PID_EXIST" ]; then | ||
COUNT=0 | ||
break | ||
fi | ||
done | ||
done | ||
|
||
echo "OK!" | ||
echo "PID: $PIDS" |
198 changes: 198 additions & 0 deletions
198
...ation-test/shardingsphere-proxy-docker-build/src/main/resources/conf/config-sharding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
# | ||
# 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:postgresql://127.0.0.1:5432/demo_ds_0?serverTimezone=UTC&useSSL=false | ||
# username: postgres | ||
# password: postgres | ||
# connectionTimeoutMilliseconds: 30000 | ||
# idleTimeoutMilliseconds: 60000 | ||
# maxLifetimeMilliseconds: 1800000 | ||
# maxPoolSize: 50 | ||
# ds_1: | ||
# url: jdbc:postgresql://127.0.0.1:5432/demo_ds_1?serverTimezone=UTC&useSSL=false | ||
# username: postgres | ||
# password: postgres | ||
# connectionTimeoutMilliseconds: 30000 | ||
# idleTimeoutMilliseconds: 60000 | ||
# maxLifetimeMilliseconds: 1800000 | ||
# maxPoolSize: 50 | ||
# | ||
#rules: | ||
#- !SHARDING | ||
# tables: | ||
# t_order: | ||
# actualDataNodes: ds_${0..1}.t_order_${0..1} | ||
# tableStrategy: | ||
# standard: | ||
# shardingColumn: order_id | ||
# shardingAlgorithm: | ||
# type: INLINE | ||
# props: | ||
# algorithm.expression: t_order_${order_id % 2} | ||
# keyGenerator: | ||
# type: SNOWFLAKE | ||
# column: order_id | ||
# t_order_item: | ||
# actualDataNodes: ds_${0..1}.t_order_item_${0..1} | ||
# tableStrategy: | ||
# standard: | ||
# shardingColumn: order_id | ||
# shardingAlgorithm: | ||
# type: INLINE | ||
# props: | ||
# algorithm.expression: t_order_item_${order_id % 2} | ||
# keyGenerator: | ||
# type: SNOWFLAKE | ||
# column: order_item_id | ||
# bindingTables: | ||
# - t_order,t_order_item | ||
# defaultDatabaseStrategy: | ||
# standard: | ||
# shardingColumn: user_id | ||
# shardingAlgorithm: | ||
# type: INLINE | ||
# props: | ||
# algorithm.expression: ds_${user_id % 2} | ||
# defaultTableStrategy: | ||
# none: | ||
|
||
###################################################################################################### | ||
# | ||
# If you want to connect to MySQL, you should manually copy MySQL driver to lib directory. | ||
# | ||
###################################################################################################### | ||
|
||
schemaName: sharding_db | ||
|
||
dataSources: | ||
ds_0: | ||
url: jdbc:mysql://db.mysql:3306/db_0?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_1: | ||
url: jdbc:mysql://db.mysql:3306/db_1?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_2: | ||
url: jdbc:mysql://db.mysql:3306/db_2?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_3: | ||
url: jdbc:mysql://db.mysql:3306/db_3?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_4: | ||
url: jdbc:mysql://db.mysql:3306/db_4?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_5: | ||
url: jdbc:mysql://db.mysql:3306/db_5?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_6: | ||
url: jdbc:mysql://db.mysql:3306/db_6?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_7: | ||
url: jdbc:mysql://db.mysql:3306/db_7?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_8: | ||
url: jdbc:mysql://db.mysql:3306/db_8?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
ds_9: | ||
url: jdbc:mysql://db.mysql:3306/db_9?serverTimezone=UTC&useSSL=false | ||
username: root | ||
password: | ||
connectionTimeoutMilliseconds: 30000 | ||
idleTimeoutMilliseconds: 60000 | ||
maxLifetimeMilliseconds: 1800000 | ||
maxPoolSize: 50 | ||
rules: | ||
- !SHARDING | ||
tables: | ||
t_order: | ||
actualDataNodes: db_${0..9}.t_order | ||
databaseStrategy: | ||
standard: | ||
shardingColumn: user_id | ||
shardingAlgorithm: | ||
type: STANDARD_TEST | ||
t_order_item: | ||
actualDataNodes: db_${0..9}.t_order_item | ||
databaseStrategy: | ||
standard: | ||
shardingColumn: user_id | ||
shardingAlgorithm: | ||
type: STANDARD_TEST | ||
keyGenerator: | ||
type: CONSTANT | ||
column: item_id | ||
bindingTables: | ||
- t_order,t_order_item | ||
|
58 changes: 58 additions & 0 deletions
58
...re-integration-test/shardingsphere-proxy-docker-build/src/main/resources/conf/server.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# 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: | ||
# orchestration_ds: | ||
# orchestrationType: registry_center,config_center,metadata_center | ||
# instanceType: zookeeper | ||
# serverLists: localhost:2181 | ||
# namespace: orchestration | ||
# props: | ||
# overwrite: false | ||
# retryIntervalMilliseconds: 500 | ||
# timeToLiveSeconds: 60 | ||
# maxRetries: 3 | ||
# operationTimeoutMilliseconds: 500 | ||
# | ||
authentication: | ||
users: | ||
root: | ||
password: root | ||
sharding: | ||
password: sharding | ||
authorizedSchemas: sharding_db | ||
|
||
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 | ||
proxy.hint.enabled: false | ||
query.with.cipher.column: true | ||
sql.show: false | ||
allow.range.query.with.inline.sharding: false |
Oops, something went wrong.