shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

sharding-master-slave.properties think logic datasource (ds_0) is real datasource ?????

Open jaedongjuly opened this issue 6 years ago • 3 comments

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

  4.1.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

  My demo run well;     

example at git hub shardingsphere

Actual behavior

   ds_0   invalid actual data node is: 'ds_0.t_user'

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

jaedongjuly avatar Jun 09 '20 12:06 jaedongjuly

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

  4.1.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

  My demo run well;     

example at git hub shardingsphere

Actual behavior

   ds_0   invalid actual data node is: 'ds_0.t_user'

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

I don‘t know , what's the problem?

#读写分离
spring.shardingsphere.datasource.names=my-master,my-slave01
spring.shardingsphere.datasource.my-master.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.my-master.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.my-master.url=jdbc:mysql://localhost:3306/user_db?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.my-master.username=root
spring.shardingsphere.datasource.my-master.password=
#数据库二
spring.shardingsphere.datasource.my-slave01.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.my-slave01.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.my-slave01.url=jdbc:mysql://localhost:3306/user_db?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.my-slave01.username=root
spring.shardingsphere.datasource.my-slave01.password=

spring.shardingsphere.rules.master-slave.data-sources.ds_0.master-data-source-name=my-master
spring.shardingsphere.rules.master-slave.data-sources.ds_0.slave-data-source-names=my-slave01

spring.shardingsphere.sharding.tables.t_user.actual-data-nodes=ds_0.t_user

spring.shardingsphere.sharding.tables.t_user.key-generator.column=user_id
# course 可使用用户自定义的列值生成器或选择内置类型:SNOWFLAKE/UUID
spring.shardingsphere.sharding.tables.t_user.key-generator.type=SNOWFLAKE
#是否开启SQL显示,默认值: false
spring.shardingsphere.props.sql.show=true

jaedongjuly avatar Jun 09 '20 12:06 jaedongjuly

The example you referenced is on master, but your code are use 4.1.0, can you use example with correct version?

terrymanu avatar Jun 10 '20 04:06 terrymanu

Closed because of no response anymore

terrymanu avatar Jun 17 '20 04:06 terrymanu