Updated on 2024-05-28 GMT+08:00

Managing Microservices

You can use the microservice catalog to view microservice details and search for target microservices to maintain microservices. The Microservice Catalog page contains the following tabs:

  • Application List: displays all applications of the current microservice engine. You can search for the target application by application name, or filter applications by environment. For details, see Viewing the Application List.

  • Microservice List: For details about the operations supported by in Microservice List, see the following table.

    Operation

    Description

    Viewing the Microservice List

    Displays all microservices of the current microservice engine. You can search for the target microservice by microservice name, or filter microservices by environment and application.

    Viewing Microservice Details

    On the microservice details page, you can view the instance list, called services, calling services, dynamic configuration, and service contract.

    Creating a Microservice

    Creates a microservice.

    Cleaning Versions Without Instances

    Cleans microservice versions that have no instances.

    Deleting a Microservice

    Deletes a microservice that is no longer used.

    Dynamic Configuration

    Creates a microservice-level configuration.

    Dark Launch

    In dark launch, new features are tested in a selected group of users. When the features become mature and stable, they are released to all users.

  • Instance List: For details about the operations supported by in Instance List, see the following table.

    Operation

    Description

    Viewing the Instance List

    Displays all instances of the current microservice engine. You can search for the target instance by microservice name, or filter instances by environment and application.

    Changing the Instance Status

    Status indicates the status of a microservice instance.

Viewing the Application List

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Click Application List to view details about all applications of the current account under the engine.

    You can search for the target application by application name, or filter applications by environment.

Viewing the Microservice List

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Click Microservice List to view all microservices of the current account under the engine.

    You can search for the target microservice by microservice name, or filter microservices by environment and application.

Viewing Microservice Details

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For microservice engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Click the microservice to be viewed in Microservice List. On the displayed page, view the instance list, called services, calling services, configurations, and service contract.

Creating a Microservice

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  1. Choose Microservice List > Create a Microservice and set microservice parameters by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    *Microservice

    Microservice name, for example, myServiceName.

    *Application

    Name of the application to which the microservice belongs. Microservices are isolated by applications.

    *Version

    Microservice version. The default value is 1.0.0.

    NOTE:

    The microservice version is in the format of X.Y.Z or X.Y.Z.B, where X, Y, Z, and B are digits and range from 0 to 32767. The value contains 3 to 46 characters.

    *Environment

    Environment where the microservice is located to isolate microservice data, including the version and instance.

    Detail

    Microservice description.

  2. Click OK.

    Once the microservice is created, it will be displayed in Microservice List.

Cleaning Versions Without Instances

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Choose Microservice List > Clean No Instance Services. Select the microservice version without instances to be cleaned.

    You can search for the target microservice by microservice name, or filter microservices by environment and application.

  6. Click OK.

Deleting a Microservice

  • After a microservice is deleted, you can restore it by referring to Restoring Backup Data.
  • If the service to be deleted has instances, delete the instances first. Otherwise, the service will be registered again.
  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Click Microservice List.

    • To delete microservices in batches, select the microservices to be deleted and click Delete above the microservices.
    • To delete one microservice, locate the row that contains the microservice to be deleted and click Delete in the Operation column.

  6. In the displayed dialog box, enter DELETE to confirm the deletion and click OK.

Dynamic Configuration

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  4. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  5. Click Microservice List.
  6. Click the target microservice.
  7. Choose Dynamic Configuration. On the Dynamic Configuration tab, perform the following operations.

    Configuration items are stored in plaintext. Do not include sensitive data.

    Operation

    Procedure

    Creating a configuration item

    See Creating a Microservice-Level Configuration. Microservice-level is selected for Configuration Range and Microservices is set to the current microservice.

    Viewing historical versions

    Click View Historical Version in the Operation column of the target configuration item.

    Disabling a Configuration Item

    1. In the Operation column of the target configuration item, choose More > Disable.
    2. Click OK.

    Modifying a configuration item

    1. Click Edit in the Operation column corresponding to the target configuration item.
    2. On the configuration details page, click Edit.
    3. On the Configuration Details tab, enter the new configuration.
    4. Click Save.

    Deleting a configuration item

    1. In the Operation column of the target configuration item, choose More > Delete.
    2. Click OK.

Dark Launch

