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 2022/05/17 02:13:53 UTC

[GitHub] [shardingsphere] fantasylion opened a new issue, #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

fantasylion opened a new issue, #17719:
URL: https://github.com/apache/shardingsphere/issues/17719

   If I want to split only the database, not the table. Do I need to configure rules for each table?Can someone help me


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] mattmok commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   Each tenant has a separate database, so I want most of the tables to only  sharding database.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] grapeqin commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   I think split database is base of split table,for example:
   two databases : ds_0 、ds_1
   
   two tables : tb0、tb1
   
   if we want to split database , we aim at tb0 split database. in this case , tb1 can not config at file,so this table is not split.
   
   we can config like this :
   ```yaml
   dataSources:
     ds_0:
       dataSourceClassName: 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: 123456
     ds_1:
       dataSourceClassName: 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: 123456
   
   rules:
   - !SHARDING
     tables:
       tb0:
         actualDataNodes: ds_${0..1}.tb0
         keyGenerateStrategy:
           column: account_id
           keyGeneratorName: snowflake
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database-inline
     defaultTableStrategy:
       none:
     
     shardingAlgorithms:
       database-inline:
         type: INLINE
         props:
           algorithm-expression: ds_${user_id % 2}
       
     keyGenerators:
       snowflake:
         type: SNOWFLAKE
   ```


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] grapeqin commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   your problem is a table with a large amount of data in any tenant?
   
   I think just split table if only resolve a large amount of data in one table.
   
   but your question is 
   
   ![image](https://user-images.githubusercontent.com/6265178/169247702-9507bb7b-5eb8-4f97-80f3-2d1888adffdd.png)
   
   Your example is inconsistent with the problem.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] terrymanu commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   > If I have 20 tables, they all have 10 child tables. Do I have to configure 20 times via yml? If so, so many configuration is so bad
   
   ShardingSphere provide the standard configuration way only. Please treat ShardingSphere as infrastructure, not a application framework.
   If user want to config lots similar shards, code generation is the better way.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] chenshun00 commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   If I have 20 tables, they all have 10 child tables. Do I have to configure 20 times via yml? If so, so many configuration is so bad


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] grapeqin commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   > > I think split database is base of split table,for example: two databases : ds_0 、ds_1
   > > two tables : tb0、tb1
   > > if we want to split database , we aim at tb0 split database. in this case , tb1 can not config at file,so this table is not split.
   > > we can config like this :
   > > ```yaml
   > > dataSources:
   > >   ds_0:
   > >     dataSourceClassName: 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: 123456
   > >   ds_1:
   > >     dataSourceClassName: 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: 123456
   > > 
   > > rules:
   > > - !SHARDING
   > >   tables:
   > >     tb0:
   > >       actualDataNodes: ds_${0..1}.tb0
   > >       keyGenerateStrategy:
   > >         column: account_id
   > >         keyGeneratorName: snowflake
   > >   defaultDatabaseStrategy:
   > >     standard:
   > >       shardingColumn: user_id
   > >       shardingAlgorithmName: database-inline
   > >   defaultTableStrategy:
   > >     none:
   > >   
   > >   shardingAlgorithms:
   > >     database-inline:
   > >       type: INLINE
   > >       props:
   > >         algorithm-expression: ds_${user_id % 2}
   > >     
   > >   keyGenerators:
   > >     snowflake:
   > >       type: SNOWFLAKE
   > > ```
   > 
   > That means, if there are 100 tables that are only sharding databases and not sharding tables, do I have to configure 100 table rules?
   
   em,can U give a practical example?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] mattmok commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   For example, a system has 10 tenants, each tenant has its own independent database, but there is a table with a large amount of data, which needs to be divided into tables.What is the best solution in this situation?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] grapeqin commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   > Each tenant has a separate database, so I want most of the tables to only sharding database.
   
   I know what u mean.  
   
   In this multi tenants scene,after my practice , we should config tables as more as you need to split only database,if someone  
   is not config,it may route a database which is not your expectation.
   
   from my perspective, shardingsphere split strategy base of tables. 
   refer to yaml split example:
   ![image](https://user-images.githubusercontent.com/6265178/169438386-6c6938ff-5fe2-4c23-b66e-da32640afffc.png)
   we must config at least one logic table.
   
   


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] mattmok commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   > I think split database is base of split table,for example: two databases : ds_0 、ds_1
   > 
   > two tables : tb0、tb1
   > 
   > if we want to split database , we aim at tb0 split database. in this case , tb1 can not config at file,so this table is not split.
   > 
   > we can config like this :
   > 
   > ```yaml
   > dataSources:
   >   ds_0:
   >     dataSourceClassName: 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: 123456
   >   ds_1:
   >     dataSourceClassName: 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: 123456
   > 
   > rules:
   > - !SHARDING
   >   tables:
   >     tb0:
   >       actualDataNodes: ds_${0..1}.tb0
   >       keyGenerateStrategy:
   >         column: account_id
   >         keyGeneratorName: snowflake
   >   defaultDatabaseStrategy:
   >     standard:
   >       shardingColumn: user_id
   >       shardingAlgorithmName: database-inline
   >   defaultTableStrategy:
   >     none:
   >   
   >   shardingAlgorithms:
   >     database-inline:
   >       type: INLINE
   >       props:
   >         algorithm-expression: ds_${user_id % 2}
   >     
   >   keyGenerators:
   >     snowflake:
   >       type: SNOWFLAKE
   > ```
   
   That means, if there are 100 tables that are only sharding databases and not sharding tables, do I have to configure 100 table rules?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] grapeqin commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   you are welcome!
   
   I suggest in this situation, you can refer to `hint` idea of shardingsphere custom your database route info,it is unnecessary to use shardingsphere middleware for too much configration.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] mattmok commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   Thank you very much for your patience! There seems to be no better solution for now。


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] TeslaCN commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   You may refer to examples. https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/sharding-example/sharding-raw-jdbc-example/src/main/resources/META-INF/sharding-databases.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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] mattmok commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   > 
   意思是如果有100张表都是只分库的时候,要配置100个表规则吗?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] terrymanu commented on issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

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

   I just close the discussion. Configuration way is in the document and example clearly, please reference.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] terrymanu closed issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #17719: If I want to split only the database, not the table. Do I need to configure rules for each table?
URL: https://github.com/apache/shardingsphere/issues/17719


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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