-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added nacos service discovery support #3447
Conversation
# Conflicts: # README.md
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/HomePageController.java
Outdated
Show resolved
Hide resolved
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/HomePageController.java
Outdated
Show resolved
Hide resolved
...rvice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/ServiceController.java
Outdated
Show resolved
Hide resolved
apollo-adminservice/src/main/resources/application-nacosDiscovery.properties
Outdated
Show resolved
Hide resolved
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/service/NacosDiscoveryService.java
Outdated
Show resolved
Hide resolved
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/service/NacosDiscoveryService.java
Show resolved
Hide resolved
I checked out this branch, start the application but failed...
Then I configured nacos.discovery.enabled=false, but it still failed to start. It looks to me the spring property sources are somehow wrong after nacos dependency is added.
|
I overlooked that nacos is turned on by default, but you can start the project after disabling it. nacos-discovery-spring-boot-starter only includes spring integration of service discovery part, it has nothing to do with config. If you still cannot get up after disabling it, is this an environmental issue? |
Codecov Report
@@ Coverage Diff @@
## master #3447 +/- ##
============================================
- Coverage 51.41% 51.39% -0.03%
- Complexity 2316 2318 +2
============================================
Files 441 442 +1
Lines 13823 13843 +20
Branches 1408 1408
============================================
+ Hits 7107 7114 +7
- Misses 6226 6237 +11
- Partials 490 492 +2
Continue to review full report at Codecov.
|
ApolloApplication starts with the above errors... I did some debugging and found nacos-client has an application.properties which overrides |
apollo-adminservice/src/main/config/application-github.properties
Outdated
Show resolved
Hide resolved
It turns out that the problem is here. I have always used separate ConfigService and AdminService to start services, so we see different phenomena. I will continue to see the solution |
After I activated the
|
@nobodyiam The reason for the problem is because you are running in ApolloApplication, I have not tested it in this mode |
@nobodyiam 通过maven的profile隔离了nacos-discovery-spring-boot-starter的依赖,默认只有nacos-api的依赖解决编译问题,nacos-api.1.4.0版本已经将application.properties文件挪走了,不影响ApolloApplication的启动。但是nacosDis'covery的spring-profile有缺陷,不支持ApolloApplication模式启动,原因是未配置@componentscan扫描,ApolloApplication模式下没法启用自动配置。验证时只能通过ConfigServiceApplication和AdminServiceApplication单独启动。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works by using maven profile, with the following suggestions.
apollo-adminservice/src/main/resources/application-nacosDiscovery.properties
Show resolved
Hide resolved
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/HomePageController.java
Outdated
Show resolved
Hide resolved
...rvice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/ServiceController.java
Outdated
Show resolved
Hide resolved
...ce/src/main/java/com/ctrip/framework/apollo/metaservice/service/DefaultDiscoveryService.java
Outdated
Show resolved
Hide resolved
...vice/src/main/java/com/ctrip/framework/apollo/metaservice/service/NacosDiscoveryService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
新增nacos服务发现支持,使用方法如下:
启用外部的nacos服务注册中心分两步走,configService和adminService的操作一样,如下:
也可采用VM options的方式配置,如: