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/01 01:52:34 UTC

[GitHub] [incubator-shardingsphere] Zhumingj opened a new issue #5030: How to simplify this configuration

Zhumingj opened a new issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030
 
 
   spring.shardingsphere.datasource.names=tenant-meituan,tenant-taobao,tenant-jd,tenant-common
   
   spring.shardingsphere.datasource.tenant-meituan.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-meituan.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-meituan.url=jdbc:mysql://localhost:3306/tenant_meituan
   spring.shardingsphere.datasource.tenant-meituan.username=root
   spring.shardingsphere.datasource.tenant-meituan.password=password
   
   spring.shardingsphere.datasource.tenant-taobao.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-taobao.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-taobao.url=jdbc:mysql://localhost:3306/tenant_taobao
   spring.shardingsphere.datasource.tenant-taobao.username=root
   spring.shardingsphere.datasource.tenant-taobao.password=password
   
   spring.shardingsphere.datasource.tenant-jd.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-jd.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-jd.url=jdbc:mysql://localhost:3306/tenant_jd
   spring.shardingsphere.datasource.tenant-jd.username=root
   spring.shardingsphere.datasource.tenant-jd.password=password
   
   spring.shardingsphere.datasource.tenant-common.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-common.url=jdbc:mysql://localhost:3306/tenant_common
   spring.shardingsphere.datasource.tenant-common.username=root
   spring.shardingsphere.datasource.tenant-common.password=password
   
   spring.shardingsphere.sharding.default-data-source-name=tenant-common
   
   ### hundreds of tables
   spring.shardingsphere.sharding.tables.tb_order.actual-data-nodes=tenant-meituan.tb_order,tenant-taobao.tb_order,tenant-jd.tb_order
   spring.shardingsphere.sharding.tables.tb_order_item.actual-data-nodes=tenant-meituan.tb_order_item,tenant-taobao.tb_order_item,tenant-jd.tb_order_item
   spring.shardingsphere.sharding.tables.tb_user_info.actual-data-nodes=tenant-meituan.tb_user_info,tenant-taobao.tb_user_info,tenant-jd.tb_user_info
   ......
   spring.shardingsphere.sharding.tables.tb_sys_dict.actual-data-nodes=tenant-meituan.tb_sys_dict,tenant-taobao.tb_sys_dict,tenant-jd.tb_sys_dict
   
   spring.shardingsphere.sharding.default-database-strategy.standard.sharding-column=merchant
   spring.shardingsphere.sharding.default-database-strategy.standard.precise-algorithm-class-name=com.bsi.shardingsphere.demo.algorithm.DbShardingAlgorithm
   
   spring.shardingsphere.props.sql.show=true
   
   Above are all my configurations, there's no problem, but the configuration is troublesome,because I need to config actual-data-nodes for hundreds of tables. Is there any other solution?

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-606998788
 
 
   no,  application.properties

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607020809
 
 
   spring.shardingsphere.datasource.names=tenant-meituan,tenant-taobao,tenant-jd,tenant-common
   
   spring.shardingsphere.datasource.tenant-meituan.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-meituan.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-meituan.url=jdbc:mysql://localhost:3306/tenant_meituan
   spring.shardingsphere.datasource.tenant-meituan.username=root
   spring.shardingsphere.datasource.tenant-meituan.password=password
   
   spring.shardingsphere.datasource.tenant-taobao.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-taobao.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-taobao.url=jdbc:mysql://localhost:3306/tenant_taobao
   spring.shardingsphere.datasource.tenant-taobao.username=root
   spring.shardingsphere.datasource.tenant-taobao.password=password
   
   spring.shardingsphere.datasource.tenant-jd.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-jd.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-jd.url=jdbc:mysql://localhost:3306/tenant_jd
   spring.shardingsphere.datasource.tenant-jd.username=root
   spring.shardingsphere.datasource.tenant-jd.password=password
   
   spring.shardingsphere.datasource.tenant-common.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.tenant-common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.tenant-common.url=jdbc:mysql://localhost:3306/tenant_common
   spring.shardingsphere.datasource.tenant-common.username=root
   spring.shardingsphere.datasource.tenant-common.password=password
   
   spring.shardingsphere.sharding.default-data-source-name=tenant-common
   
   hundreds of tables
   spring.shardingsphere.sharding.tables.tb_order.actual-data-nodes=tenant-meituan.tb_order,tenant-taobao.tb_order,tenant-jd.tb_order
   spring.shardingsphere.sharding.tables.tb_order_item.actual-data-nodes=tenant-meituan.tb_order_item,tenant-taobao.tb_order_item,tenant-jd.tb_order_item
   spring.shardingsphere.sharding.tables.tb_user_info.actual-data-nodes=tenant-meituan.tb_user_info,tenant-taobao.tb_user_info,tenant-jd.tb_user_info
   ......
   spring.shardingsphere.sharding.tables.tb_sys_dict.actual-data-nodes=tenant-meituan.tb_sys_dict,tenant-taobao.tb_sys_dict,tenant-jd.tb_sys_dict
   
   spring.shardingsphere.sharding.default-database-strategy.standard.sharding-column=merchant
   spring.shardingsphere.sharding.default-database-strategy.standard.precise-algorithm-class-name=com.bsi.shardingsphere.demo.algorithm.DbShardingAlgorithm
   
   spring.shardingsphere.props.sql.show=true

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607148873
 
 
   sorry , I don't know how to configure the SQL you mentioned.
   
   select group_concat(table_name) from information_schema.tables where table_schema='tenant-meituan';
   
   

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607023464
 
 
   yes, only sharding databases

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-606993642
 
 
   yaml?

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607069961
 
 
   search spring boot properties placeholder.

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607023108
 
 
   only sharding databases, no sharding tables?

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607006808
 
 
   Approach 1: Spring placeholders.
   you can config a piece of these node:
   > all-actual-data-nodes = ........
   and use a reference in the config rules:
   > xx.xx.a.t.actual-data-nodes = ${all-actual-data-nodes}
   
   Approach 2: Spring boot profiles.
   Split to multiple properties with spring profiles.
   tenant-meituan is one independent file.
   tenant-taobao is another one independent file.
   and so on.
   
   Approach 3: ShardingSphere yaml
   Use ShardingSphere yaml, you can config every tenant with a yaml file.
   tenant-meituan is 'tenant-meituan-sharding-rules.yaml' file.
   tenant-taobaois 'tenant-taobao-sharding-rules.yaml' file.
   and so on.
   

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-612777682
 
 
   @Zhumingj  This issue is out of date, we should close it now.
   And you can subscribe #5044 for further discuss, any constructive suggestion is welcome here.

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607028155
 
 
   Got it.
   You should execute:
   >  select group_concat(table_name) from information_schema.tables where table_schema='tenant-meituan';
   
   gain all tables' name.
   and then use above 'Approach 1'

----------------------------------------------------------------
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 closed issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030
 
 
   

----------------------------------------------------------------
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] tristaZero commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607000860
 
 
   @Zhumingj Hi, I rather understand your concern, actually I also think they are so dull, that is why I opened an issue to welcome anyone of you to join me to give it a better design. You can look at #5017 to learn more.
   
   Do you have any idea about `actual data nodes`? Or what are you expect?

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607019606
 
 
   Thank you,  but this doesn't completely solve my problem. I still need to config actual-data-nodes for hundreds of tables.

----------------------------------------------------------------
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 #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607019773
 
 
   Can you show a perfect configuration demo in your case?

----------------------------------------------------------------
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] Zhumingj commented on issue #5030: How to simplify this configuration

Posted by GitBox <gi...@apache.org>.
Zhumingj commented on issue #5030: How to simplify this configuration
URL: https://github.com/apache/incubator-shardingsphere/issues/5030#issuecomment-607031686
 
 
   Excuse me, can you explain it in more detail, how to combine the sql with 'Approach 1'

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