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 2021/10/09 07:20:30 UTC

[GitHub] [shardingsphere] zhaochong-byte opened a new issue #12950: How to configure a sub-table with multiple tables

zhaochong-byte opened a new issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950


   我的pom是:
    <dependency>
         <groupId>org.apache.shardingsphere</groupId>
         <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
         <version>5.0.0-beta</version>
       </dependency>
   单表的配置是:
   spring:
     shardingsphere:
       datasource:
         names: zc
         zc:
           type: com.zaxxer.hikari.HikariDataSource
           jdbc-url: jdbc:mysql://localhost:3306/zc?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC
           driver-class-name: com.mysql.cj.jdbc.Driver
           username: root
           password: root
       rules:
         sharding:
           tables:
             device_log:
               actual-data-nodes: zc.device_log_$->{1..3}
       table-strategy:
         standard:
           sharding-column: company_code
           sharding-algorithm-name: table-inline
       sharding-algorithms:
         table-inline:
           type: INLINE
           props:
             algorithm-expression: device_log_$->{company_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.

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

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



[GitHub] [shardingsphere] zhaochong-byte closed issue #12950: 请问多表的分表要如何配置

Posted by GitBox <gi...@apache.org>.
zhaochong-byte closed issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950


   


-- 
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] zhaochong-byte removed a comment on issue #12950: 请问多表的分表要如何配置

Posted by GitBox <gi...@apache.org>.
zhaochong-byte removed a comment on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-939210612


   > 我的pom是: org.apache.shardingsphere shardingsphere-jdbc-core-spring-boot-starter 5.0.0-beta 单表的配置是: spring: shardingsphere: # 数据源配置 datasource: # 数据源名称,多数据源以逗号分隔 names: zc # zc: type: com.zaxxer.hikari.HikariDataSource jdbc-url: jdbc:mysql://localhost:3306/zc?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root # 规则配置 rules: sharding: tables: # 逻辑表名称 device_log: # 行表达式标识符可以使用 ${...} 或 $->{...},但前者与 Spring 本身的属性文件占位符冲突,因此在 Spring 环境中使用行表达式标识符建议使用 $->{...} actual-data-nodes: zc.device_log_$->{1..3} # 分表策略 table-strategy: standard: # 分片列名称 sharding-column: company_code # 分片算法名称 sharding-algorithm-name: table-inline # 表主�
 �算法
   > 
   > # key-generate-strategy:
   > # column: id
   > # key-generator-name: snowflake
   > ```
   > # 分片算法配置
   > sharding-algorithms:
   >   table-inline:
   >     # 分片算法类型
   >     type: INLINE
   >     props:
   >       # 分片算法的行表达式
   >       algorithm-expression: device_log_$->{company_code}
   > ```
   
   > jpa: database: mysql database-platform: org.hibernate.dialect.MySQL57Dialect hibernate: ddl-auto: update properties: hibernate: jdbc: time_zone: UTC messages: encoding: UTF-8
   > 
   > 请问 假如我要再多一个表进行分表 ,如何配置呀?
   
   


-- 
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] zhaochong-byte closed issue #12950: How to configure a sub-table with multiple tables

Posted by GitBox <gi...@apache.org>.
zhaochong-byte closed issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950


   


-- 
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] zhaochong-byte commented on issue #12950: 请问多表的分表要如何配置

Posted by GitBox <gi...@apache.org>.
zhaochong-byte commented on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-939210612


   > 我的pom是: org.apache.shardingsphere shardingsphere-jdbc-core-spring-boot-starter 5.0.0-beta 单表的配置是: spring: shardingsphere: # 数据源配置 datasource: # 数据源名称,多数据源以逗号分隔 names: zc # zc: type: com.zaxxer.hikari.HikariDataSource jdbc-url: jdbc:mysql://localhost:3306/zc?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root # 规则配置 rules: sharding: tables: # 逻辑表名称 device_log: # 行表达式标识符可以使用 ${...} 或 $->{...},但前者与 Spring 本身的属性文件占位符冲突,因此在 Spring 环境中使用行表达式标识符建议使用 $->{...} actual-data-nodes: zc.device_log_$->{1..3} # 分表策略 table-strategy: standard: # 分片列名称 sharding-column: company_code # 分片算法名称 sharding-algorithm-name: table-inline # 表主�
 �算法
   > 
   > # key-generate-strategy:
   > # column: id
   > # key-generator-name: snowflake
   > ```
   > # 分片算法配置
   > sharding-algorithms:
   >   table-inline:
   >     # 分片算法类型
   >     type: INLINE
   >     props:
   >       # 分片算法的行表达式
   >       algorithm-expression: device_log_$->{company_code}
   > ```
   
   > jpa: database: mysql database-platform: org.hibernate.dialect.MySQL57Dialect hibernate: ddl-auto: update properties: hibernate: jdbc: time_zone: UTC messages: encoding: UTF-8
   > 
   > 请问 假如我要再多一个表进行分表 ,如何配置呀?
   
   


