blob: f06eaf1c633ff4e59e3d9ac562d8be7310ef80bd [file] [log] [blame]
#
# 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 encrypt rule.
#
# If you want to use encrypt, please refer to this file;
# if you want to use sharding, please refer to the config-sharding.yaml.
# if you want to use master-slave, please refer to the config-master-slave.yaml.
#
######################################################################################################
#
# If you want to connect to MySQL, you should manually copy MySQL driver to lib directory.
#
######################################################################################################
#
schemaName: sharding_master_slave_encrypt_db
dataSources:
ds_master_0:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_0
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
ds_master_0_slave_0:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_0_slave_0
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
ds_master_0_slave_1:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_0_slave_1
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
ds_master_1:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_1
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
ds_master_1_slave_0:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_1_slave_0
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
ds_master_1_slave_1:
url: jdbc:postgresql://proxy-postgresql:5432/shardingsphere?currentSchema=demo_ds_master_1_slave_1
username: postgres
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 65
shardingRule:
tables:
t_user:
actualDataNodes: ds_${0..1}.t_user_${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
tableStrategy:
inline:
shardingColumn: user_id
algorithmExpression: t_user_${user_id % 2}
keyGenerator:
type: SNOWFLAKE
column: user_id
defaultTableStrategy:
none:
defaultDatabaseStrategy:
none:
masterSlaveRules:
ds_0:
masterDataSourceName: ds_master_0
slaveDataSourceNames: [ds_master_0_slave_0, ds_master_0_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
ds_1:
masterDataSourceName: ds_master_1
slaveDataSourceNames: [ds_master_1_slave_0, ds_master_1_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
encryptRule:
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
encryptor_md5:
type: md5
tables:
t_user:
columns:
user_name:
plainColumn: user_name
cipherColumn: user_name_cipher
encryptor: encryptor_md5
pwd:
plainColumn: pwd_plain
cipherColumn: pwd_cipher
encryptor: encryptor_md5