You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/01/20 01:16:19 UTC

[GitHub] [shardingsphere] YanlongMa edited a comment on issue #9091: How to use etcd as config center

YanlongMa edited a comment on issue #9091:
URL: https://github.com/apache/shardingsphere/issues/9091#issuecomment-763256441


   zookeeper config center is success, but etcd config center is error, I dont‘not how to add dependency in pom,  can you help me, 3Q.
   
   pom.xml
   ```
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
               <version>4.0.0</version>
   </dependency>
   
   <dependency>
             <groupId>io.etcd</groupId>
             <artifactId>jetcd-core</artifactId>
             <version>0.5.0</version>
   </dependency>
   ```
   
   properties
   ```
   spring.shardingsphere.datasource.names=master,slave0,slave1
   
   #  master
   spring.shardingsphere.datasource.master.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.master.jdbc-url=jdbc:mysql://127.0.0.1:3306/master?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.master.username=root
   spring.shardingsphere.datasource.master.password=123456
   
   # slave0
   spring.shardingsphere.datasource.slave0.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.slave0.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.slave0.jdbc-url=jdbc:mysql://127.0.0.1:3306/slave0?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.slave0.username=root
   spring.shardingsphere.datasource.slave0.password=123456
   
   # slave1
   spring.shardingsphere.datasource.slave1.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.slave1.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.slave1.jdbc-url=jdbc:mysql://127.0.0.1:3306/slave1?useUnicode=true&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.slave1.username=root
   spring.shardingsphere.datasource.slave1.password=123456
   
   #  round_robin/random
   spring.shardingsphere.masterslave.name=kushu_taishan
   spring.shardingsphere.masterslave.master-data-source-name=master
   spring.shardingsphere.masterslave.slave-data-source-names=slave0,slave1
   spring.shardingsphere.masterslave.load-balance-algorithm-type=round_robin
   
   # sql
   spring.shardingsphere.props.sql.show=true
   
   # etcd
   spring.shardingsphere.orchestration.name=basic
   spring.shardingsphere.orchestration.overwrite=true
   spring.shardingsphere.orchestration.registry.type=etcd
   spring.shardingsphere.orchestration.registry.namespace=kushu_taishan
   spring.shardingsphere.orchestration.registry.server-lists=127.0.0.1:2379
   ```
   
   error info 
   ```
   Caused by: java.lang.RuntimeException: Invalid `org.apache.shardingsphere.orchestration.reg.api.RegistryCenter` SPI type `etcd`.
   	at org.apache.shardingsphere.spi.TypeBasedSPIServiceLoader.newService(TypeBasedSPIServiceLoader.java:50) ~[shardingsphere-spi-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.orchestration.internal.registry.RegistryCenterServiceLoader.load(RegistryCenterServiceLoader.java:52) ~[sharding-orchestration-core-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.orchestration.internal.registry.ShardingOrchestrationFacade.<init>(ShardingOrchestrationFacade.java:58) ~[sharding-orchestration-core-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationMasterSlaveDataSource.<init>(OrchestrationMasterSlaveDataSource.java:70) ~[sharding-jdbc-orchestration-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration.masterSlaveDataSourceByLocal(OrchestrationSpringBootConfiguration.java:144) ~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac.CGLIB$masterSlaveDataSourceByLocal$3(<generated>) ~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
   	at org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac$$FastClassBySpringCGLIB$$812f0b91.invoke(<generated>) ~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
   	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.12.RELEASE.jar:5.2.12.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
   	at org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$650690ac.masterSlaveDataSourceByLocal(<generated>) ~[sharding-jdbc-orchestration-spring-boot-starter-4.0.0.jar:4.0.0]
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_231]
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_231]
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_231]
   	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_231]
   	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
   	... 77 common frames omitted
   
   ```


----------------------------------------------------------------
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:
users@infra.apache.org