maxiaoxian edited a comment on issue #3127: CPU LOAD  more than 300%
URL: 
https://github.com/apache/incubator-shardingsphere/issues/3127#issuecomment-535748625
 
 
   sharding-jdbc config:
   
   @Bean(name = "shardingDataSource")
       @Primary
       public DataSource getShardingDataSource() throws SQLException {
   MasterSlaveRuleConfiguration masterSlaveRuleConfig =
                   new MasterSlaveRuleConfiguration("ds", "fcWriteDataSource", 
Arrays.asList("fcRead1DataSource", "fcRead2DataSource"));
   
           Set<MasterSlaveRuleConfiguration> masterSlaveRuleConfigurationSet = 
new HashSet<>();
           masterSlaveRuleConfigurationSet.add(masterSlaveRuleConfig);
   
           ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
           
shardingRuleConfig.setMasterSlaveRuleConfigs(masterSlaveRuleConfigurationSet);
   
           // 分表规则配置
          \ ...
           // 默认分表策略设置
           shardingRuleConfig.setDefaultTableShardingStrategyConfig(
                   new StandardShardingStrategyConfiguration("none",new 
NoneDatabaseShardingAlgorithm())
           );
           // 设置默认数据库,解决只有部分表需要分表的问题
   //        shardingRuleConfig.setDefaultDataSourceName("fcWriteDataSource");
           Map<String, Object> configMap = new HashMap<>(0);
           final Properties properties = new Properties();
           properties.setProperty("executor.size","3");
   
           // 配置注册中心
           RegistryCenterConfiguration regConfig = new 
RegistryCenterConfiguration("zookeeper");
           regConfig.setServerLists(shardingOrchestrationRegistrys);
           regConfig.setNamespace(shardingOrchestrationNamespace);
   
           // 配置数据治理
           OrchestrationConfiguration orchConfig = new 
OrchestrationConfiguration(shardingOrchestrationName, regConfig, false);
   
           // 获取数据源对象
           DataSource dataSource = 
OrchestrationShardingDataSourceFactory.createDataSource(createDataSourceMap(), 
shardingRuleConfig,  properties, orchConfig);
           return dataSource;
   }

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


With regards,
Apache Git Services

Reply via email to