When developing microservices locally, applications need a service registry to register, discover, and call each other. Alibaba Cloud Toolkit provides a built-in registry that runs directly from IntelliJ IDEA -- no manual configuration file edits or host bindings required. Your local microservices can also interconnect with cloud-deployed applications on Enterprise Distributed Application Service (EDAS).
Supported frameworks and ports
The local registry supports three microservice frameworks. Make sure the required ports are available before you proceed.
| Framework | Required ports |
|---|---|
| High-speed Service Framework (HSF) | 8080, 8848, 9600 |
| Spring Cloud | 8080, 8848 |
| Apache Dubbo | 8080, 8848 |
| Port | Purpose |
|---|---|
| 8848 | Nacos service registration and configuration management |
| 9600 | HSF or Apache Dubbo service registration and subscription |
| 8080 | Alibaba Naming Service (ANS) registration and Application Configuration Management (ACM) |
Port 9600 is required only for HSF. Spring Cloud and Apache Dubbo use ports 8080 and 8848.
Registry modes
Alibaba Cloud Toolkit provides four registry modes. Choose the one that fits your development scenario.
| Mode | When to use |
|---|---|
| No Registry | No service registry is needed. |
| Use Local Registry | Start a lightweight registry on your local machine for development and testing. |
| Join Custom Registry | Connect to an existing registry by specifying its domain name or IP address. EDAS uses JVM -D parameters to register your applications with that registry at runtime. |
| Interconnection Between On-premises and Cloud Applications | Enable mutual calling and testing between locally running applications and cloud-deployed applications. |
Start a local registry with demo Nacos applications
This walkthrough uses Use Local Registry with two demo Nacos applications (a provider and a consumer) to demonstrate service registration and discovery.
Prerequisites
Before you begin, make sure that you have:
Alibaba Cloud Toolkit installed and configured in IntelliJ IDEA. For details, see Install and configure Alibaba Cloud Toolkit in IntelliJ IDEA
Ports 8080 and 8848 available on your local machine
Step 1: Download the demo projects
Download the following projects and open both in IntelliJ IDEA:
Repeat Steps 2 through 5 for each project.
Step 2: Open the Microservice settings
In the top navigation bar of IntelliJ IDEA, choose File > Settings. In the left-side navigation pane, choose Alibaba Cloud Toolkit > Microservice.
Step 3: Select the registry mode and start the registry
Select Use Local Registry, and then click Start to launch the local lightweight configuration center.
Step 4: Apply the settings
Click Apply, and then click OK.
Step 5: Run the demo projects
Start both the nacos-service-provider and nacos-service-consumer projects from IntelliJ IDEA.
Verify the setup
After both projects start, open the following URL in a browser:
https://127.0.0.1:18082/echo-feign/helloworldPort 18082 is the port for the consumer project. If the page returns the string helloworld, the provider and consumer are communicating through the local registry.
To access the local registry console, open http://localhost:<port> in a browser, where <port> is one of the ports listed in Supported frameworks and ports.
Stop the local registry
When you no longer need the local registry:
In IntelliJ IDEA, choose File > Settings > Alibaba Cloud Toolkit > Microservice.
Click Stop to shut down the local registry.
Click Apply, and then click OK.
This frees ports 8080, 8848, and 9600 (if applicable) for other processes.
What's next
To connect to an existing registry instead of starting a local one, select Join Custom Registry in Step 3 and specify the domain name or IP address of your registry.
To enable communication between local and cloud-deployed applications, select Interconnection Between On-premises and Cloud Applications.
For instructions on deploying applications to EDAS, see the EDAS documentation.