Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharding Proxy throw NullPointerException while querying #3045

Closed
qihuajun opened this issue Sep 16, 2019 · 9 comments
Closed

Sharding Proxy throw NullPointerException while querying #3045

qihuajun opened this issue Sep 16, 2019 · 9 comments

Comments

@qihuajun
Copy link

Bug Report

Which version of ShardingSphere did you use?

latest: 4.0.0-RC2

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Sharding-Proxy

Expected behavior

Executing query without exception

Actual behavior

Almost every query I performed, though I got the query result, but there's an error log record below in log file:

[ERROR] 20:17:38.524 [ShardingSphere-Command-5] o.a.s.s.f.c.CommandExecutorTask - Exception occur:
java.lang.NullPointerException: null
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.createConnection(JDBCBackendDataSource.java:150)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:123)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionFromUnderlying(BackendConnection.java:189)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:172)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:141)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.callback.ProxyJDBCExecutePrepareCallback.getConnections(ProxyJDBCExecutePrepareCallback.java:56)
	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSQLExecuteGroups(SQLExecutePrepareTemplate.java:89)
	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSynchronizedExecuteUnitGroups(SQLExecutePrepareTemplate.java:67)
	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getExecuteUnitGroups(SQLExecutePrepareTemplate.java:59)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:78)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:95)
	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:81)
	at org.apache.shardingsphere.shardingproxy.backend.text.query.QueryBackendHandler.execute(QueryBackendHandler.java:54)
	at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:72)
	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86)
	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Just regular config, regular sql like show create table or select * from table can prouduce the error log above.

Besides this bug I reported, I also found its unfriendly for developers to use Sharding Proxy:

  1. the document about Sharding Proxy is too simple, I had to read the source code to find out how to config sharding tables with self-implemented sharding algorithm
  2. No detailed error message if schema config file has error configs, here is the error message I
    got when I start Sharding Proxy with some wrong config:
Exception in thread "main" Cannot create property=shardingRule for JavaBean=org.apache.shardingsphere.shardingproxy.config.yaml.YamlProxyRuleConfiguration@31304f14
 in 'reader', line 1, column 1:
    schemaName: mbase
    ^
Cannot create property=tables for JavaBean=org.apache.shardingsphere.core.yaml.config.sharding.YamlShardingRuleConfiguration@6302bbb1
 in 'reader', line 502, column 3:
      tables:
      ^
No single argument constructor found for class org.apache.shardingsphere.core.yaml.config.sharding.YamlTableRuleConfiguration
 in 'reader', line 503, column 5:
        brand:
        ^

 in 'reader', line 502, column 3:
      tables:
      ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:345)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141)
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127)
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
        at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:410)
        at org.apache.shardingsphere.core.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:59)
        at org.apache.shardingsphere.shardingproxy.config.ShardingConfigurationLoader.loadRuleConfiguration(ShardingConfigurationLoader.java:85)
        at org.apache.shardingsphere.shardingproxy.config.ShardingConfigurationLoader.load(ShardingConfigurationLoader.java:63)
        at org.apache.shardingsphere.shardingproxy.Bootstrap.main(Bootstrap.java:74)
Caused by: Cannot create property=tables for JavaBean=org.apache.shardingsphere.core.yaml.config.sharding.YamlShardingRuleConfiguration@6302bbb1
 in 'reader', line 502, column 3:
      tables:
      ^
No single argument constructor found for class org.apache.shardingsphere.core.yaml.config.sharding.YamlTableRuleConfiguration
 in 'reader', line 503, column 5:
        brand:
        ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)

with the error log above, I totally have no idea what's wrong in config file.

@terrymanu
Copy link
Member

Does your yaml config's format correct?

@qihuajun
Copy link
Author

Does your yaml config's format correct?

Yes. The NullPointerException occurred while Sharding Proxy running.

@sunbufu
Copy link
Contributor

sunbufu commented Sep 18, 2019

Can you show some configuration? Such as server.yaml and config-sharding.yaml.

@qihuajun
Copy link
Author

Can you show some configuration? Such as server.yaml and config-sharding.yaml.

server.yaml

