sharding 5.1.1 自定义算法规则 报错
按文档步骤,配置了一个简单的自定义路由规则
打包添加到配置文件中,启动没报错,但是执行 show tables之后,就报空指针异常错误
配置文件如下:
schemaName: sharding_db_Year
dataSources:
ds_0:
url: jdbc:mysql://10.1.50.193:3390/testdatabase_2021?serverTimezone=UTC&useSSL=false
username: root
password: ******
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
ds_1:
url: jdbc:mysql://10.1.50.193:3390/testdatabase_2022?serverTimezone=UTC&useSSL=false
username: root
password: ******
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
ds_2:
url: jdbc:mysql://10.1.50.193:3390/testdatabase_2023?serverTimezone=UTC&useSSL=false
username: root
password: ******
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
ds_3:
url: jdbc:mysql://10.1.50.193:3390/testdatabase_2024?serverTimezone=UTC&useSSL=false
username: root
password: ******
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
rules:
- !SHARDING
tables:
test_year:
actualDataNodes: ds_${0..3}.test_year
databaseStrategy:
standard:
shardingColumn: create_date
shardingAlgorithmName: database_inline
keyGenerateStrategy:
column: create_date
keyGeneratorName: snowflake
bindingTables:
- test_year
defaultDatabaseStrategy:
standard:
shardingColumn: create_date
shardingAlgorithmName: database_inline
shardingAlgorithms:
database_inline:
type: STANDDARD_DB_MODULO
props:
strategy: standard
algorithmClassName: com.demo.ShardingDatabaseModuloAlgorithm
keyGenerators:
snowflake:
type: SNOWFLAKE
scalingName: default_scaling
scaling:
default_scaling:
input:
workerThread: 40
batchSize: 1000
output:
workerThread: 40
batchSize: 1000
streamChannel:
type: MEMORY
props:
block-queue-size: 10000
completionDetector:
type: IDLE
props:
incremental-task-idle-minute-threshold: 30
dataConsistencyChecker:
type: DATA_MATCH
props:
chunk-size: 1000
场景、问题:
出现问题如下:
请大神帮忙看看