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/27 10:29:39 UTC

[GitHub] [shardingsphere] lly835 opened a new issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

lly835 opened a new issue #8382:
URL: https://github.com/apache/shardingsphere/issues/8382


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   ```
   <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.3.2.RELEASE</version>
       </parent>
   
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
               <version>5.0.0-alpha</version>
   </dependency>
   ```
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ```
   # 配置真实数据源
   spring.shardingsphere.datasource.names=ds0,ds1
   
   spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.common.username=root
   spring.shardingsphere.datasource.common.password= 123456
   
   spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/ds0?serverTimezone=UTC&useSSL=false
   spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/ds1?serverTimezone=UTC&useSSL=false
   
   # 配置 t_order 表规则
   spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order$->{0..1}
   
   # 配置分库策略
   spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-column=user_id
   spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-algorithm-name=database_inline
   
   # 配置分表策略
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=table_inline
   
   # 配置 分片算法
   spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.type=INLINE
   spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props.algorithm-expression=ds_${user_id % 2}
   spring.shardingsphere.rules.sharding.sharding-algorithms.table_inline.type=INLINE
   spring.shardingsphere.rules.sharding.sharding-algorithms.table_inline.props.algorithm-expression=t_order_${order_id % 2}
   ```
   
   
   ### Expected behavior
   
   ### Actual behavior
   ```
   Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid:
   
       Invalid characters: '_'
       Reason: Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letter
   
   ```
    fix it.
   
   ```
   # 配置真实数据源
   spring.shardingsphere.datasource.names=ds0,ds1
   
   spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.common.username=root
   spring.shardingsphere.datasource.common.password= 123456
   
   spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/ds0?serverTimezone=UTC&useSSL=false
   spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/ds1?serverTimezone=UTC&useSSL=false
   
   # 配置 t_order 表规则
   spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order$->{0..1}
   
   # 配置分库策略
   spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-column=user_id
   spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-algorithm-name=databaseinline
   
   # 配置分表策略
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=tableinline
   
   # 配置 分片算法
   spring.shardingsphere.rules.sharding.sharding-algorithms.databaseinline.type=INLINE
   spring.shardingsphere.rules.sharding.sharding-algorithms.databaseinline.props.algorithm-expression=ds_${user_id % 2}
   spring.shardingsphere.rules.sharding.sharding-algorithms.tableinline.type=INLINE
   spring.shardingsphere.rules.sharding.sharding-algorithms.tableinline.props.algorithm-expression=t_order_${order_id % 2}
   ```
   
   Application run failed
   ```
   2020-11-27 18:28:08.224 ERROR 46307 --- [           main] o.s.boot.SpringApplication               : Application run failed
   
   java.lang.reflect.InvocationTargetException: null
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_251]
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_251]
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_251]
   
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
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] yu199195 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   >Examples can be used with the new version of springboot. use springboot 2.X
   https://github.com/apache/shardingsphere/blob/master/examples/pom.xml
   
   
   examples use springboot with 1.x


----------------------------------------------------------------
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] terrymanu closed issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   


----------------------------------------------------------------
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] lly835 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   SpringBoot2 has been in use for nearly three years


----------------------------------------------------------------
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] lly835 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   Examples can be used with the new version of springboot. use springboot 2.X 
   https://github.com/apache/shardingsphere/blob/master/examples/pom.xml


----------------------------------------------------------------
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] yu199195 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   >SpringBoot2 has been in use for nearly three years
   
   Does it have anything to do with it?I have given the solution, do you have any other questions。


----------------------------------------------------------------
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] lly835 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/usage/sharding/spring-boot-starter/


----------------------------------------------------------------
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] tsuixh commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   @lly835 I have the same issue, have you resolved it?


----------------------------------------------------------------
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] redesperado commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   > @lly835 I have the same issue, have you resolved it?
   Is it resolved? 


-- 
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] lly835 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   ![image](https://user-images.githubusercontent.com/2225913/100456656-b9f99c00-30fb-11eb-9fef-8ac0b92b0093.png)
   


----------------------------------------------------------------
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] yu199195 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   @lly835  you will see this #8306  #8326 


----------------------------------------------------------------
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] yu199195 commented on issue #8382: Configuration property name 'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props' is not valid

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


   @lly835  hi, if you use springboot 2.X , you config maybe with '-' , not '_' 。 for example :
   
   ```
   table-inline
   ```


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