xtuer commented on issue #8435:
URL: https://github.com/apache/shardingsphere/issues/8435#issuecomment-740509975


   > The 4.x document looks a little inconsistent, please try with the 
configuration below:
   > 
   > ```
   > orchestration:
   >   demo_yaml_ds_sharding:
   >     orchestrationType: config_center,registry_center
   >     instanceType: zookeeper
   >     serverLists: localhost:2181
   >     namespace: orchestration-yaml-demo
   >     props:
   >       overwrite: true
   > ```
   > 
   > And you can download the source code by 
[4.1.1-tag](https://github.com/apache/shardingsphere/releases/tag/4.1.1),
   > there are examples in the source code,thank you for your feedback!
   
   Thank you very much for you affords and follow the above configuration the 
Application can upload the configuration into Zookeeper and starts up 
successfully.
   
   But when I **comment dataSources and shardingRule sections, and set 
overwrite as false** so that it can load the configurations from Zookeeper, 
unfortunately, it prompts errors:
   ```
   Error creating bean with name 'dataSource' defined in class path resource 
[com/xtuer/AppConfig.class]: Bean instantiation via factory method failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw 
exception; nested exception is java.lang.reflect.InvocationTargetException
   ```
   
   Below is the configuration above mentioned:
   ```
   #dataSources:
   #  ds0: !!com.zaxxer.hikari.HikariDataSource
   #    driverClassName: com.mysql.jdbc.Driver
   #    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0
   #    username: root
   #    password: root
   #  ds1: !!com.zaxxer.hikari.HikariDataSource
   #    driverClassName: com.mysql.jdbc.Driver
   #    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1
   #    username: root
   #    password: root
   #
   #shardingRule:
   #  tables:
   #    user:
   #      actualDataNodes: ds${0..1}.user
   #      databaseStrategy:
   #        inline:
   #          shardingColumn: user_id
   #          algorithmExpression: ds${user_id % 2}
   #  defaultTableStrategy:
   #    none:
   
   orchestration:
     demo_yaml_ds_sharding:
       orchestrationType: config_center,registry_center
       instanceType: zookeeper
       serverLists: localhost:2181
       namespace: orchestration-yaml-demo
       props:
         overwrite: false
   ```


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