authentication:
  users:
    root:
      password: root
    sharding:
      password: sharding
      authorizedSchemas: test_sharding

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
  query.with.cipher.column: true
  sql.show: false

config-sharding.yaml

schemaName: sharding

dataSources:
  sharding:
    url: jdbc:mysql://192.168.0.65:3308/sharding
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-1:
    url: jdbc:mysql://192.168.0.66:3336/sharding_relation_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-2:
    url: jdbc:mysql://192.168.0.65:3336/sharding_relation_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-3:
    url: jdbc:mysql://192.168.0.64:3336/sharding_relation_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-4:
    url: jdbc:mysql://192.168.0.66:3336/sharding_relation_04
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-5:
    url: jdbc:mysql://192.168.0.65:3336/sharding_relation_05
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-6:
    url: jdbc:mysql://192.168.0.64:3336/sharding_relation_06
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-7:
    url: jdbc:mysql://192.168.0.66:3336/sharding_relation_07
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-8:
    url: jdbc:mysql://192.168.0.65:3336/sharding_relation_08
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-9:
    url: jdbc:mysql://192.168.0.64:3336/sharding_relation_09
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-10:
    url: jdbc:mysql://192.168.0.66:3336/sharding_relation_10
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-11:
    url: jdbc:mysql://192.168.0.65:3336/sharding_relation_11
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_relation-12:
    url: jdbc:mysql://192.168.0.64:3336/sharding_relation_12
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-1:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_distributed_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-2:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_distributed_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-3:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_distributed_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-4:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_distributed_04
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-5:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_distributed_05
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-6:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_distributed_06
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-7:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_distributed_07
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-8:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_distributed_08
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-9:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_distributed_09
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-10:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_distributed_10
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-11:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_distributed_11
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  shardingreport-12:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_distributed_12
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_user:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_user
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_user_distributed-0:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_user_distributed_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_user_distributed-1:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_user_distributed_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_user_distributed-2:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_user_distributed_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_word_trend-0:
    url: jdbc:mysql://192.168.0.66:3336/sharding_report_word_trend
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_word_trend-1:
    url: jdbc:mysql://192.168.0.65:3336/sharding_report_word_trend
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_report_word_trend-2:
    url: jdbc:mysql://192.168.0.64:3336/sharding_report_word_trend
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-1:
    url: jdbc:mysql://192.168.0.66:3336/sharding_comments_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-2:
    url: jdbc:mysql://192.168.0.65:3336/sharding_comments_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-3:
    url: jdbc:mysql://192.168.0.64:3336/sharding_comments_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-4:
    url: jdbc:mysql://192.168.0.66:3336/sharding_comments_04
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-5:
    url: jdbc:mysql://192.168.0.65:3336/sharding_comments_05
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-6:
    url: jdbc:mysql://192.168.0.64:3336/sharding_comments_06
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-7:
    url: jdbc:mysql://192.168.0.66:3336/sharding_comments_07
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-8:
    url: jdbc:mysql://192.168.0.65:3336/sharding_comments_08
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-9:
    url: jdbc:mysql://192.168.0.64:3336/sharding_comments_09
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-10:
    url: jdbc:mysql://192.168.0.66:3336/sharding_comments_10
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-11:
    url: jdbc:mysql://192.168.0.65:3336/sharding_comments_11
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_comments-12:
    url: jdbc:mysql://192.168.0.64:3336/sharding_comments_12
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-1:
    url: jdbc:mysql://192.168.0.66:3336/sharding_status_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-2:
    url: jdbc:mysql://192.168.0.65:3336/sharding_status_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-3:
    url: jdbc:mysql://192.168.0.64:3336/sharding_status_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-4:
    url: jdbc:mysql://192.168.0.66:3336/sharding_status_04
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-5:
    url: jdbc:mysql://192.168.0.65:3336/sharding_status_05
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-6:
    url: jdbc:mysql://192.168.0.64:3336/sharding_status_06
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-7:
    url: jdbc:mysql://192.168.0.66:3336/sharding_status_07
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-8:
    url: jdbc:mysql://192.168.0.65:3336/sharding_status_08
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-9:
    url: jdbc:mysql://192.168.0.64:3336/sharding_status_09
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-10:
    url: jdbc:mysql://192.168.0.66:3336/sharding_status_10
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-11:
    url: jdbc:mysql://192.168.0.65:3336/sharding_status_11
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_status-12:
    url: jdbc:mysql://192.168.0.64:3336/sharding_status_12
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_fans-0:
    url: jdbc:mysql://192.168.0.66:3336/sharding_fans_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_fans-1:
    url: jdbc:mysql://192.168.0.65:3336/sharding_fans_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_fans-2:
    url: jdbc:mysql://192.168.0.64:3336/sharding_fans_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_user-0:
    url: jdbc:mysql://192.168.0.66:3336/sharding_user_01
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_user-1:
    url: jdbc:mysql://192.168.0.65:3336/sharding_user_02
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60
  sharding_user-2:
    url: jdbc:mysql://192.168.0.64:3336/sharding_user_03
    username: 
    password: 
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 3600000
    maxPoolSize: 60

shardingRule:
  tables:
    brand:
      actualDataNodes: sharding.brand
      databaseStrategy:
        none:    
    rel_brand_commodity_status:
      actualDataNodes: sharding_relation-${1..12}.rel_brand_commodity_status
    report_date_brand_weibo:
      actualDataNodes: shardingreport-${1..12}.report_date_brand_weibo
    report_topic_age:
      actualDataNodes: shardingreport-1.report_topic_age
      databaseStrategy:
        none:
    report_brand_fans_age:
      actualDataNodes: sharding_report_user.report_brand_fans_age
      databaseStrategy:
        none:
    report_brand_fans_follow:
      actualDataNodes: sharding_report_user_distributed-${0..2}.report_brand_fans_follow
      databaseStrategy:
        inline:
          shardingColumn: brandid
          algorithmExpression: sharding_report_user_distributed-${brandid % 3}
    report_commodity_user_follow:
      actualDataNodes: sharding_report_user_distributed-${0..2}.report_commodity_user_follow
      databaseStrategy:
        inline:
          shardingColumn: commodityid
          algorithmExpression: sharding_report_user_distributed-${commodityid % 3}
    report_word_trend_month_brand:
      actualDataNodes: sharding_report_word_trend-${0..2}.report_word_trend_month_brand
      databaseStrategy:
        inline:
          shardingColumn: dbindex
          algorithmExpression: sharding_report_word_trend-${dbindex % 3}
    fans:
      actualDataNodes: sharding_fans-${0..2}.fans
      databaseStrategy:
        inline:
          shardingColumn: uid
          algorithmExpression: sharding_fans-${uid % 3}
    user:
      actualDataNodes: sharding_user-${0..2}.user
      databaseStrategy:
        inline:
          shardingColumn: id
          algorithmExpression: sharding_user-${id % 3}
    status:
      actualDataNodes:sharding_status-${1..12}.status
  defaultDatabaseStrategy:
    standard:
      shardingColumn: date
      preciseAlgorithmClassName: com.custom.shardingsphere.ShardingAlgorithm.MonthPreciseShardingAlgorithm
      rangeAlgorithmClassName: com.custom.shardingsphere.ShardingAlgorithm.MonthRangeShardingAlgorithm
  defaultTableStrategy:
    none:

@sunbufu
Copy link
Contributor

sunbufu commented Sep 19, 2019

Can you try it with 4.0.0-RC3-SNAPSHOT, maybe the datasource strategy has produced a dataNode with a nonexistent datasource. You can clone the dev branch from here.

@qihuajun
Copy link
Author

Can you try it with 4.0.0-RC3-SNAPSHOT, maybe the datasource strategy has produced a dataNode with a nonexistent datasource. You can clone the dev branch from here.

Is this version product-ready?

@sunbufu
Copy link
Contributor

sunbufu commented Sep 20, 2019

We add a check for nonexistent datasource in 4.0.0-RC3-SNAPSHOT. So can you try it ?

@terrymanu
Copy link
Member

Closed for no response any more

@AI1186780944
Copy link

AI1186780944 commented Oct 31, 2020

我再docker中部署了sharding-proxy。但是启动的时候也碰见了读取yaml文件的这个问题。明明格式是正确的。但是就是报错。从一个行一个字符就开始。请问你们是如何解决的?具体详情如下:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants