justbk2015 edited a comment on issue #12804:
URL:
https://github.com/apache/shardingsphere/issues/12804#issuecomment-929787610
> @justbk2015 This is my test configuration file, which also contains two
data sources.
>
> ```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: 123456
> connectionTimeoutMilliseconds: 30000
> idleTimeoutMilliseconds: 60000
> maxLifetimeMilliseconds: 1800000
> maxPoolSize: 50
> minPoolSize: 1
> ds_1:
> url:
jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
> username: root
> password: 123456
> connectionTimeoutMilliseconds: 30000
> idleTimeoutMilliseconds: 60000
> maxLifetimeMilliseconds: 1800000
> maxPoolSize: 50
> minPoolSize: 1
>
> 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
> keyGenerateStrategy:
> column: order_item_id
> keyGeneratorName: snowflake
> bindingTables:
> - t_order,t_order_item
> 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
> ```
which you server.yaml? is you use zookeeper?, this is my server.yaml:
-----------------
```yaml
scaling:
blockQueueSize: 10000
workerThread: 40
clusterAutoSwitchAlgorithm:
type: IDLE
props:
incremental-task-idle-minute-threshold: 1
dataConsistencyCheckAlgorithm:
type: DEFAULT
mode:
type: Cluster
repository:
type: ZooKeeper
props:
namespace: governance_ds
server-lists: localhost:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
overwrite: false
rules:
- !AUTHORITY
users:
- root@%:root
- sharding@:sharding
provider:
type: ALL_PRIVILEGES_PERMITTED
- !TRANSACTION
defaultType: XA
providerType: Atomikos
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
proxy-frontend-flush-threshold: 128 # The default value is 128.
proxy-opentracing-enabled: false
----this is my config-sharding.yaml:```
```yaml
schemaName: sharding_db
dataSources:
ds_0:
url:
jdbc:opengauss://127.0.0.1:44000/ds_0?serverTimezone=UTC&useSSL=false
username: test
password: Huawei@123
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 10
ds_1:
url:
jdbc:opengauss://127.0.0.1:44000/ds_1?serverTimezone=UTC&useSSL=false
username: test
password: Huawei@123
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 10
rules:
- !SHARDING
tables:
t1:
actualDataNodes: ds_${0..1}.t1_${0..1}
tableStrategy:
standard:
shardingColumn: ts_id
shardingAlgorithmName: ts_t1_inline
defaultDatabaseStrategy:
standard:
shardingColumn: ds_id
shardingAlgorithmName: ds_default_inline
defaultTableStrategy:
none:
shardingAlgorithms:
ds_default_inline:
type: INLINE
props:
algorithm-expression: ds_${ds_id % 2}
ts_t1_inline:
type: INLINE
props:
algorithm-expression: t1_${ts_id % 2}```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]