Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Procedure

Updated on 2025-01-17 GMT+08:00

Authorizing a Source Code Repository

  1. Log in to CAE.
  2. Choose System Settings.
  3. Click Edit in the Source Code Repository Authorizations module. The Authorized Source Code Repository page is displayed.
  4. Click Create Authorization. The page for creating authorization is displayed.

    1. Click GitHub.
    2. Enter nacos-github in Authorization.
    3. Select OAuth for Method.
    4. Click Authenticate with OAuth.

  5. In the Service Statement dialog box, select I understand that the source code building function of the ServiceStage service collects the information above and agree to authorize the collection and use of the information. Click Confirm.
  6. After the authorization is complete, the GitHub login page is displayed.
  7. Enter the GitHub username or email address and password, and click Sign in. Wait until the OAuth authentication is complete and the CAE page is displayed.
  8. In the dialog box on the System Settings page, click OK to complete the authorization of the source code repository.

Creating and Deploying the nacos-provider Component

  1. Choose Components.
  2. Select the application and environment created in Prerequisites from the drop-down lists in the upper part of the page, and click Create Component.
  3. Configure the component by referring to Table 1.

    Table 1 Basic information about the nacos-provider component

    Parameter

    Description

    Component

    Enter a component name. In this practice, enter nacos-provider.

    Version

    Enter a component version.

    In this practice, enter 1.0.0.

    Specifications

    Select instance specifications, for example, 0.5 Core and 1 GiB.

    Instances

    Set it to 1.

    Code Source

    Choose Source code repository > GitHub and configure authorization information.

    • Authorization: nacos-github
    • Username/Organization: username or email address authorized by the user
    • Repository: nacos-example
    • Branch: master

    Language/Runtime System

    Select Java17.

    Custom Build

    1. Select Custom.
    2. Input the following information in the black box:
      cd ./nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-provider-example && mvn clean package

    Dockerfile Address

    Enter ./.

  4. Click Configure Component.
  5. On the Component Configurations page, click Configure of the Cloud Service Engine (CSE) module. The Set CSE page is displayed.
  6. Click Registry/Configuration Center and select the Nacos engine created in Prerequisites.
  7. Click Save.
  8. On the Component Configurations page, click Edit in the Environment Variables module to configure the nacos-provider component.
  9. Click Add Environment Variable and enter the variable name and value.

    • Name: JAVA_TOOL_OPTIONS
    • Variable/Variable Reference: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED

  10. Click OK.
  11. On the Component Configurations page, click Set and Deploy Component.
  12. Confirm the configuration information and click OK. Wait until the component deployment is complete.

Creating and Deploying the nacos-consumer Component

  1. In the navigation pane, choose Components to return to the components page.
  2. Select the application and environment created in Prerequisites from the drop-down lists in the upper part of the page, and click Create Component.
  3. Configure the component by referring to Table 2.

    Table 2 Basic information about the nacos-consumer component

    Parameter

    Description

    Component

    Enter a component name. In this practice, enter nacos-consumer.

    Version

    Enter a component version.

    In this practice, enter 1.0.0.

    Specifications

    Select instance specifications, for example, 0.5 Core and 1 GiB.

    Instances

    Set it to 1.

    Code Source

    Choose Source code repository > GitHub and configure authorization information.

    • Authorization: nacos-github
    • Username/Organization: username or email address authorized by the user
    • Repository: nacos-example
    • Branch: master

    Language/Runtime System

    Select Java17.

    Custom Build

    1. Select Custom.
    2. Input the following information in the black box:
      cd ./nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-consumer-example && mvn clean package

    Dockerfile Address

    Enter ./.

  4. Click Configure Component.
  5. On the Component Configurations page, click Configure of the Cloud Service Engine (CSE) module. The Set CSE page is displayed.
  6. Click Registry/Configuration Center and select the Nacos engine created in Prerequisites.

    NOTE:

    The nacos-consumer and nacos-provider components must be bound to the same Nacos engine.

  7. Click Save.
  8. On the Component Configurations page, click Edit in the Environment Variables module to configure the nacos-consumer component.
  9. Click Add Environment Variable and enter the variable name and value.

    • Name: JAVA_TOOL_OPTIONS
    • Variable/Variable Reference: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED

  10. Click OK.
  11. On the Component Configurations page, click Edit in the Access Mode module. The Set Access Mode page is displayed.
  12. On the Load Balancing tab, click Add Load Balancer and set parameters.

    • Protocol: Select TCP.
    • Listening Port: Enter 8080.
    • Access Port: Enter an access port. In this practice, enter 14688.

  13. Click OK.
  14. On the Component Configurations page, click Set and Deploy Component and wait until the component deployment is complete.
  15. Confirm the configuration information and click OK. Wait until the component deployment is complete.

Calling a Microservice

  1. Choose Components.
  2. Select the nacos-consumer component and click in the Access Address column to obtain the automatically generated external network access address.

    Figure 1 Obtaining the external network access address

  3. In the address box of the browser, enter http://External network access IP address:Access port/echo/{string}. The external network access IP address and access port are obtained in 2, and {string} is a custom string. Example: http://100.**.**.175:14688/echo/nacos-cae.

    If the welcome page shown in the following figure is displayed, Nacos is successfully called.
    Figure 2 Calling a microservice engine

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback