Closed cobstergo closed 4 years ago
and can't start sharding proxy by new config , i don't if I miss some config? error log SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr1/apache-shardingsphere-5.0.0-RC1-SNAPSHOT-shardingsphere-proxy-bin/lib/logback-classic-1.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr1/apache-shardingsphere-5.0.0-RC1-SNAPSHOT-shardingsphere-proxy-bin/lib/lib/log4j-slf4j-impl-2.13.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr1/apache-shardingsphere-5.0.0-RC1-SNAPSHOT-shardingsphere-proxy-bin/lib/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 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(ReferencePipeline.java:193) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) 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:66) at java.util.stream.Collectors.lambda$toMap$237(Collectors.java:1321) at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1683) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper.getRuleConfigurations(YamlProxyConfigurationSwapper.java:66) at org.apache.shardingsphere.proxy.config.yaml.swapper.YamlProxyConfigurationSwapper.swap(YamlProxyConfigurationSwapper.java:56) at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:67)
forget it , I have handle it , because I ignore this rules: - !SHARDING tables:
Hi I am glad you can test your new sharding feature on the master branch. @cobstergo
To simplify the user's work for configuration, we did a lot of work. Besides, we also add autoShardingTable
which does not need to configure the actualDataNodes
as before.
Currently, we are working on the doc, but still ongoing. If you want to find the configuration example, maybe test config will give you a hand.
@tristaZero ok.thank for your help
before we use sharding proxy 4.1.1 version , we has sharding config (config-sharding.yaml) like this: schemaName: order dataSources: ds_0: url: jdbc:mysql://xxxxxxxxx:3306/order?useAffectedRows=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true&useSSL=false username: password: connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 1000 shardingRule: tables: t_order: actualDataNodes: ds_0.t_order20200$->{1..9},ds_0.t_order20201$->{0..2} tableStrategy: standard: shardingColumn: firstTime preciseAlgorithmClassName: shardingproxyalgorithm.sharding.order.ShardingTableByMonthAlgorithmPrecise rangeAlgorithmClassName: shardingproxyalgorithm.sharding.order.ShardingTableByMonthAlgorithmRange keyGenerator: type: SELFGROWING column: id bindingTables:
schemaName: order
dataSourceCommon: username: password: connectionTimeoutMilliseconds: 120000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 10000 minPoolSize: 1000 maintenanceIntervalMilliseconds: 30000
dataSources: ds_0: url: jdbc:mysql://xxxxxxxxx:3306/order?useAffectedRows=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true&useSSL=false rules: tables: t_order: actualDataNodes: ds_0.t_order20200$->{1..9},ds_0.t_order20201$->{0..2} tableStrategy: standard: shardingColumn: firstTime shardingAlgorithmName: shardingByMonth(???) keyGenerateStrategy: column: id keyGeneratorName: SELFGROWING(???) bindingTables: