feiquan666 opened a new issue #10472:
URL: https://github.com/apache/shardingsphere/issues/10472


   ### config-sharding.yml
   schemaName: db
   dataSourceCommon:
     username: root
     password: pass
     connectionTimeoutMilliseconds: 30000
     idleTimeoutMilliseconds: 60000
     maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
     minPoolSize: 1
     maintenanceIntervalMilliseconds: 30000
   dataSources:
     db0: 
       url:  .........................
     db1: 
       url:  jdbc:mysql://..............
     db2: 
       url:  jdbc:mysql://............
   rules: 
     # 分片表配置
   #  - !SHARDING
       tables: 
         # pr_user 表规则
         pr_user: 
           actualDataNodes: db${0..2}.pr_user${0..1}
           # 分库策略
           databaseStrategy: 
             standard: 
               shardingColumn: country_id
               shardingAlgorithName: databaseInline
           tableStartege: 
             standard: 
               shardingColumn: id
               shardingAlgorithmName: userTableInline
         # pr_user_detail 表规则
         pr_user_detail: 
           actualDataNodes: db${0..2}.pr_user_detail${0..1}
           # 分库策略
           databaseStrategy: 
             standard: 
               shardingColumn: country_id
               shardingAlgorithName: databaseInline
           tableStartege:
             standard: 
               shardingColumn: id
               shardingAlgorithmName: userDetailtableInline
         # pr_country 表规则
         pr_country:
           actualDataNodes: db${0..2}.pr_country
       # 广播表配置
       broadcastTables: 
         - pr_country
       # 绑定表配置
       bindingTables: 
         - pr_user,pr_user_detail
       # 分片算法配置
       shardingAlgorithms: 
         # 算法名称
         databaseInline: 
           # 类型
           type: INLINE
           # 属性配置
           props: 
             algorithm-expression: db${country_id % 3}
         userTableInline: 
           type: INLINE
           props:
             algorithm-expression: pr_user${user_id % 2}
         userDetailtableInline:
           type: INLINE
           props: 
             algorithm-expression: pr_user_detail${user_id % 2}
   
   ### server.yml
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   
######################################################################################################
   # 
   # If you want to configure governance, authorization and proxy properties, 
please refer to this file.
   # 
   
######################################################################################################
   #
   #governance:
   #  name: governance_ds
   #  registryCenter:
   #    type: ZooKeeper
   #    serverLists: localhost:2181
   #    props:
   #      retryIntervalMilliseconds: 500
   #      timeToLiveSeconds: 60
   #      maxRetries: 3
   #      operationTimeoutMilliseconds: 500
   #  overwrite: false
   
   authentication:
     users:
       root:
         password: root
       sharding:
         password: pass
         authorizedSchemas: db
   
   props:
     max-connections-size-per-query: 1
     acceptor-size: 16  
   # The default value is available processors count * 2.
     executor-size: 16  
   # Infinite by default.
   #  proxy-frontend-flush-threshold: 128  # The default value is 128.
   #    # LOCAL: Proxy will run with LOCAL transaction.
   #    # XA: Proxy will run with XA transaction.
   #    # BASE: Proxy will run with B.A.S.E transaction.
     proxy-transaction-type: LOCAL
     proxy-opentracing-enabled: false
     proxy-hint-enabled: false
     query-with-cipher-column: true
     sql-show: false
     check-table-metadata-enabled: false
   使用 start.bat 启动 报错如下:
   
   Starting the ShardingSphere-Proxy ...
   Exception in thread "main" java.lang.ClassCastException: java.lang.String 
cannot be cast to 
org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration
           at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
           at java.util.Iterator.forEachRemaining(Unknown Source)
           at 
java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
           at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown 
Source)
           at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
           at java.util.stream.ReferencePipeline.collect(Unknown Source)
           at 
org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine.swapToRuleConfigurations(YamlRuleConfigurationSwapperEngine.java:66)
           at 
org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper.lambda$getRuleConfigurations$0(YamlProxyConfigurationSwapper.java:59)
           at java.util.stream.Collectors.lambda$toMap$58(Unknown Source)
           at java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source)
           at java.util.Iterator.forEachRemaining(Unknown Source)
           at 
java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
           at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown 
Source)
           at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
           at java.util.stream.ReferencePipeline.collect(Unknown Source)
           at 
org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper.getRuleConfigurations(YamlProxyConfigurationSwapper.java:58)
           at 
org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper.swap(YamlProxyConfigurationSwapper.java:50)
           at 
org.apache.shardingsphere.proxy.initializer.impl.StandardBootstrapInitializer.getProxyConfiguration(StandardBootstrapInitializer.java:33)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.init(AbstractBootstrapInitializer.java:62)
           at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:48)
   请按任意键继续. . .
   
   
   


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


Reply via email to