Manage services

更新时间:
复制 MD 格式

When you host a Nacos instance on Microservice Engine (MSE), MSE manages the services registered with that instance. This topic describes how to manage services.

Prerequisites

Create a service

Note

You can create an empty service (a service with no providers) in the console for service definition or for testing. To display the empty service in the list, you must disable Hide Empty Services.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, choose Service Management > Services. In the upper-left corner of the page, select a Namespace and then click Create service.

  5. In the Create service panel, configure the parameters and click OK.

    Nacos 2.1.2.1 or later

    Parameter

    Description

    Service Name

    The name of the service.

    Group Name

    The name of the group to which the service belongs.

    Instance Source

    Select the source of the instance. Valid values: Console and SDK.

    Protection Threshold

    If you set Instance Source to Console or SDK, you must set a protection threshold. Set this value to the ratio of the minimum number of nodes required to handle peak traffic. For example, if you have 10 instance nodes and require a minimum of 6 nodes to handle peak traffic, a system breakdown may occur if fewer than 6 nodes are available. In this case, set the protection threshold to 0.6.

    Nacos 2.0.3.0 to 2.1.2.0

    Parameter

    Description

    Service Name

    The name of the service.

    Group Name

    The name of the group to which the service belongs.

    Persistence

    Specifies whether the service and its instances are persistent.

    Protection Threshold

    If the ratio of healthy instances to the total number of instances for this service falls below this threshold, the system triggers protection to prevent a system breakdown. Valid values: 0 to 1. The default value is 0.

    For more information, see Best practices for high availability of MSE registry and configuration centers.

Delete services

Note

The action to delete a service instance is effective only for Persistence service instances (non-ephemeral instances).

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, choose Service Management > Services. In the upper-left corner of the page, select a Namespace. Find the target service, and in the Actions column, click More > Delete. Then, click OK in the confirmation dialog box.

View service details

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, click Service Management > Services, and select a Namespace in the upper-left corner of the page.

    In this namespace, you can view information about all services on the Nacos instance, such as Service Name, Group Name, Number of providers, and Number of Clusters.

    You can perform the following operations:

    • To view service details, click the name of the target service.

      • The top of the service details page displays basic information about the service, such as its name, group, persistence status, and number of clusters.

      • Click the Provider tab to view all provider instances for the service. These instances are grouped by cluster. By default, the providers of the first cluster are displayed.

        • In the All Clusters section on the left, click a cluster name to switch to that cluster.

        • In the Actions column for a target instance, you can edit the instance's weight, bring it online or offline, delete the instance, or view its metadata.

      • Click the Subscriber tab to view all client instances that subscribe to the current service. The list displays each subscriber's IP address (client IP), Client Version (for example, Nacos-Java-Client:v1.4.1), and Application Name.

      • Click the Push track tab to view detailed push tracking information for the current service. This includes the push time, client IP address, service name, service group, number of service instances, and node names.

    • To delete a service: On the Services page, find the target service, and in the Actions column, click Delete. Then, click OK in the confirmation dialog box.

      Important
      • You can only delete empty services. If a service is not empty, the delete button is grayed out.

      • If a service remains empty for more than one minute, Nacos automatically deletes it.

Add instances to a service

You can add new instances (providers) to any service in the console to define instances in advance or for testing purposes.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, choose Service Management > Services, and select a Namespace in the upper-left corner of the page.

  5. Click the name of the target service to view its details.

  6. Click the Provider tab, and then click Create an instance. In the Create an instance dialog box, configure the parameters and click OK.

    Parameter

    Description

    IP

    The IP address of the instance.

    Port Number

    The port of the instance.

    Cluster name

    The cluster to which the instance belongs. This parameter provides logical separation for instances in Nacos. The default value is DEFAULT.

    Up and down line status

    Select the initial online or offline status for the instance. The default value is Yes.

    Weight

    The weight of the instance. Valid values: 0 to 10000. The default value is 1. Traffic is distributed based on weight. The higher the weight, the more traffic is routed to the instance.

    If the weight that you set does not take effect, see How to fix an issue where instance weight changes do not take effect in Nacos.

Bring an instance online or offline

Note

This feature operates on specific instances in Nacos.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, choose Service Management > Services, and select a Namespace in the upper-left corner of the page.

  5. Click the name of the target service to view its details.

  6. Click the Provider tab. Find the target instance, and then click On line or Offline in the Actions column. In the confirmation dialog box, click OK.

Note

If you call the online API immediately after service registration and the instance does not come online as expected, the data may not have finished synchronizing. As a best practice, wait approximately 10 seconds after the service is successfully registered before you call the online API.

FAQ

Does MSE Nacos support customizing the service heartbeat timeout and offline criteria?

No. In MSE Registry (Nacos), the service heartbeat timeout and offline behavior are controlled by fixed server-side parameters. Users cannot customize the timeout duration or the number of missed heartbeats required to take an instance offline.

Why does MSE only load one instance of a Nacos service?

The service registration source configuration does not include all the required Nacos instances. To resolve this issue, go to the service registration source configuration in the MSE console and manually add the missing Nacos instance IDs (for example, mse-580c5140) to ensure all required Nacos instances are included in the service discovery scope.

How do I resolve the "publish nacos metadata failed" error?

The metadata content of the Dubbo provider exceeds the Nacos default limit. The nacos.naming.metadata.max.total.length parameter defaults to 4096 bytes. You can use one or both of the following methods to resolve this issue:

  1. Optimize the metadata content to keep it within 8 KB.

  2. If reducing the metadata is not feasible due to business requirements, log on to Alibaba Cloud Quota Center, search for Microservice Engine MSE, find the quota item Maximum total length of Nacos service metadata (bytes), and submit an increase request. The maximum supported value is 8192 bytes. After the request is approved, the quota takes effect automatically. No service restart is required.

How do I troubleshoot 503 Service Temporarily Unavailable errors for services registered via Python, Docker, or similar technologies?

Perform the following checks in order:

  1. In the Nacos console, confirm that the service is registered and the instance IP address is correct.

  2. Verify that the service provider and the consumer (gateway) are in the same Nacos namespace.

  3. Check the health check configuration. If authentication is enabled on your application, the health check endpoint (for example, /health) may return 401 instead of 200, causing Nacos to mark the instance as unhealthy and stop routing traffic to it. Adjust your authentication logic or specify the correct health check path.

  4. Verify that the gateway and the backend instance are network-reachable.

  5. In the MSE console, view the Push track information for the service to confirm that the correct instance IP address was delivered to the consumer.