In dark launch, new features are tested in a selected group of users. When the features become mature and stable, they are released to all users. This ensures the smooth feature rollout.

  • For microservices developed based on the ServiceComb Java Chassis framework, add dependency darklaunch or handler-router to POM and add servicecomb.router.type=router to the configuration file.
  • For microservices developed based on the Spring Cloud Huawei framework, add dependency spring-cloud-starter-huawei-router to POM.
  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  1. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  2. Choose Microservice Catalog.

    • For engines with security authentication disabled, go to 5.
    • For engines with security authentication enabled, go to 4.

  3. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  4. In the microservice list, click a microservice. On the displayed page, choose Dark Launch.
  5. Click Add Launch Rule.

    • To add a launch rule by Weight:
      1. Click Weight.
      2. Set the following parameters.

        Item

        Description

        Rule Name

        Name of the rule.

        Scope

        • Microservice version to which the rule applies.
        • Select Do you want to add a customized version? and add a new version as prompted.

        Rule Configuration

        Traffic allocation rate for the selected version. Traffic is evenly allocated to the selected service versions based on the configured value.

      3. Click OK to complete the weight rule configuration and dark launch.
    • To add a launch rule by Customization:

      Dark launch rules can be delivered only after dark launch is implemented for microservices developed based on the ServiceComb Java Chassis framework using dependency darklaunch and microservices developed based on the Spring Cloud Huawei framework. Dark launch rules that depend on handler-router need to be manually delivered in the configuration center.

      1. Click Custom.
      2. Set the following parameters.

        Item

        Description

        Rule Name

        Name of the rule.

        Scope

        • Microservice version to which the rule applies.
        • Select Do you want to add a customized version? and add a new version as prompted.

        Rule Configuration

        Configure the matching rule. When darklaunch is used to implement dark launch, this parameter configures policyCondition. Otherwise, it configures Headers.

        • Parameter Name

          Set this parameter based on the parameter name of contract or the customized key of the header.

        • Rules
          By selecting the matching character and the value corresponding to the key of contract or the key of the header, requests that meet the rules are allocated to the microservice version.
          NOTE:
          • If ~ is selected from the drop-down list next to Rules, the asterisk (*) and question mark (?) in the Rules value can be used for fuzzy matching. The asterisk (*) indicates a character of any length, and the question mark (?) indicates one character. For example, if the rule value of Name is set to *1000, all Name fields ending with 1000 can be matched.
          • If ~ is not selected from the drop-down list next to Rules, the asterisk (*) and question mark (?) in the Rules value cannot be used for fuzzy matching.

      3. Click OK to complete the customization rule configuration and dark launch.

Examples of delivering dark launch rules:

  • For microservices developed based on the ServiceComb Java Chassis framework, rules are delivered based on dependency darklaunch on the microservice engine page. You can add dark launch rules in customized mode.

    This key must exist in the contract. It is possible that the server API is String paramA, but paramB is actually generated after the annotation is added. Therefore, paramB should be set here.

    By selecting the matching character and the value corresponding to the key of contract, requests that meet the rules are allocated to the microservice version.

    A delivered rule is as follows. The configuration item is cse.darklaunch.policy.${serviceName}.

  • For microservices developed based on the ServiceComb Java Chassis framework, dark launch rules that depend on handler-router need to be manually delivered in the configuration center. The configuration item is servicecomb.routeRule.${serviceName}. The content is as follows:

  • For microservices developed based on the Spring Cloud Huawei framework, dark launch rules delivered on the microservice engine page are as follows:

Viewing the Instance List

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  1. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  1. Choose Microservice Catalog.

    • For microservice engines with security authentication disabled, go to 5.
    • For microservice engines with security authentication enabled, go to 4.

  2. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  3. Click Instance List to view all instances of the engine.

    You can search for the target instance by microservice name, or filter instances by environment and application.

Changing the Instance Status

Status indicates the status of a microservice instance.

The status of microservice instances synchronized by binding microservice engines cannot be changed during component creation and deployment by referring to Creating and Deploying a Component.

The following table describes the microservice instance statuses.

Status

Description

Online

The instance is running and can provide services.

Offline

Before the instance process ends, the instance is marked as not providing services externally.

Out of Service

The instance has been registered with the microservice engine and does not provide services.

Testing

The instance is in the internal joint commissioning state and does not provide services.

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  1. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  1. Choose Microservice Catalog.

    • For microservice engines with security authentication disabled, go to 5.
    • For microservice engines with security authentication enabled, go to 4.

  2. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  3. Click Instance List, select the target instance, and change the instance status.

    • Offline

      In the Operation column, click Offline.

    • Online

      In the Operation column, choose More > Online.

    • Out of Service

      In the Operation column, choose More > Out of Service.

    • Testing

      In the Operation column, choose More > Testing.