When you deploy a Spring Cloud or Dubbo application to SAE, you can use the SAE built-in service registry or connect your application to a self-managed Nacos instance. This topic describes how to configure your SAE application to use a self-managed Nacos instance for service registration and discovery.
Choose a registry
If you manage a large number of microservices, choose a registry in the following order (highest to lowest recommendation):
MSE Nacos registry
Self-managed service registry
SAE built-in service registry
Prerequisites
Before you begin, make sure that you have:
The
yumcommand available on your systemThe access port for the Nacos registry (such as 8848) added to a security group. To add security group rules, see Add a security group rule.
Step 1: Set up Nacos
Nacos requires a Java runtime environment. If you are building from source, Maven is also required. After Nacos is running, configure your application to point to the Nacos address as its service registry. Nacos then handles service registration and discovery automatically.
For installation instructions, see Nacos Quick Start.
Step 2: Connect your SAE application to Nacos
SAE supports two methods for connecting to a self-managed Nacos instance. Use Method 1 for most scenarios. Use Method 2 if you need to configure JVM startup parameters directly.
Open the application settings
The entry point depends on the state of your application:
Creating a new application
Log on to the SAE console. In the left navigation pane, click Applications > Applications.
Select a region and namespace, then click Create Application.
Complete the Basic Information page and click Next: Advanced Settings.
Modifying a running application
Redeploying an application restarts it. To minimize disruption, deploy during off-peak hours.
Log on to the SAE console. In the left navigation pane, click Application > Applications.
Select a region and namespace, then click the application name.
On the Basic Information page, click Deploy Application.
Modifying a stopped application
Log on to the SAE console. In the left navigation pane, click Applications > Applications.
Select a region and namespace, then click the application name.
On the Basic Information page, click Modify Application Configurations.
Method 1: Configure service registration and discovery (recommended)
In the Service Registration and Discovery section, set Nacos-based Registry Service and Discovery to Self-managed Registry (Such as Nacos and ZooKeeper).
SAE provides a built-in Nacos server that supports automatic addressing for Java microservices. You can configure it using the Service Registration And Discovery feature in SAE.

Method 2: Configure startup parameters
Use this method when you need to set Nacos-related JVM parameters directly in the application startup command.
Before you configure startup parameters:
Confirm that the SAE network can reach the network where your self-managed Nacos instance runs.
Do not mix
-Dand-XXparameters in the same command — this can cause parameters to be ignored. Remove any-Dalicloud.deployment.mode=EDAS_MANAGEDparameter if present. Before:java -Dalicloud.deployment.mode=EDAS_MANAGED -XX:+UseContainerSupport -XX:InitialRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0 -XX:+UnlockExperimentalVMOptions -XX:+UseWisp2 -Dio.netty.transport.noNative=true -XX:+UseG1GC -Dspring.profiles.active=yace -Dnacos.use.endpoint.parsing.rule=false -Dnacos.use.cloud.namespace.parsing=false -jar /home/admin/app/xx-server.jarAfter:
java -XX:+UseContainerSupport -XX:InitialRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0 -XX:+UnlockExperimentalVMOptions -XX:+UseWisp2 -Dio.netty.transport.noNative=true -XX:+UseG1GC -Dspring.profiles.active=yace -Dnacos.use.endpoint.parsing.rule=false -Dnacos.use.cloud.namespace.parsing=false -jar /home/admin/app/xx-server.jar
We recommend that you deploy the application using an image or a JAR package and configure the following startup parameters:
-Dnacos.use.endpoint.parsing.rule=false -Dnacos.use.cloud.namespace.parsing=falsePlace all startup parameters before -jar. Otherwise, you may be unable to use a service registry that is not provided by SAE.
For image-based deployment
Add the parameters to the startup command in your Dockerfile:
RUN echo 'eval exec java -Dnacos.use.endpoint.parsing.rule=false -Dnacos.use.cloud.namespace.parsing=false -jar $CATALINA_OPTS /home/admin/app/hello-edas-0.0.1-SNAPSHOT.jar'> /home/admin/start.sh && chmod +x /home/admin/start.shFor instructions on creating a compatible image, see Create an image.
For JAR package deployment
In the SAE console, under Startup Command Settings, enter the two parameters in the Options Settings field. The following screenshot shows an example for an application running on Open JDK 8.

For more information, see Set a startup command.