You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/11/30 09:59:16 UTC

[GitHub] [shardingsphere] luckleemon opened a new issue #8423: how to config default database?

luckleemon opened a new issue #8423:
URL: https://github.com/apache/shardingsphere/issues/8423


   i want to config the default database, but i use the config 'default-data-source: ds_0' in yaml file,  it goes error,
   
   Exception in thread "main" Cannot create property=rules for JavaBean=org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration@57baeedf
    in 'reader', line 25, column 1:
       schemaName: sharding_db
       ^
   Cannot create property=default-data-source for JavaBean=org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration@42e26948
    in 'reader', line 44, column 3:
       - !SHARDING
         ^
   Unable to find property 'default-data-source' on class: org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration
    in 'reader', line 76, column 24:
         default-data-source: ds_0
                              ^
   
    in 'reader', line 44, column 1:
       - !SHARDING
   
   how to solve the problem?
   thank you.
   **ps : can the guide docment give us more detail information?**


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tuohai666 closed issue #8423: how to config default database?

Posted by GitBox <gi...@apache.org>.
tuohai666 closed issue #8423:
URL: https://github.com/apache/shardingsphere/issues/8423


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tuohai666 commented on issue #8423: how to config default database?

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on issue #8423:
URL: https://github.com/apache/shardingsphere/issues/8423#issuecomment-735754332


   The configuration below is based on version 5.0.0-alpha. More information please refer to: https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-jdbc-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF
   
   ```
   dataSources:
     ds_0: !!com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.jdbc.Driver
       jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password:
     ds_1: !!com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.jdbc.Driver
       jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password:
   
   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
     broadcastTables:
       - t_address
     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
   
   props:
     sql-show: false
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org