update sharding-proxy 5.3.2 => 5.4.0 配置文件写法升级

2.X
疯狂的狮子Li 2 years ago
parent 6d8cc3495c
commit 83743b04b0

@ -493,7 +493,7 @@ services:
network_mode: "host" network_mode: "host"
shardingproxy: shardingproxy:
image: apache/shardingsphere-proxy:5.3.2 image: apache/shardingsphere-proxy:5.4.0
container_name: shardingsphere-proxy container_name: shardingsphere-proxy
command: server /data command: server /data
ports: ports:

@ -16,13 +16,13 @@
# #
###################################################################################################### ######################################################################################################
# #
# Here you can configure the rules for the proxy. # Here you can configure the rules for the proxy.
# This example is configuration of encrypt rule. # This example is configuration of encrypt rule.
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: encrypt_db #databaseName: encrypt_db
# #
#dataSources: #dataSources:
# ds_0: # ds_0:
@ -51,18 +51,21 @@
# type: AES # type: AES
# props: # props:
# aes-key-value: 123456abc # aes-key-value: 123456abc
# md5_encryptor: # rc4_encryptor:
# type: MD5 # type: RC4
# props:
# rc4-key-value: 123456abc
# tables: # tables:
# t_encrypt: # t_encrypt:
# columns: # columns:
# user_id: # user_id:
# plainColumn: user_plain # cipher:
# cipherColumn: user_cipher # name: user_cipher
# encryptorName: aes_encryptor # encryptorName: aes_encryptor
# order_id: # order_id:
# cipherColumn: order_encrypt # cipher:
# encryptorName: md5_encryptor # name: order_encrypt
# encryptorName: rc4_encryptor
###################################################################################################### ######################################################################################################
# #
@ -70,7 +73,7 @@
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: encrypt_db #databaseName: encrypt_db
# #
#dataSources: #dataSources:
# ds_0: # ds_0:
@ -99,15 +102,18 @@
# type: AES # type: AES
# props: # props:
# aes-key-value: 123456abc # aes-key-value: 123456abc
# md5_encryptor: # rc4_encryptor:
# type: MD5 # type: RC4
# props:
# rc4-key-value: 123456abc
# tables: # tables:
# t_encrypt: # t_encrypt:
# columns: # columns:
# user_id: # user_id:
# plainColumn: user_plain # cipher:
# cipherColumn: user_cipher # name: user_cipher
# encryptorName: aes_encryptor # encryptorName: aes_encryptor
# order_id: # order_id:
# cipherColumn: order_cipher # cipher:
# encryptorName: md5_encryptor # name: order_encrypt
# encryptorName: rc4_encryptor

@ -18,108 +18,110 @@
###################################################################################################### ######################################################################################################
# #
# Here you can configure the rules for the proxy. # Here you can configure the rules for the proxy.
# This example is configuration of HA rule. # This example is configuration of mask rule.
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: database_discovery_db #databaseName: mask_db
# #
#dataSources: #dataSources:
# primary_ds: # ds_0:
# url: jdbc:postgresql://127.0.0.1:5432/demo_primary_ds # url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0
# username: postgres
# password: postgres
# connectionTimeoutMilliseconds: 3000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50
# minPoolSize: 1
# replica_ds_0:
# url: jdbc:postgresql://127.0.0.1:5432/demo_replica_ds_0
# username: postgres # username: postgres
# password: postgres # password: postgres
# connectionTimeoutMilliseconds: 3000 # connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000 # idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000 # maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50 # maxPoolSize: 50
# minPoolSize: 1 # minPoolSize: 1
# replica_ds_1: # ds_1:
# url: jdbc:postgresql://127.0.0.1:5432/demo_replica_ds_1 # url: jdbc:postgresql://127.0.0.1:5432/demo_ds_1
# username: postgres # username: postgres
# password: postgres # password: postgres
# connectionTimeoutMilliseconds: 3000 # connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000 # idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000 # maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50 # maxPoolSize: 50
# minPoolSize: 1 # minPoolSize: 1
# #
#rules: #rules:
#- !DB_DISCOVERY #- !MASK
# dataSources: # tables:
# pr_ds: # t_user:
# dataSourceNames: # columns:
# - ds_0 # password:
# - ds_1 # maskAlgorithm: md5_mask
# - ds_2 # email:
# discoveryTypeName: mgr # maskAlgorithm: mask_before_special_chars_mask
# discoveryTypes: # telephone:
# mgr: # maskAlgorithm: keep_first_n_last_m_mask
# type: MGR #
# maskAlgorithms:
# md5_mask:
# type: MD5
# mask_before_special_chars_mask:
# type: MASK_BEFORE_SPECIAL_CHARS
# props:
# special-chars: '@'
# replace-char: '*'
# keep_first_n_last_m_mask:
# type: KEEP_FIRST_N_LAST_M
# props: # props:
# groupName: 92504d5b-6dec-11e8-91ea-246e9612aaf1 # first-n: 3
# zkServerLists: 'localhost:2181' # last-m: 4
# keepAliveCron: '0/5 * * * * ?' # replace-char: '*'
###################################################################################################### ######################################################################################################
# #
# If you want to connect to MySQL, you should manually copy MySQL driver to lib directory. # If you want to connect to MySQL, you should manually copy MySQL driver to lib directory.
# #
###################################################################################################### ######################################################################################################
#
#schemaName: database_discovery_db #databaseName: mask_db
# #
#dataSources: #dataSources:
# ds_0: # ds_0:
# url: jdbc:mysql://127.0.0.1:3306/demo_primary_ds?serverTimezone=UTC&useSSL=false # url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
# username: root # username: root
# password: # password:
# connectionTimeoutMilliseconds: 3000 # connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000 # idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000 # maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50 # maxPoolSize: 50
# minPoolSize: 1 # minPoolSize: 1
# ds_1: # ds_1:
# url: jdbc:mysql://127.0.0.1:3306/demo_replica_ds_0?serverTimezone=UTC&useSSL=false # url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
# username: root
# password:
# connectionTimeoutMilliseconds: 3000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50
# minPoolSize: 1
# ds_2:
# url: jdbc:mysql://127.0.0.1:3306/demo_replica_ds_1?serverTimezone=UTC&useSSL=false
# username: root # username: root
# password: # password:
# connectionTimeoutMilliseconds: 3000 # connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000 # idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000 # maxLifetimeMilliseconds: 1800000
# maxPoolSize: 50 # maxPoolSize: 50
# minPoolSize: 1 # minPoolSize: 1
# #
#rules: #rules:
#- !DB_DISCOVERY #- !MASK
# dataSources: # tables:
# pr_ds: # t_user:
# dataSourceNames: # columns:
# - ds_0 # password:
# - ds_1 # maskAlgorithm: md5_mask
# - ds_2 # email:
# discoveryTypeName: mgr # maskAlgorithm: mask_before_special_chars_mask
# discoveryTypes: # telephone:
# mgr: # maskAlgorithm: keep_first_n_last_m_mask
# type: MGR #
# maskAlgorithms:
# md5_mask:
# type: MD5
# mask_before_special_chars_mask:
# type: MASK_BEFORE_SPECIAL_CHARS
# props:
# special-chars: '@'
# replace-char: '*'
# keep_first_n_last_m_mask:
# type: KEEP_FIRST_N_LAST_M
# props: # props:
# groupName: 92504d5b-6dec-11e8-91ea-246e9612aaf1 # first-n: 3
# zkServerLists: 'localhost:2181' # last-m: 4
# keepAliveCron: '0/5 * * * * ?' # replace-char: '*'

@ -16,13 +16,13 @@
# #
###################################################################################################### ######################################################################################################
# #
# Here you can configure the rules for the proxy. # Here you can configure the rules for the proxy.
# This example is configuration of replica-query rule. # This example is configuration of readwrite-splitting rule.
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: readwrite_splitting_db #databaseName: readwrite_splitting_db
# #
#dataSources: #dataSources:
# primary_ds: # primary_ds:
@ -56,11 +56,15 @@
#rules: #rules:
#- !READWRITE_SPLITTING #- !READWRITE_SPLITTING
# dataSources: # dataSources:
# pr_ds: # readwrite_ds:
# writeDataSourceName: primary_ds # writeDataSourceName: primary_ds
# readDataSourceNames: # readDataSourceNames:
# - replica_ds_0 # - replica_ds_0
# - replica_ds_1 # - replica_ds_1
# loadBalancerName: random
# loadBalancers:
# random:
# type: RANDOM
###################################################################################################### ######################################################################################################
# #
@ -68,7 +72,7 @@
# #
###################################################################################################### ######################################################################################################
#schemaName: readwrite_splitting_db #databaseName: readwrite_splitting_db
# #
#dataSources: #dataSources:
# write_ds: # write_ds:
@ -102,8 +106,12 @@
#rules: #rules:
#- !READWRITE_SPLITTING #- !READWRITE_SPLITTING
# dataSources: # dataSources:
# pr_ds: # readwrite_ds:
# writeDataSourceName: write_ds # writeDataSourceName: write_ds
# readDataSourceNames: # readDataSourceNames:
# - read_ds_0 # - read_ds_0
# - read_ds_1 # - read_ds_1
# loadBalancerName: random
# loadBalancers:
# random:
# type: RANDOM

@ -16,13 +16,13 @@
# #
###################################################################################################### ######################################################################################################
# #
# Here you can configure the rules for the proxy. # Here you can configure the rules for the proxy.
# This example is configuration of shadow rule. # This example is configuration of shadow rule.
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: shadow_db #databaseName: shadow_db
# #
#dataSources: #dataSources:
# ds: # ds:
@ -46,55 +46,53 @@
# #
#rules: #rules:
#- !SHADOW #- !SHADOW
# enable: true
# dataSources: # dataSources:
# shadowDataSource: # shadowDataSource:
# sourceDataSourceName: ds # productionDataSourceName: ds
# shadowDataSourceName: shadow_ds # shadowDataSourceName: shadow_ds
# tables: # tables:
# t_order: # t_order:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# t_order_item: # t_order_item:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-update-match-algorithm # - user_id_update_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# t_address: # t_address:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# - simple-note-algorithm # - sql_hint_algorithm
# shadowAlgorithms: # shadowAlgorithms:
# user-id-insert-match-algorithm: # user_id_insert_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: insert # operation: insert
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# user-id-update-match-algorithm: # user_id_update_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: update # operation: update
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# user-id-select-match-algorithm: # user_id_select_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: select # operation: select
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# simple-note-algorithm: # sql_hint_algorithm:
# type: SIMPLE_NOTE # type: SQL_HINT
# props: # props:
# shadow: true
# foo: bar # foo: bar
###################################################################################################### ######################################################################################################
@ -103,7 +101,7 @@
# #
###################################################################################################### ######################################################################################################
# #
#schemaName: shadow_db #databaseName: shadow_db
# #
#dataSources: #dataSources:
# ds: # ds:
@ -127,53 +125,51 @@
# #
#rules: #rules:
#- !SHADOW #- !SHADOW
# enable: true
# dataSources: # dataSources:
# shadowDataSource: # shadowDataSource:
# sourceDataSourceName: ds # productionDataSourceName: ds
# shadowDataSourceName: shadow_ds # shadowDataSourceName: shadow_ds
# tables: # tables:
# t_order: # t_order:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# t_order_item: # t_order_item:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-update-match-algorithm # - user_id_update_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# t_address: # t_address:
# dataSourceNames: # dataSourceNames:
# - shadowDataSource # - shadowDataSource
# shadowAlgorithmNames: # shadowAlgorithmNames:
# - user-id-insert-match-algorithm # - user_id_insert_match_algorithm
# - user-id-select-match-algorithm # - user_id_select_match_algorithm
# - simple-note-algorithm # - sql_hint_algorithm
# shadowAlgorithms: # shadowAlgorithms:
# user-id-insert-match-algorithm: # user_id_insert_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: insert # operation: insert
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# user-id-update-match-algorithm: # user_id_update_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: update # operation: update
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# user-id-select-match-algorithm: # user_id_select_match_algorithm:
# type: COLUMN_REGEX_MATCH # type: REGEX_MATCH
# props: # props:
# operation: select # operation: select
# column: user_id # column: user_id
# regex: "[1]" # regex: "[1]"
# simple-note-algorithm: # sql_hint_algorithm:
# type: SIMPLE_NOTE # type: SQL_HINT
# props: # props:
# shadow: true
# foo: bar # foo: bar