-- 
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] zhaochong-byte commented on issue #12950: How to configure a sub-table with multiple tables

Posted by GitBox <gi...@apache.org>.
zhaochong-byte commented on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-940596940


   @yx9o Hi,this is my latest configuration:
   ![image](https://user-images.githubusercontent.com/73687296/136879979-3caca6c0-6d1e-48b4-9269-515b799e852c.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.

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

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



[GitHub] [shardingsphere] zhaochong-byte commented on issue #12950: How to configure a sub-table with multiple tables

Posted by GitBox <gi...@apache.org>.
zhaochong-byte commented on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-939246116


   ![image](https://user-images.githubusercontent.com/73687296/136648418-8ca11e61-da10-4788-9987-f1a5938a54fa.png)
   According to the configuration on the document, why are these attributes empty?
   This is my configs:
   ![Uploading image.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.

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

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



[GitHub] [shardingsphere] yx9o commented on issue #12950: How to configure a sub-table with multiple tables

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


   @zhaochong-byte Hi, Are you using 5.0.0-beta? I can’t start successfully with your configuration. 
   Try this:
   ![image](https://user-images.githubusercontent.com/12792261/137318026-fbbd9c30-d8b6-4c59-9120-d353c4cbf20b.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.

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

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



[GitHub] [shardingsphere] zhaochong-byte edited a comment on issue #12950: 请问多表的分表要如何配置

Posted by GitBox <gi...@apache.org>.
zhaochong-byte edited a comment on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-939211646


   
   spring
     shardingsphere:
       datasource:
         names: zc
         zc:
           type: com.zaxxer.hikari.HikariDataSource
           jdbc-url: jdbc:mysql://localhost:3306/zc?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC
           driver-class-name: com.mysql.cj.jdbc.Driver
           username: root
           password: root
       rules:
         sharding:
           tables:
             device_log:
               actual-data-nodes: zc.device_log_$->{1..3}
       table-strategy:
         standard:
           sharding-column: company_code
           sharding-algorithm-name: table-inline
       sharding-algorithms:
         table-inline:
           type: INLINE
           props:
             algorithm-expression: device_log_$->{company_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.

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

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



[GitHub] [shardingsphere] yx9o commented on issue #12950: How to configure a sub-table with multiple tables

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


   @zhaochong-byte Hi, is it resolved? Can't see your latest configuration.


-- 
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] yx9o commented on issue #12950: 请问多表的分表要如何配置

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


   Hi @zhaochong-byte , for English only, please modify the issue title and content, thank you.


-- 
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] zhaochong-byte commented on issue #12950: 请问多表的分表要如何配置

Posted by GitBox <gi...@apache.org>.
zhaochong-byte commented on issue #12950:
URL: https://github.com/apache/shardingsphere/issues/12950#issuecomment-939211646


   spring: 
    shardingsphere:
       datasource:
         names: zc 
         zc:
           type: com.zaxxer.hikari.HikariDataSource
           jdbc-url: jdbc:mysql://localhost:3306/zc?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC
           driver-class-name: com.mysql.cj.jdbc.Driver
           username: root
           password: root
       rules:
         sharding:
           tables:
             device_log:
               actual-data-nodes: zc.device_log_$->{1..3}
       table-strategy:
         standard:
           sharding-column: company_code
           sharding-algorithm-name: table-inline
   
       sharding-algorithms:
         table-inline:
           type: INLINE
           props:
             algorithm-expression: device_log_$->{company_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.

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

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



[GitHub] [shardingsphere] yx9o commented on issue #12950: 请问多表的分表要如何配置

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


   @zhaochong-byte Please refer to the configuration in the document: https://shardingsphere.apache.org/document/5.0.0-beta/cn/user-manual/shardingsphere-jdbc/usage/sharding/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