The problem record

Premise:

  • Two subprojects are created under the parent project: Provider and Consumer.
  • Parent project-related dependencies:
dependencies {
        compile 'ch. Qos. Logback: logback - classic: 1.2.3'
        compile 'com. Alibaba: fastjson: 1.2.49'
        implementation "com.alibaba.cloud:spring-cloud-alibaba-dependencies:${alibabaCloudVersion}"
        implementation "org.springframework.cloud:spring-cloud-dependencies:${cloudVersion}"
        implementation "org.springframework.boot:spring-boot-dependencies:${bootVersion}"
    }
Copy the code
  • Subproject dependency
dependencies {
    implementation "org.springframework.boot:spring-boot-starter-web:${bootVersion}"
    implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:${alibabaCloudVersion}"
    implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:${alibabaCloudVersion}"
    implementation "com.alibaba.cloud:spring-cloud-starter-dubbo:${alibabaCloudVersion}"
    implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
    compile project(':Common')}Copy the code
  • The relevant version
alibabaCloudVersion=2.2.5. RELEASE
cloudVersion=Hoxton.SR8
bootVersion=2.3.2. RELEASE
Copy the code

1. A problem

Problem description

When dubo.protocol. port is not specified for consumer, both consumer and provider are started, and an error is reported: port 20880 is occupied.

The reasons causing

Dubo.protocol. Port defaults to 20880. When neither of the two subprojects specifies a port number, one of the projects starts up and occupies port 20880 and registers the service with the NACOS service center.

The solution

Modify the configuration file for one of the projects: specify an unused port for dubo.protocol. port.

2. Question 2

Problem description

The console alerts you when you start the Consumer and Provider subprojects

Current application will subscribe all services(size:3) in registry, a lot of memory and CPU cycles may be used, thus it's strongly recommend you using the externalized property 'dubbo.cloud.subscribed-services' to specify the services
Copy the code

The reasons causing

Subscribed -services The default is * (that is, all). If not specified, the current project will subscribe to all services registered with the service center, which may result in significant memory and CPU usage. So Dubbo kindly reminds you of the service you need to subscribe to.

The solution

Modify the configuration file to specify the service to which the current project needs to subscribe. dubbo.cloud.subscribed-services