All Products
Search
Document Center

Microservices Engine:Manage services

更新時間:Sep 02, 2024

If your Nacos instance is hosted on Microservices Engine (MSE), MSE manages the services that are registered with the Nacos instance. This topic describes how to manage services.

Prerequisites

  • MSE is activated. For more information, see see Activate MSE.

  • A Nacos engine in version 2.0.3.0 or later is created. For more information about how to create a Nacos engine, see Create a Nacos engine. If the engine version is earlier than 2.0.3.0, you must upgrade the engine version. For more information about how to upgrade an engine version, see Update a Nacos version.

  • A namespace is created. For more information, see Create a namespace.

Create a service

Note

You can create an empty service in the MSE console to define or test the service in advance. For an empty service, no providers are available. To display an empty service in the MSE console, you must turn on Show Empty Service.

  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. On the page that appears, select a namespace from the Namespace drop-down list in the upper-left corner, and 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

    The instance source. Valid values: Console, SDK, and Microservices Governance.

    Protection Threshold

    If you set Instance Source to Console or SDK, you must specify this parameter. We recommend that you set the value to the proportion of the minimum number of nodes that can process the maximum traffic. For example, if 10 instance nodes are available, a minimum of 6 nodes can process the maximum traffic. If the number of nodes is less than 6, a system breakdown may occur. In this case, set this parameter to 0.6.

    If you set Instance Source to Microservices Governance, you must also configure the following parameters.

    Note

    The service subscription feature is automatically enabled for Nacos services whose Instance Source is Microservices Governance. If the service subscription feature is enabled, Domain Name System (DNS) blocking is enabled. When the Nacos service calls other services over HTTP, the DNS system that is used for calls preferentially returns the result that is resolved by the Nacos service.

    Parameter

    Description

    Namespace

    The namespace of the application for which Microservices Governance is enabled.

    Application Name

    The name of the application that is registered on Microservices Governance.

    Port Number

    The service port number. By default, Microservices Governance automatically scans the service port. You can also configure a service port.

    Enable Health Check

    Specifies whether to enable health check. By default, this switch is turned on, indicating that health check is enabled.

    Health Check Protocol

    The protocol that is used for Nacos health checks. Default value: Connection Status Check. Valid values:

    • Connection Status Check: The system checks whether an application is healthy by checking the status of a persistent connection between the application and the Nacos server. If a persistent connection exists, the application is healthy.

    • TCP: The system checks whether the server port runs as expected by sending SYN handshake packets.

    • HTTP: The system checks whether the server application is healthy by sending requests to simulate browser access behavior.

    If Health Check Protocol is set to TCP or HTTP, configure the following parameters.

    URI

    The path that is used for HTTP health checks. This parameter is valid only when Health Check Protocol is set to HTTP.

    Response Timeout Period

    The threshold for the timeout period of each health check response. If a health check does not provide a response within the period specified by this parameter, the application is considered unhealthy.

    Response Interval

    The interval between two consecutive health checks.

    Healthy Threshold

    The number of consecutive times that an application passes health checks before it is considered healthy.

    Unhealthy Threshold

    The number of consecutive times that an application fails to pass health checks before it is considered unhealthy.

    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 persisted.

    Protection Threshold

    If the ratio of healthy application instances to all application instances of the service is less than the specified threshold, the protection mechanism is triggered to prevent the system breakdown. Valid values: 0 to 1. Default value: 0.

    For more information, see Implement high availability capabilities of MSE Microservices Registry.

Delete a service

Note

You can only delete persistent services. Persistent services are not temporary 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. On the page that appears, select a namespace from the Namespace drop-down list in the upper-left corner, and click 图标.png in the Actions column of the service. In the list that appears, select Delete. In the Delete Service message, click OK.

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, choose Service Management > Services. On the page that appears, select a namespace from the Namespace drop-down list in the upper-left corner.

    You can view the information about all services in the selected namespace of the Nacos instance. The information includes Service Name, Group Name, Number of providers, and Number of Clusters.

    You can perform the following operations:

    • View the details of a service: Click the service name to view service details.

      • In the upper part of the service details page, view the basic information about the service, such as Service Name, Service Group, Persistence, and Number of Clusters.

      • Click the Provider tab to view all the application instances that provide the created service. Application instances are displayed by logical cluster. By default, the providers of the first logical cluster are displayed.

        • In the All Clusters section on the left, click the name of the logical cluster to view the information about application instances in the cluster.

        • In the Actions column of the application instance that you want to manage, edit the weight value, start the instance, shut down the instance, delete the instance, or view metadata.

      • Click the Subscriber tab to view a list of clients that subscribe to the current service. In the list, you can view the IP addresses and client versions of subscribers.

      • Click the Push track tab to view the push tracking details of the current service, such as Push Time, Push Client IP Address, Push service name, Push Service Group, Number of Instances, and Node name.

    • Delete a service: On the service details page, find the service that you want to delete, and click Delete in the Actions column. In the Delete Service message, click OK.

      Important
      • MSE allows you to only delete empty services. If the number of providers is not 0, the Delete button is dimmed.

      • If a service remains empty for more than 1 minute, the Nacos instance automatically deletes the service.

Add application instances for a service

You can add application instances (providers) for a service in the MSE console to define or test the instances in advance.

  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. On the page that appears, select a namespace from the Namespace drop-down list in the upper-left corner

  5. Click the service name to view service details.

  6. Click the Provider tab, and click Create an instance. In the Create an instance dialog box, configure the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    IP

    Enter the IP address of the application instance.

    Port Number

    Enter the port number of the application instance.

    Cluster Name

    Enter the name of the logical cluster to which the application instance belongs on the Nacos instance. Default value: DEFAULT.

    Up and down line status

    Select the initial status of the application instance. Default value: Yes. This value indicates that the initial status of the application instance is online.

    Weight

    Enter a weight value of the application instance. Valid values: 0 to 10000. Default value: 1. Traffic is allocated based on weights. A larger weight indicates that more traffic is allocated.

    If the weight that you specify does not take effect, resolve the issue by following steps in What do I do if the modified weight of an application instance does not take effect on an MSE Nacos instance?

Start or shut down an application instance

Note

You can start or shut down application instances that are registered with your Nacos instance.

  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. On the page that appears, select a namespace from the Namespace drop-down list in the upper-left corner.

  5. Click the service name to view service details.

  6. Click the Provider tab. Find the application instance that you want to manage, and click On line or Offline in the Actions column. In the message that appears, click OK.