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/04/05 19:20:22 UTC

[GitHub] [incubator-shardingsphere] Leinariys opened a new issue #5079: spring boot config-sharding.yml

Leinariys opened a new issue #5079: spring boot config-sharding.yml
URL: https://github.com/apache/incubator-shardingsphere/issues/5079
 
 
   Hello to all!
   How to configure sharding for spring boot so that the settings are in a separate file (config-sharding.yml), since I need to specify 30+ databases?
   I don’t want the settings to be in code.
   
   Now I have a working code "[Rule Configuration Based on Java](https://shardingsphere.apache.org/document/current/en/manual/sharding-jdbc/usage/sharding/#rule-configuration-based-on-java)"
   
   But he does not suit me.
   I consider it is necessary to make Bean setup from ShardingDataSource  "[Use Native JDBC](https://shardingsphere.apache.org/document/current/en/manual/sharding-jdbc/usage/sharding/#use-native-jdbc)"
   
   But I get an error reading the settings file.  [LOG](https://pastebin.com/RMMfBZnt)
   
   Please, help!!!
   
   dependencies {
       compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.19'
   
       compile "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion"
   
       compile group: 'org.apache.shardingsphere', name: 'sharding-jdbc-core', version: '4.0.1'
   }
   
   [DbService](https://pastebin.com/DsdLpkeg)
   [config-sharding.yml](https://pastebin.com/YnPTB0XQ)
   [TestShard](https://pastebin.com/cafJEkLM) 
   
   
   

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] kimmking closed issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

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


   


----------------------------------------------------------------
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] [incubator-shardingsphere] Leinariys commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
Leinariys commented on issue #5079: How to start spring boot  shardingsphere with settings in a separate file config-sharding.yml?  
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-611055914
 
 
   > Could you change the title for search friendly?
   
   Good name?
   Any ideas how to start? and what should be the scheme?

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] Leinariys commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

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


   > @Leinariys BTW, if you want use an original sharding.yaml just like sharding-proxy bootstrap config, you should:
   > 
   > 1. remove sharding-jdbc-spring-boot-starter(it only recognize spring boot parameters)
   > 2. add a config class implement spring boot config, or create an annotation bean, to invoke YamlShardingDataSourceFactory.createDataSource(file)
   
   Ok, https://yadi.sk/i/e_TBWlQnUN6kvA 
   as I understand it is not determined by DataSource - > MysqlDataSource 
   please, help


----------------------------------------------------------------
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] [incubator-shardingsphere] Leinariys commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
Leinariys commented on issue #5079: How to start spring boot  shardingsphere with settings in a separate file config-sharding.yml?  
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-612379681
 
 
   > It's a spring boot config issue, not sharding issue.
   > And my suggestion is:
   > 
   > 1. spilt your config whatever yml or properties to multi files with different profiles(such as p1/p2/p3/p4), you can search spring boot profiles.
   > 2. set multi profiles active as the following.
   > 
   > > --spring.profiles.active=p1,p2,p3,p4
   
   Hi, it’s not clear where the profiles are here, I’m not a springing configuration, but YamlShardingDataSourceFactory.createDataSource(file), which allows you to turn the settings file into a data source.
   Please help by showing an example with code

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] kimmking edited a comment on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #5079:
URL: https://github.com/apache/shardingsphere/issues/5079#issuecomment-643223928


   
   DataSource is a standard jdbc interface, you can use it directly.


----------------------------------------------------------------
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] [incubator-shardingsphere] Leinariys commented on issue #5079: spring boot config-sharding.yml

Posted by GitBox <gi...@apache.org>.
Leinariys commented on issue #5079: spring boot config-sharding.yml
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-611054248
 
 
   > sharding-jdbc hasn't ‘schemaName’ property, just remove it.
   
   good, but it doesn’t help start with yml settings ((

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5079: How to start spring boot  shardingsphere with settings in a separate file config-sharding.yml?  
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-615064147
 
 
   It's always clear here.
   You want to use a config-sharding.yml with spring-boot.
   
   The anwser in a simpe way:
   1. use application.yml
   2. others like the above
   3. xxx-sharding.yml may be modified a little for spring boot 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5079: How to start spring boot  shardingsphere with settings in a separate file config-sharding.yml?  
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-611379384
 
 
   It's a spring boot config issue, not sharding issue.
   And my suggestion is:
   1. spilt your config whatever yml or properties to multi files with different profiles(such as p1/p2/p3/p4), you can search spring boot profiles.
   2. set multi profiles active as the following.
   > --spring.profiles.active=p1,p2,p3,p4
   
   
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5079: How to start spring boot  shardingsphere with settings in a separate file config-sharding.yml?  
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-615066699
 
 
   @Leinariys BTW, if you want use an original sharding.yaml just like sharding-proxy bootstrap config, you should:
   1. remove sharding-jdbc-spring-boot-starter(it only recognize spring boot parameters)
   2. add a config class implement spring boot config, or create an annotation bean, to invoke YamlShardingDataSourceFactory.createDataSource(file)

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on issue #5079: spring boot config-sharding.yml

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5079: spring boot config-sharding.yml
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-610242810
 
 
   sharding-jdbc hasn't ‘schemaName’ property, just remove 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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on issue #5079: spring boot config-sharding.yml

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #5079: spring boot config-sharding.yml
URL: https://github.com/apache/incubator-shardingsphere/issues/5079#issuecomment-610175961
 
 
   Could you change the title for search friendly?

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


With regards,
Apache Git Services

[GitHub] [shardingsphere] kimmking commented on issue #5079: How to start spring boot shardingsphere with settings in a separate file config-sharding.yml?

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


   what's the MysqlDataSource?
   DataSource is a standard jdbc interface, you can use it directly.


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