When you deploy a locally developed Spring Cloud or Dubbo application to SAE, you can use the SAE service registry or a self-managed Nacos instance for service registration and discovery. This topic describes how to configure Nacos service registration and discovery for an application in the SAE console.
Prerequisites
The yum command is installed.
Before you run the application, ensure that the access port for the Nacos registry, such as 8848, is added to a security group. For specific instructions, see Add a security group rule.
Recommendations
If you have a large number of microservices applications, you can use one of the following types of service registries that are listed in descending order by recommendation level:
MSE Nacos registry
Self-managed service registry
SAE built-in service registry
Step 1: Configure Nacos
Nacos requires a Java environment to run. If you are building Nacos from source code, Maven is also needed. After installation, Nacos provides service registration and discovery, so be sure to specify the service registry in your application. Services will then be registered and discovered automatically.
For specific instructions, see Nacos Quick Start.
Step 2: Configure the service registration and discovery feature in the SAE console
This section describes only the key steps.
The entry points for operations vary depending on the scenario:
When creating an application
Log on to the SAE console. In the navigation pane on the left, click . Then, select a region and namespace, and click Create Application.
On the Basic Information page, configure the required parameters and click Next: Advanced Settings.
When modifying a running application
WarningAfter you redeploy an application, the application is restarted. To prevent unpredictable errors such as business interruptions, we recommend that you deploy applications during off-peak hours.
Log on to the SAE console. In the navigation pane on the left, click . Then, select a region and namespace, and click the name of the application.
On the Basic Information page of the application, click Deploy Application.
When modifying a stopped application
Log on to the SAE console. In the navigation pane on the left, click . Then, select a region and namespace, and click the name of the application.
On the Basic Information page of the application, click Modify Application Configurations.
Select one of the following methods to connect to Nacos.
Method 1: Configure service registration and discovery
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 Nacos Server that supports automatic addressing for Java microservices. You can configure this using the Service Registration And Discovery feature in SAE

Method 2: Configure startup parameters
When configuring startup parameters, ensure the following:
Ensure that the SAE network is connected to the network of your self-managed Nacos instance.
Ensure that the
-Dand-XXparameters are not used together. Otherwise, the command may be invalid. The following code provides an example:Before modification:
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 modification:
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
-Dnacos.use.endpoint.parsing.rule=falseand-Dnacos.use.cloud.namespace.parsing=falsestartup parameters.Important
The startup parameters must be placed before
-jar. Otherwise, you may be unable to use a service registry that is not provided by SAE.If you use an image, you must configure the
-Dnacos.use.endpoint.parsing.rule=falseand-Dnacos.use.cloud.namespace.parsing=falseparameters in the image file's startup command. See Create an image for more.The following command provides an example:
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.shIf you use a JAR package, enter
-Dnacos.use.endpoint.parsing.rule=false -Dnacos.use.cloud.namespace.parsing=falsein the Options Settings text box under Startup Command Settings in the console. The following figure shows a Java application that runs in an Open JDK 8 environment. For more information, see Set a startup command.