@ -1,14 +1,32 @@
#
# 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.
# #
###################################################################################################### ######################################################################################################
schemaName: data-center_db databaseName: data-center_db
dataSources: dataSources:
ds_0: ds_0:
url: jdbc:mysql://192.168.0.60:3306/data-center_0?serverTimezone=UTC&useSSL=false url: jdbc:mysql://localhost:3306/data-center_0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root username: root
password: root password: root
connectionTimeoutMilliseconds: 30000 connectionTimeoutMilliseconds: 30000
@ -17,7 +35,7 @@ dataSources:
maxPoolSize: 50 maxPoolSize: 50
minPoolSize: 1 minPoolSize: 1
ds_1: ds_1:
url: jdbc:mysql://192.168.0.60:3306/data-center_1?serverTimezone=UTC&useSSL=false url: jdbc:mysql://localhost:3306/data-center_1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root username: root
password: root password: root
connectionTimeoutMilliseconds: 30000 connectionTimeoutMilliseconds: 30000
@ -27,58 +45,80 @@ dataSources:
minPoolSize: 1 minPoolSize: 1
rules: rules:
- !SHARDING - !SHARDING
tables: # 数据分片规则配置 tables: # 数据分片规则配置
t_order: # 订单逻辑表名称 t_order: # 订单逻辑表名称
actualDataNodes: ds_${0..1}.t_order_${0..1} actualDataNodes: ds_${0..1}.t_order_${0..1}
databaseStrategy: # 配置分库策略 databaseStrategy: # 配置分库策略
standard: standard:
shardingColumn: user_id shardingColumn: user_id
shardingAlgorithmName: database_user_inline shardingAlgorithmName: database_user_inline
tableStrategy: # 分表策略 tableStrategy: # 分表策略
standard: standard:
shardingColumn: order_id shardingColumn: order_id
shardingAlgorithmName: t_order_inline shardingAlgorithmName: t_order_inline
keyGenerateStrategy: keyGenerateStrategy:
column: order_id column: order_id
keyGeneratorName: snowflake keyGeneratorName: snowflake
t_order_item: # 子订单逻辑表名称 # auditStrategy:
actualDataNodes: ds_${0..1}.t_order_item_${0..1} # auditorNames:
databaseStrategy: # 配置分库策略 # - sharding_key_required_auditor
standard: # allowHintDisable: true
shardingColumn: user_id t_order_item: # 子订单逻辑表名称
shardingAlgorithmName: database_user_inline actualDataNodes: ds_${0..1}.t_order_item_${0..1}
tableStrategy: # 分表策略 databaseStrategy: # 配置分库策略
standard: standard:
shardingColumn: order_id shardingColumn: user_id
shardingAlgorithmName: t_order_item_inline shardingAlgorithmName: database_user_inline
keyGenerateStrategy: tableStrategy: # 分表策略
column: order_item_id standard:
keyGeneratorName: snowflake shardingColumn: order_id
bindingTables: # 绑定表规则列表 shardingAlgorithmName: t_order_item_inline
- t_order,t_order_item keyGenerateStrategy:
column: order_item_id
keyGeneratorName: snowflake
bindingTables: # 绑定表规则列表
- t_order,t_order_item
# defaultDatabaseStrategy:
# standard:
# shardingColumn: user_id
# shardingAlgorithmName: database_user_inline
# defaultTableStrategy:
# none:
# defaultAuditStrategy:
# auditorNames:
# - sharding_key_required_auditor
# allowHintDisable: true
# 分片算法配置
shardingAlgorithms:
database_user_inline:
type: INLINE
props:
algorithm-expression: ds_${user_id % 2}
t_order_inline: # 订单表分片算法名称
type: INLINE
props:
algorithm-expression: t_order_${order_id % 2}
allow-range-query-with-inline-sharding: true
t_order_item_inline: # 子订单表分片算法名称
type: INLINE
props:
algorithm-expression: t_order_item_${order_id % 2}
allow-range-query-with-inline-sharding: true
# 分布式序列算法配置
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 1
# 分片算法配置 # auditors:
shardingAlgorithms: # sharding_key_required_auditor:
database_user_inline: # type: DML_SHARDING_CONDITIONS
type: INLINE
props:
algorithm-expression: ds_${user_id % 2}
t_order_inline: # 订单表分片算法名称
type: INLINE
props:
algorithm-expression: t_order_${order_id % 2}
allow-range-query-with-inline-sharding: true
t_order_item_inline: # 子订单表分片算法名称
type: INLINE
props:
algorithm-expression: t_order_item_${order_id % 2}
allow-range-query-with-inline-sharding: true
# 分布式序列算法配置 # - !BROADCAST
keyGenerators: # tables:
snowflake: # - t_address
type: SNOWFLAKE
props:
worker-id: 1

@ -1,20 +1,27 @@
#
# 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 governance, authorization and proxy properties, please refer to this file.
# #
###################################################################################################### ######################################################################################################
#scaling: # mode:
# blockQueueSize: 10000 # 数据传输通道队列大小
# workerThread: 40 # 工作线程池大小,允许同时运行的迁移任务线程数
# clusterAutoSwitchAlgorithm:
# type: IDLE
# props:
# incremental-task-idle-minute-threshold: 30
# dataConsistencyCheckAlgorithm:
# type: DEFAULT
#
#mode:
# type: Cluster # type: Cluster
# repository: # repository:
# type: ZooKeeper # type: ZooKeeper
@ -25,37 +32,61 @@
# timeToLiveSeconds: 60 # timeToLiveSeconds: 60
# maxRetries: 3 # maxRetries: 3
# operationTimeoutMilliseconds: 500 # operationTimeoutMilliseconds: 500
# overwrite: false
# authority:
rules: users:
- !AUTHORITY - user: root@%
users: password: root
- root@%:root - user: sharding
- sharding@:sharding password: sharding
provider: privilege:
type: ALL_PRIVILEGES_PERMITTED type: ALL_PERMITTED
- !TRANSACTION
defaultType: XA transaction:
providerType: Atomikos defaultType: XA
providerType: Atomikos
sqlParser:
sqlCommentParseEnabled: false
sqlStatementCache:
initialCapacity: 2000
maximumSize: 65535
parseTreeCache:
initialCapacity: 128
maximumSize: 1024
logging:
loggers:
- loggerName: ShardingSphere-SQL
additivity: true
level: INFO
props:
enable: false
sqlFederation:
sqlFederationEnabled: false
executionPlanCache:
initialCapacity: 2000
maximumSize: 65535
props: props:
max-connections-size-per-query: 1 system-log-level: INFO
kernel-executor-size: 16 # Infinite by default. max-connections-size-per-query: 1
proxy-frontend-flush-threshold: 128 # The default value is 128. kernel-executor-size: 16 # Infinite by default.
# proxy-opentracing-enabled: false proxy-frontend-flush-threshold: 128 # The default value is 128.
# proxy-hint-enabled: false # sql-show is the same as props in logger ShardingSphere-SQL, and its priority is lower than logging rule
sql-show: true sql-show: false
# check-table-metadata-enabled: false check-table-metadata-enabled: false
# show-process-list-enabled: false # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
# # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy. # The default value is -1, which means set the minimum value for different JDBC drivers.
# # The default value is -1, which means set the minimum value for different JDBC drivers. proxy-backend-query-fetch-size: -1
# proxy-backend-query-fetch-size: -1 proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
check-duplicate-table-enabled: true proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
# sql-comment-parse-enabled: false proxy-default-port: 3307 # Proxy default port.
# proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide. proxy-netty-backlog: 1024 # Proxy netty backlog.
# # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution cdc-server-port: 33071 # CDC server port
# # if client connections are more than proxy-frontend-netty-executor-size, especially executing slow SQL. proxy-frontend-ssl-enabled: false
# proxy-backend-executor-suitable: OLAP proxy-frontend-ssl-cipher: ''
# proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation. proxy-frontend-ssl-version: TLSv1.2,TLSv1.3
# sql-federation-enabled: false

@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 使 https://blog.csdn.net/zhaozhiqiang1981/article/details/129935075 * 使
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
@RestController @RestController

@ -47,6 +47,8 @@ spring:
username: ${datasource.system-master.username} username: ${datasource.system-master.username}
password: ${datasource.system-master.password} password: ${datasource.system-master.password}
sharding: sharding:
lazy: true
type: ${spring.datasource.type}
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# shardingproxy 服务的ip地址 # shardingproxy 服务的ip地址
url: jdbc:mysql://127.0.0.1:3307/data-center_db?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true url: jdbc:mysql://127.0.0.1:3307/data-center_db?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true

Loading…
Cancel
Save