shuikan95 commented on issue #24913:
URL: 
https://github.com/apache/shardingsphere/issues/24913#issuecomment-1504899175

   @insist777 Thanks for your tips. 
   
   It works now when I add commit config.
   
   ```yml
   ---
   spring.datasource:
       hikari:
          connection-timeout: 10000
          validation-timeout: 3000
          idle-timeout: 60000
          login-timeout: 5
          max-lifetime: 60000
          maximum-pool-size: 10
          minimum-idle: 5
   #       read-only: false
          auto-commit: false
   
   ---
   spring.jpa:
      databasePlatform: MYSQL
      showSql: false
      openInView: true
      generateDdl: false
      properties.hibernate:
         dialect: org.hibernate.dialect.MySQL8Dialect
         format_sql: false
         use_sql_comments: true
         physical_naming_strategy: 
org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
         connection.autocommit: true
   ```
   
   But there is an another problem is that running with SHARDING tables.
   
   ```yml
   rules:
     - !SHARDING
       tables:
         t_account:
           actualDataNodes: write_account.t_account_$->{0..1}
           databaseStrategy:
             none: # 分库策略 不分片
           tableStrategy:
             standard:
               shardingColumn: id
               shardingAlgorithmName: alg_mod
           keyGenerateStrategy:
             column: id
             keyGeneratorName: snowflake_generator
       bindingTables:
         - t_account
   
       # 分片算法配置
       shardingAlgorithms:
         alg_mod:
           type: MOD
           props:
             sharding-count: 2
   
       # 分布式序列算法配置
       keyGenerators:
         snowflake_generator:
           type: SNOWFLAKE
   
       # 读写分离配置
     - !READWRITE_SPLITTING
       dataSources:
         readwrite_ds: # 读写分离逻辑数据源名称
           staticStrategy:
             writeDataSourceName: write_account
             readDataSourceNames: [read_account_1,read_account_2]
           loadBalancerName: round_robin
       loadBalancers:
         round_robin:
           type: ROUND_ROBIN
   
   props:
     sql-show: true
   ```
   If I add these SHARDING config to combine, the program remain to choose 
write datasource. 
   Attention, the datasources read_account_1 and read_account_2 just for 
reading, so I set actualDataNodes: write_account.t_account_$->{0..1}
   
   Have something wrong in these config? Pls figure out.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to