shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

How to config default datasource in 5.0.0 ?

Open lwtdev opened this issue 6 years ago • 3 comments

How to config default datasource in 5.0.0 ?

In Shardingsphere-Proxy 4.1.1, there is a defaultDataSourceName , but can't be use in 5.0.0 :

Caused by: Cannot create property=defaultDataSourceName for JavaBean=org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigura
tion@45ca843
 in 'reader', line 115, column 3:
    - !SHARDING
      ^
Unable to find property 'defaultDataSourceName' on class: org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration
 in 'reader', line 116, column 26:
      defaultDataSourceName: ds_0
                             ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:345)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:275)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:246)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:536)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)

lwtdev avatar Jul 29 '20 08:07 lwtdev

5.0.0 version is under develop status. You can track it for the first release version and the API will be stable.

kimmking avatar Jul 29 '20 10:07 kimmking

@tristaZero

There is no need to configure tables without sharding, ss will host all the tables in the user configuration ds, and when routing, find the tables involved in sql and perform correct routing.

But what about tables created without shardingsphere after shardingsphere started ?

And what about use shardingsphere-jdbc?

lwtdev avatar Sep 29 '20 07:09 lwtdev

@lwtdev If the ShardingSphere service is running, why do not you create table with ShardingSphere? Maybe you wanna create a non-sharding table?

tristaZero avatar Sep 30 '20 03:09 tristaZero