Updated on 2024-10-15 GMT+08:00

Service Management

You can use the CSE console to manage services registered with Nacos.

Prerequisites

A Nacos engine instance has been created.

Creating a Service

You can create a service on the console. The newly created service is an empty service (that is, the number of providers is 0). By default, the empty service is displayed in the service list. If you do not want to display the empty service, click next to Hide Empty Service.

  1. Log in to CSE.
  2. In the left navigation pane, choose Registry/Configuration Center.
  3. Click the target Nacos instance.
  4. Choose Service Management.
  5. Select a namespace from the Namespace drop-down list. The ID is automatically filled in the Namespace ID box.

    If the selected namespace is public, the namespace ID is empty by default.

  6. Click Create Service. In the displayed dialog box, set configuration items as follows. Configuration items marked with an asterisk (*) are mandatory.

    Table 1 Parameters

    Parameter

    Description

    *Service Name

    Enter a service name. The value can contain a maximum of 236 characters, including digits, letters, and special characters "_-.:".

    Group

    Set the group to which the service belongs. The value can contain a maximum of 128 characters, including digits, letters, and special characters "_-.:".

    *Protection Threshold

    If the ratio of healthy instances to the total instances is less than the threshold, a protection threshold is triggered. The value ranges from 0 to 1. The default value is 0.

  7. Click OK.

Viewing the Service List

  1. Log in to CSE.
  2. In the left navigation pane, choose Registry/Configuration Center.
  3. Click the target Nacos instance.
  4. Choose Service Management. Select a namespace from the Namespace drop-down list. The ID is automatically filled in the Namespace ID box.

    If the selected namespace is public, the namespace ID is empty by default.

  5. View all services in the namespace of the engine.

    You can search for the target service by service name or group name.

    Target service fuzzy search supports characters: ,$*+.|?

Viewing Service Details

  1. Log in to CSE.
  2. In the left navigation pane, choose Registry/Configuration Center.
  3. Click the target Nacos instance.
  4. Choose Service Management.
  5. Click the target service to view its details.

    • View basic service information, including the service name, namespace name, service group, namespace ID, protection threshold, and number of clusters.
    • The Instances tab displays the instance information, including the IP address, port number, cluster, health status, online/offline status, weight, and metadata. You can also perform Instance Operations, such as searching for instances based on metadata, bringing instances online/offline, and modifying weights.
    • The Subscribers tab displays the list of all client instances that subscribe to the current service. Versions of subscribers and clients are displayed in the list.

Instance Operations

  • Search by metadata: On the Instances tab, select a cluster from Clusters, enter the metadata key and value in Search Metadata, and click Filter to display the instances that meet the search criteria. Click Clear to clear the search data.
  • Bring an instance online or offline: On the Instances tab, click Online or Offline in the Operation column of the target instance. The instance status will be updated accordingly.
  • Modify instance weight: On the Instances tab, move the cursor to the Weight column of the target instance, click to modify the weight (ranging from 1 to 99), and click OK.
    To use the Nacos weight function for traffic load balancing, register NacosRule provided by Nacos as a bean on the client.
    @Bean
    NacosRule nacosRule() {
        return new NacosRule();
    }
    Add the following configuration item to the application.properties configuration file:
    xxx-service.ribbon.NFLoadBalancerRuleClassName=com.alibaba.cloud.nacos.ribbon.NacosRule
    xxx-service indicates the service name of the client, that is,
    spring.application.name=xxx-service

Deleting a Service

  • Only empty services can be deleted. If the number of instance is not 0, the services cannot be deleted.
  • If a service remains empty for more than 1 minute, the Nacos automatically deletes the service.
  1. Log in to CSE.
  2. In the left navigation pane, choose Registry/Configuration Center.
  3. Click the target Nacos instance.
  4. In the left navigation pane, choose Service Management and click Delete in the Operation column of the target service.
  5. In the displayed dialog box, click OK.