faqs - huawei cloud...7.8 what database does the service center use? what are the differences...

42
ServiceStage FAQs Issue 01 Date 2021-04-08 HUAWEI TECHNOLOGIES CO., LTD.

Upload: others

Post on 04-Nov-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

ServiceStage

FAQs

Issue 01

Date 2021-04-08

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Copyright © Huawei Technologies Co., Ltd. 2021. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. i

Page 3: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Contents

1 SDK FAQs................................................................................................................................... 1

2 Environment Management................................................................................................... 32.1 What Is a Node?...................................................................................................................................................................... 32.2 What Is a Namespace?.......................................................................................................................................................... 32.3 What Is an Environment Variable?................................................................................................................................... 32.4 What Are the Differences Between Open-Source ServiceComb and CSE?......................................................... 42.5 What Are the Differences Between the Microservice and Platform Service?.....................................................42.6 What Are the Differences Between the CSE Dashboard and Eureka?..................................................................42.7 Can Microservice Engines Be Billed Yearly/Monthly?................................................................................................. 42.8 Package Upgrade.....................................................................................................................................................................4

3 Application Management......................................................................................................53.1 How Do I View the Causes of Application Component Deployment Failures?................................................. 53.2 What If an Instance Is Being Created for a Long Time?............................................................................................63.3 Docker Application Dependency........................................................................................................................................ 73.4 How Do I Customize a Tomcat Context Path?.............................................................................................................. 73.5 Can a Microservice Be Used to Create Multiple Workloads or Release Multiple Image Tags?................... 73.6 What Are Affinity Scheduling and Anti-Affinity Scheduling?...................................................................................73.7 How Do I Use a Fixed Application Component IP?..................................................................................................... 83.8 What Are Scheduling Policies?........................................................................................................................................... 93.9 Does the Governance Center Use Hystrix Capabilities? What Is Enhanced?......................................................9

4 Continuous Delivery............................................................................................................. 104.1 How Do I Add the Build Server Address to the GitLab Server Security Group?..............................................104.2 How Do I Add the Build Server Address to the Maven Server Security Group?............................................. 11

5 Software Center.....................................................................................................................125.1 What If a Software Package Fails to Be Uploaded?................................................................................................. 125.2 What If the Docker Client Fails to Push Images?...................................................................................................... 135.3 What If an SWR Software Package Fails to Be Downloaded?.............................................................................. 14

6 Infrastructure......................................................................................................................... 156.1 How Do I Troubleshoot Insufficient EIPs When a Node Is Added?..................................................................... 156.2 How Do I Bind an ElP?........................................................................................................................................................ 166.3 How Do I Move a Node from One Cluster to Another?..........................................................................................16

ServiceStageFAQs Contents

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

6.4 How Do I View Purchased ECS Resources on ServiceStage?................................................................................. 166.5 Are Existing Programs Affected If I Unsubscribe Servers?...................................................................................... 176.6 Can Basic Resources Be Managed on ServiceStage?................................................................................................ 176.7 Why Does ConfigServer Query Fail During Git Configuration?............................................................................ 17

7 Application O&M...................................................................................................................187.1 How Do I View Logs on ServiceStage?.......................................................................................................................... 187.2 What If Application Access Mode Becomes Invalid When EIP Is Replaced?.................................................... 187.3 What If the Memory Usage of a Node Becomes Too High After a New Service Is Started?.....................19

8 Application Development....................................................................................................208.1 What Are the Differences Between the Microservice and Common Application?.........................................208.2 How Do I Handle a Microservice Registry Failure (Java Chassis)?...................................................................... 218.3 How Do I Troubleshoot Microservices Deployed on the Cloud?.......................................................................... 238.4 Should I Use the SDK or ServiceMesh to Build a Microservice?........................................................................... 248.5 Is the Microservice Bound to the Public Cloud? How Do I Perform Local Development?.......................... 248.6 Common Problems with Switching SpringBoot Applications to the CSE Java SDK Framework............... 248.7 What If I Fail to Obtain a Dependency?....................................................................................................................... 258.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka?............................................................................................................................................................................................................ 268.9 What Are the Differences Between the Configuration Center and Spring Cloud Config?.......................... 268.10 Why Should I Use CSE?.................................................................................................................................................... 278.11 How Can I Obtain the CSE Service Center Address?.............................................................................................. 278.12 What Is Service Name Duplication Check?............................................................................................................... 288.13 Why Do I Have to Define Service Contracts?........................................................................................................... 28

9 Java SDK FAQs........................................................................................................................309.1 How Do I Extend AK/SK Decryption Methods?.......................................................................................................... 309.2 How Do I Perform Local Development and Testing?............................................................................................... 319.3 Why Is "Invalid request, header is invalid, ak sk or project is empty." Displayed When I Attempt toConnect to the Service Center?............................................................................................................................................... 349.4 Why Is "validate ak sk error" Displayed When I Attempt to Connect to the Service Center?...................359.5 Why Is "get project token from iam failed" Displayed When I Attempt to Connect to the ServiceCenter?............................................................................................................................................................................................. 359.6 Why Is "Version validate failed" Displayed When I Attempt to Connect to the Service Center?............. 369.7 Why Is "Not enough quota" Displayed When I Attempt to Connect to the Service Center?.................... 36

10 Go SDK FAQs........................................................................................................................ 3710.1 How Can I Handle a Certificate Loading Error?...................................................................................................... 3710.2 What If the Header Name Is Invalid?..........................................................................................................................37

ServiceStageFAQs Contents

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. iii

Page 5: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

1 SDK FAQs

Key InformationTo facilitate quick fault locating, provide detailed key information when posting anissue in the community. You are advised to provide a demo that can reproduce thefault.

The following uses ServiceComb Java chassis as an example:

1. Framework logs: By default, framework logs are printed with service logs, andthe cse.log file is generated in the root directory. If the log framework such asLog4j2 or Logback is used on the service side, search for the key informationbased on the customized log policy.

a. Key information about service startup:

Table 1-1 Key information about service startup

Keyword Description

chooseorg.apache.servicecomb

ServiceComb Java chassis supports two types ofREST communication channels. You need todetermine the communication channel to beused based on logs.The chooseorg.apache.servicecomb.transport.rest.vertx.VertxRestTransport framework uses the REST overVertx communication channel by default. That is,Vertx is used as the HTTP server.The chooseorg.apache.servicecomb.transport.rest.servlet.ServletRestTransport framework also supportsthe REST over Servlet communication channel.That is, other HTTP servers, such as Tomcat, areused.

endpoint to publish Microservice release address.

ServiceStageFAQs 1 SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 1

Page 6: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Keyword Description

Registermicroserviceinstance success

Flag indicating a successful service instanceregistration.

b. Key information about service calling:

Table 1-2 Key information about service calling

Keyword Description

find instances Before calling the server (called service), theconsumer (calling service) queries the serverinstance from the service center of themicroservice engine.

accesslog The access.log file records the request sources,such as APIs and status codes for calling theservice. By default, this function is disabled.

The access.log file printing is affected by the communication channeland log framework. If the REST over Vertx communication channel isused, the access.log file is recorded by Vertx. For details, see https://docs.servicecomb.io/java-chassis/en_US/build-provider/access-log-configuration/.The recommended format of the access.log file is as follows:servicecomb.accesslog.pattern: "%h - - %t cs-uri %s %B %D %H %SCB-traceId"

By default, the access.log file is generated in the root directory. If the logframework such as Log4j2 or Logback is used on the service side, you canswitch the log framework by referring to https://docs.servicecomb.io/java-chassis/en_US/build-provider/access-log-configuration/.If the REST over Servlet communication channel is used, the access.logfile is recorded by the HTTP server. To use the access.log file, find therelated reference.For example, enable the built-in Tomcat of Spring Boot as follows:server: tomcat: accesslog: enabled: true pattern: '%h %l %u %t "%r" %s %b %D' directory: accesslogs buffered: false basedir: ./logs

2. Versions of the microservice engine and SDK. You can click the engine nameto view the microservice engine version. For the SDK version, search for thedependency whose groupId is org.apache.serivcecomb.

ServiceStageFAQs 1 SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 2

Page 7: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

2 Environment Management

What Is a Node?

What Is a Namespace?

What Is an Environment Variable?

What Are the Differences Between Open-Source ServiceComb and CSE?

What Are the Differences Between the Microservice and Platform Service?

What Are the Differences Between the CSE Dashboard and Eureka?

Can Microservice Engines Be Billed Yearly/Monthly?

Package Upgrade

2.1 What Is a Node?A node is a virtual machine (VM) on which containerized applications run. A nodeagent (kubelet) runs on each node. The kubelet is used to manage containerinstances running on nodes.

A node supports at least 1 CPU core and 2048 MB memory and at most 32 CPUcores and 128 GB memory.

2.2 What Is a Namespace?Multiple namespaces can be created inside a cluster and isolated from each other.This enables namespaces to share the same cluster services without affecting eachother.

2.3 What Is an Environment Variable?An environment variable is set in the container running environment. You can setmultiple environment variables when creating a container template. Environmentvariables can be modified after applications are deployed, providing greatflexibility for applications.

ServiceStageFAQs 2 Environment Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 3

Page 8: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

2.4 What Are the Differences Between Open-SourceServiceComb and CSE?

CSE Java SDK is the commercial version of ServiceComb. With most of thecomponents inherited from ServiceComb, CSE Java SDK also provides commercialfeatures of the public cloud, such as interconnection capability, security, anddistributed data consistency. These commercial features are not open-source, butare free of charge.

2.5 What Are the Differences Between the Microserviceand Platform Service?

The microservice is an architecture model used to build an application system. Theplatform service is the middleware service provided by the cloud.

You must purchase a platform service to use it To use a microservice, first developit and release it on the cloud through the service discovery capability provided bythe cloud.

2.6 What Are the Differences Between the CSEDashboard and Eureka?

Eureka does not have a dashboard. The CSE dashboard is developed by referringto Hystrix Dashboard, and displays decision input data for service governance.

2.7 Can Microservice Engines Be Billed Yearly/Monthly?Professional engines support pay-per-use billing, but do not support yearly/monthly billing. Exclusive engines support yearly/monthly billing and arerecommended. Professional engines are shared by all users while exclusive enginesare exclusive to individual users. For details about how to buy exclusive engines,see Creating an Exclusive Microservice Engine.

2.8 Package Upgrade

Question

Can I upgrade the basic edition to the professional or platinum edition? If yes, willthe upgrade affect existing services?

Answer

The basic edition can be upgraded to the professional or platinum edition, and theupgrade does not affect existing services. However, only the administrator canperform the upgrade, and IAM users do not have the permissions.

ServiceStageFAQs 2 Environment Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 4

Page 9: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

3 Application Management

How Do I View the Causes of Application Component Deployment Failures?

What If an Instance Is Being Created for a Long Time?

Docker Application Dependency

How Do I Customize a Tomcat Context Path?

Can a Microservice Be Used to Create Multiple Workloads or Release MultipleImage Tags?

What Are Affinity Scheduling and Anti-Affinity Scheduling?

How Do I Use a Fixed Application Component IP?

What Are Scheduling Policies?

Does the Governance Center Use Hystrix Capabilities? What Is Enhanced?

3.1 How Do I View the Causes of ApplicationComponent Deployment Failures?

Symptom

After the application component is deployed, the status is displayed as Not Ready,indicating that the application component fails to be deployed.

Solution

Step 1 Log in to ServiceStage and choose Application Management > Application List.

Step 2 Click an application name. The application overview page is displayed.

Step 3 On the Component List tab page, click the name of the target component. Thecomponent overview page is displayed.

Step 4 Select the abnormal component and click the component name. The instanceoverview page is displayed.

ServiceStageFAQs 3 Application Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 5

Page 10: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Step 5 Choose Instance Tabulation, click next to an instance, and click Event.

Step 6 View abnormal events. For example, if the event type is Alarm, view the alarmdescription and determine the cause.

----End

3.2 What If an Instance Is Being Created for a LongTime?

After an application component is created, if the service instance is in the Notready state for a long time, go to the service instance list and check the instancedetails. On the Event tab page, you can see that the memory is insufficient.

To solve the problem, perform the following:

Step 1 Log in to the CCE console and choose Resource Management > Clusters.

Step 2 Click the name of the target cluster to enter its details page.

Step 3 Choose Nodes. The node management page is displayed.

Step 4 Click Buy Node and set parameters based on the following table. Retain thedefault values for the parameters that are not listed.

Table 3-1 VM information

Parameter Description

EIP Select Automatically assign.Use the default value.

Login Mode A key pair is used for identity authentication when youremotely log in to the node. Select an existing key pair.

Key Pair 1. Select an existing key pair.Alternatively, click Create a key pair to create one.

2. Select I acknowledge that I have obtained privatekey file xxxx.pem and that without this file I willnot be able to log in to the node.

Step 5 Click Next: Confirm.

Step 6 Select I am aware of the above limitations and click Pay Now to create a node.

ServiceStageFAQs 3 Application Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 6

Page 11: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

It takes 6–10 minutes to create a node. The creation progress will be displayed. Ifthe node status is Available on the node list page, the node is added successfully.

----End

3.3 Docker Application DependencySymptom

A node program depends on node-gyp when running in the microservice docker.How can I install the dependency before compiling the program?

SolutionCustomize a Dockerfile and compile the node-gyp dependency in the Dockerfile.

3.4 How Do I Customize a Tomcat Context Path?When creating a Tomcat application, Tomcat configurations are required.Specifically, the default server.xml configuration is used, the context path is /, andno application path is specified. The application access address is http://example_domain/.

Click Change (for details, see "Deploying a Component" in ServiceStage UserGuide) and modify the following example to customize an application path. Theapplication access address is http://example_domain/app-path.<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" > <Context path="app-path" docBase="ROOT.war"/></Host>

3.5 Can a Microservice Be Used to Create MultipleWorkloads or Release Multiple Image Tags?

Workload is the management unit of the deployment system. Generally, it is aprocess. The deployment system schedules workloads and processes run within theworkloads. Microservices are defined by service. That is, when a process provides aservice, such a service is a microservice. Therefore, a microservice can havemultiple workloads (one process has multiple copies). Each workload can releasean image tag. These workloads provide the same service. HUAWEI CLOUD usesKubernetes for deployment. To reduce resource consumption, you can create onlyone workload for a service and create multiple instances.

3.6 What Are Affinity Scheduling and Anti-AffinityScheduling?

If an application is not containerized, multiple components of the application mayrun on the same virtual machine, and processes communicate with each other.

However, for containerization, software processes are packed into differentcontainers and each container has its own lifecycle. For example, the transaction

ServiceStageFAQs 3 Application Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 7

Page 12: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

process is packed into a container whereas the monitoring/logging process andlocal storage process are packed into other ones. If closely related containerprocesses run on distant nodes, routing between them will be costly and slow.

● Affinity: Containers are scheduled onto the nearest node. This makes routingpaths between containers as short as possible, which in turn reduces networkoverhead.

● Anti-affinity: Instances of the same application are spread across differentnodes to achieve higher availability. Once a node is down, instances on othernodes are not affected.

3.7 How Do I Use a Fixed Application Component IP?

Symptom

If TCP/UDP Route Configuration is not set during application componentdeployment, the access IP address of the application changes when the containerrestarts. This may create difficulties in your configuration.

Solution

Set TCP/UDP Route Configuration when creating or deploying an applicationcomponent. You can solve the problem using any of the following methods:

● Intra-cluster access: An application can be accessed by other applications inthe same cluster using an internal domain name.

● Intra-VPC access: An application can be accessed by other applications in thesame VPC using the IP address of a cluster node or the IP address of an ELBservice in a private network.

● External access: An EIP is used to access applications from a public network.This access mode is applicable to services that need to be exposed to a publicnetwork in the system. In this access mode, EIP must be bound to any node inthe cluster and a port mapped to the node must be configured.

ServiceStageFAQs 3 Application Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 8

Page 13: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

3.8 What Are Scheduling Policies?Based on the deployment features of application components, ServiceStage dividesapplication components into minimum deployment instances. The applicationscheduler monitors instance information about applications in real time. Whendetecting a new instance, the application scheduler calculates all remainingcompute, storage, and network resources in the cluster to obtain the most suitabletarget node for scheduling.

ServiceStage supports multiple scheduling algorithms, including affinity schedulingbetween applications and nodes and affinity/anti-affinity scheduling betweenapplications.

3.9 Does the Governance Center Use HystrixCapabilities? What Is Enhanced?

The circuit breaker and service degrade capabilities of the governance center usepart of Hystrix capabilities, and the service discovery capability uses part of Ribboncapabilities. Based on those capabilities, the governance center uses the CSEservice schema to support microservice governance with more specificgranularities (such as service and operation), and to provide governancecapabilities, such as instance access error retry and isolation, and priority of servicediscovery between multiple data centers. In addition, original governance methodsprovided by open-source libraries are encapsulated properly and can be directlyconfigured in the governance center without further coding.

ServiceStageFAQs 3 Application Management

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 9

Page 14: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

4 Continuous Delivery

How Do I Add the Build Server Address to the GitLab Server Security Group?

How Do I Add the Build Server Address to the Maven Server Security Group?

4.1 How Do I Add the Build Server Address to theGitLab Server Security Group?

BackgroundIf your GitLab service is built on the intranet of a public cloud, and the publicnetwork cannot be accessed directly, add the address of the build service to yourGitLab server's security group to ensure that the build task can run.

Procedure

Step 1 Check the running node of the build image.

1. Check the job definition to obtain the build cluster name and labelinformation, as shown in the following figure.

2. Choose Infrastructure > K8S Cluster . On the page that is displayed, obtainthe EIP of the node in the cluster, as shown in the following figure.

Step 2 Add the network segment 43.254.0.0/24 where ServiceStage is located to thesecurity group of the node where the GitLab private repository resides. The build

ServiceStageFAQs 4 Continuous Delivery

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 10

Page 15: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

service uses this IP address segment to access the GitLab service API. For detailsabout how to set a security group, see Adding a Security Group Rule.

Step 3 Add the running node of the build image obtained in Step 1 to the security groupof the node where the GitLab private repository resides. During the build, the buildservice accesses the GitLab service to pull the code. For details, see Step 2.

----End

4.2 How Do I Add the Build Server Address to theMaven Server Security Group?

BackgroundAdd the EIP obtained in Step 1 to the security group of the node where theprivate Maven service resides to enable the build service to access the Mavenserver to download the dependency package.

ProcedureFor details about how to set a security group, see Adding a Security Group Rule.

ServiceStageFAQs 4 Continuous Delivery

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 11

Page 16: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

5 Software Center

What If a Software Package Fails to Be Uploaded?

What If the Docker Client Fails to Push Images?

What If an SWR Software Package Fails to Be Downloaded?

5.1 What If a Software Package Fails to Be Uploaded?

SymptomWhen a software package that meets the system requirements is uploaded, thesystem displays No access permission. Contact the administrator.

Solution

Step 1 In Google Chrome, choose More tools > Clear browsing data.

ServiceStageFAQs 5 Software Center

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 12

Page 17: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Figure 5-1 Clearing browsing data

Step 2 In the displayed Clear browsing data dialog box, retain the default settings andclick CLEAR BROWSING DATA.

----End

5.2 What If the Docker Client Fails to Push Images?

Symptom

A tenant or user logs in to the Docker client and runs the following command topush an image:

docker push 10.125.54.133:20202/test1/busybox:latest

NO TE

● 10.125.54.133:20202 indicates the IP address and port number of the repository towhich the tenant or user is to push an image.

● test1 indicates a namespace.

However, the image fails to be pushed, and the following information is displayedon the Docker client:

unauthorized: authentication required

ServiceStageFAQs 5 Software Center

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 13

Page 18: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Solution

Step 1 Use a correct AK/SK to log in to the Docker client.

Step 2 Push an image to a namespace on which the current tenant or user has theoperation permissions, or replace the namespace with a new one.● Run the following command to push an image to a namespace on which the

current tenant or user has the operation permissions:docker push 10.125.54.133:20202/test2/busybox:latest

NO TE

– 10.125.54.133:20202 indicates the IP address and port number of the repository towhich the tenant or user is to push an image.

– test2 indicates the namespace on which the tenant or user has the operationpermissions.

● Run the following command to replace the namespace with a new one:docker push 10.125.54.133:20202/test3/busybox:latest

NO TE

– 10.125.54.133:20202 indicates the IP address and port number of the repository towhich the tenant or user is to push an image.

– test3 indicates a new namespace.

Step 3 After the image is pushed, the following information is displayed:The push refers to a repository [10.125.54.133:20202/test2/busybox]6a749002dd6a: Pushedlatest: digest: sha256:ecb3f3e96e003af6e02f0f47ac4d25a3b0585db54de0a82bb070f8cb78a79bc7 size: 527

If an exception occurs, contact technical support.

----End

5.3 What If an SWR Software Package Fails to BeDownloaded?

SymptomWhen a Tomcat application is created, a message is displayed, indicating that thecreation fails. Tomcat logs show that the authentication fails when the SWRsoftware package is downloaded. Error 401 is displayed when the SWR softwarepackage is downloaded manually.

SolutionSet the image to a public one. Private packages cannot be obtained, due toinsufficient permissions.

ServiceStageFAQs 5 Software Center

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 14

Page 19: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

6 Infrastructure

How Do I Troubleshoot Insufficient EIPs When a Node Is Added?

How Do I Bind an ElP?

How Do I Move a Node from One Cluster to Another?

How Do I View Purchased ECS Resources on ServiceStage?

Are Existing Programs Affected If I Unsubscribe Servers?

Can Basic Resources Be Managed on ServiceStage?

Why Does ConfigServer Query Fail During Git Configuration?

6.1 How Do I Troubleshoot Insufficient EIPs When aNode Is Added?

SymptomWhen Use existing is selected for EIP during node creation, the node fails to becreated and the system displays a message indicating that EIPs are insufficient.

SolutionTo solve this problem, use any of the following methods:

● Method 1: Unbind a node bound to an EIP and add a new node.

a. Log in to the public cloud.b. Choose Network > Virtual Private Cloud.c. In the navigation pane, choose Elastic IP and Bandwidth > EIPs.d. Click Unbind next to the target ECS, unbind the EIP from the ECS, and

click Yes.● Method 2: Submit a service ticket to increase the EIP quota.

There are limits on the number and capacity of your resources. If the existingresource quota cannot meet your service requirements, submit a service ticket

ServiceStageFAQs 6 Infrastructure

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 15

Page 20: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

to increase your quota. Once your application is approved, your quota will beupdated and a notification will be sent to you.

6.2 How Do I Bind an ElP?You can apply for EIPs and bind them to ECSs for accessing the public network.

Procedure

Step 1 Log in to the public cloud.

Step 2 On the homepage, choose Network > Virtual Private Cloud.

Step 3 In the navigation pane, choose Elastic IP and Bandwidth > EIPs.

Step 4 Click Apply for EIP.

Step 5 For details, see Assigning an EIP and Binding It to an ECS.

NO TE

When binding an EIP to an ECS, applications on it can be accessed by external systems.

----End

6.3 How Do I Move a Node from One Cluster toAnother?

Question

How do I move a node from one cluster to another?

Answer

Currently, nodes in a cluster cannot be moved to another one. You can releaseexisting nodes and create nodes in a new cluster.

6.4 How Do I View Purchased ECS Resources onServiceStage?

Symptom

Existing ECS resources cannot be viewed on ServiceStage.

Solution

ServiceStage obtains and displays ECS resources of an account by calling APIs.However, resources in different regions are isolated. Therefore, check whetherresources are in the same region.

ServiceStageFAQs 6 Infrastructure

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 16

Page 21: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

6.5 Are Existing Programs Affected If I UnsubscribeServers?

QuestionAre existing programs affected if I unsubscribe servers?

Answer● Container deployment: When a server is unsubscribed, the service instances

deployed on it are rescheduled in the CCE cluster.● VM deployment: When a server is unsubscribed, the service instances

deployed on it become unavailable and are not rescheduled.

6.6 Can Basic Resources Be Managed on ServiceStage?

QuestionCan ServiceStage manage existing resources, such as ECS and RDS resources? Orcan it only manage and control those created on itself?

AnswerServiceStage obtains resource lists, such as ECS and RDS resource lists of anaccount by calling APIs and supports basic management. However, resources indifferent regions are isolated and can be managed only after being switched tothe same region.

6.7 Why Does ConfigServer Query Fail During GitConfiguration?

SymptomFor global configurations of the Spring Cloud engine, the system displays amessage indicating that the ConfigServer query fails regardless of Gitconfigurations.

SolutionRestart dvr-compute-agent.

ServiceStageFAQs 6 Infrastructure

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 17

Page 22: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

7 Application O&M

How Do I View Logs on ServiceStage?

What If Application Access Mode Becomes Invalid When EIP Is Replaced?

What If the Memory Usage of a Node Becomes Too High After a New Service IsStarted?

7.1 How Do I View Logs on ServiceStage?Logs of ServiceStage are provided by AOM. Before using AOM, you must installthe ICAgent. Otherwise, AOM cannot be used.

ICAgent is the collector of AOM. It runs on hosts to collect metrics, logs, andapplication performance data in real time. For details, see Installing the ICAgent.

7.2 What If Application Access Mode Becomes InvalidWhen EIP Is Replaced?

SymptomWhen I bind a load balancer to an application and replace its EIP, the applicationaccess mode cannot be automatically updated.

SolutionManually delete the original EIP, add a new EIP, and use the new EIP for ELBaccess.

ServiceStageFAQs 7 Application O&M

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 18

Page 23: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

7.3 What If the Memory Usage of a Node Becomes TooHigh After a New Service Is Started?

SymptomWhat should I do if the memory usage of a node is too high after a new service isstarted?

SolutionSet affinity by referring to Setting Scheduling Policies for ApplicationComponent Instances so that service instances will be deployed based on affinitynodes.

ServiceStageFAQs 7 Application O&M

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 19

Page 24: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

8 Application Development

What Are the Differences Between the Microservice and Common Application?

How Do I Handle a Microservice Registry Failure (Java Chassis)?

How Do I Troubleshoot Microservices Deployed on the Cloud?

Should I Use the SDK or ServiceMesh to Build a Microservice?

Is the Microservice Bound to the Public Cloud? How Do I Perform LocalDevelopment?

Common Problems with Switching SpringBoot Applications to the CSE Java SDKFramework

What If I Fail to Obtain a Dependency?

What Database Does the Service Center Use? What Are the Differences Betweenetcd and Eureka?

What Are the Differences Between the Configuration Center and Spring CloudConfig?

Why Should I Use CSE?

How Can I Obtain the CSE Service Center Address?

What Is Service Name Duplication Check?

Why Do I Have to Define Service Contracts?

8.1 What Are the Differences Between the Microserviceand Common Application?

The microservice is an architectural model. Its general idea is to break anapplication into multiple parts. Therefore, an application using the microservicearchitecture is actually a distributed application.

This enables services to change faster, and the system to be more reliable.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 20

Page 25: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Type Microservice Common Application

Development

The workload of a microserviceis light. A two-pizza team canrewrite all the code of amicroservice in two weeks. Thiscan be used as a symbol ofmicroservices. Whendeveloping a microservice, itsAPIs need to be available forinterconnection with othermicroservices. Therefore, theAPI definition-baseddevelopment mode is highlyrecommended.

Complex logic, coupled modules,bloated code, difficult modification,and low version iteration efficiency.

Deployment

An application consisting ofmultiple microservices iscomplex. Orchestration isrequired when the applicationis deployed.

Applications are probably large andrequire much time to build anddeploy. This is not conducive tofrequent deployment and hinderscontinuous delivery. This problem isespecially serious in mobileapplication development.

O&M Microservice O&M focuses ongovernance, in addition tometrics monitoring and logcollection. The core concept ofmicroservice governance is tomaintain system performancethrough modifications whilethe system is running.

It takes a long time to rectifycommon online problems. To rectifyany online problem, the entireapplication system must beupgraded.

8.2 How Do I Handle a Microservice Registry Failure(Java Chassis)?

When a microservice is successfully deployed, register it with the service centerand the configuration center to enable the microservice discovery and governancecapabilities. The microservice registry fails when any of the following conditionsare met:

● The AK/SK is not configured or is incorrect.● The address of the service center or configuration center is incorrect.● The network connection is faulty.● The domain name resolution fails.● The monitoring port is already occupied.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 21

Page 26: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Fault Locating● If the following error message is displayed, the AK/SK information is

incorrectly configured or carried in the request header.{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Invalid request, header is invalid, ak sk or project is empty."}

Checking method:a. Check whether the project depends on the following authentication

modules (indirect dependency is permitted, for example, the projectdepends on the cse-solution-service-engine):<groupId>com.huawei.paas.cse</groupId><artifactId>foundation-auth</artifactId>

b. Check whether AK/SK in the microservice.yaml file is correct. To obtaincorrect AK/SK, see Managing Access Keys.cse: credentials: accessKey: your access key secretKey: your secret key akskCustomCipher: default

● If the following error message is displayed, the AK/SK information isincorrectly configured.{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"validate ak sk error\"}"}

Checking method:Check whether AK/SK in the microservice.yaml file is correct. To obtaincorrect AK/SK, see Managing Access Keys.cse: credentials: accessKey: your access key secretKey: your secret key akskCustomCipher: default

● If the following error message is displayed, the project information isincorrectly configured.{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"get project token from iam failed. error:http post failed, statuscode: 400\"}"}

Checking method:Check whether the project information in the microservice.yaml file iscorrect. For details, see Viewing the Project Name.cse: credentials: accessKey: your access key secretKey: your secret key akskCustomCipher: default project: cn-north-1

● If the following error message is displayed, there is insufficient quota to add aservice instance.{"errorCode":"400100","errorMessage":"Not enough quota","detail":"no quota to create instance, ..."}

Checking method:Log in to the public cloud and view the instance quota on the microserviceengine page. If the quota is sufficient, check the service center address andregion information configured in the code. Note that you need to check theinstance quota of the region where the instance is located.

● If the microservice fails to access the service center or configuration center,the following information is displayed. The microservice does not access theservice center or configuration center. Therefore, no error code can be foundin the service center or configuration center.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 22

Page 27: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Connection refused: no further information

Checking method:

a. Check whether IP addresses of the service center and configuration centerin the microservice.yaml file are correct. If not, correct them.cse: service: //Information about the service center. The address field indicates the service center address. registry: address: https://cse.cn-north-1.myhuaweicloud.com instance: watch: false config: //Information about the configuration center. The address field indicates the configuration center address. client: serverUri: https://cse.cn-north-1.myhuaweicloud.com refreshMode: 1 refresh_interval: 5000

b. If IP addresses of the service center and configuration center are correct,run the following commands to check whether the network is normal.ping <servicecenter ip>ping <configurationcenter ip>If ping command execution is successful, the network connection isnormal.

NO TE

If the address of the service center or configuration center is a domain name,change the address configured in the microservice.yaml file to the domainname. Then, run the ping command.

c. If the network is normal, run the following command to obtain the IPaddress of the service center or configuration center.ping <domain name>If the following information is displayed, configure the obtained IPaddress and domain name in the local /etc/hosts file.10.153.78.18 cse.cn-north-1.myhuaweicloud.com

● In addition, if a microservice port number is occupied, the microservice mayfail to start. In this case, you can run the following command to checkwhether the service monitoring port is occupied.netstat -ano | findstr 8080If the port is occupied by another application, modify the microservice.yamlfile and change the monitoring port to an unoccupied port.rest: address: 0.0.0.0:8087 //Microservice port. Ensure that the port number is unique.

8.3 How Do I Troubleshoot Microservices Deployed onthe Cloud?

You can use Dashboard to locate a fault. Dashboard allows you to check the real-time running status of all microservices and instances.

After locating a faulty node, you can use Application Performance Management(APM) to check running logs of the node for further analysis.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 23

Page 28: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

8.4 Should I Use the SDK or ServiceMesh to Build aMicroservice?

● The SDK applies to self-governed microservices, which enables offlinedebugging. These microservices need to be developed based on the SDK.

● The microservice built using ServiceMesh requires a ServiceMesh environmentduring deployment. ServiceMesh enables microservices to be easily developed,and SDKs are not required.

ServiceMesh Scenarios● Reconstructing service code written in non-Java language into microservices● Reconstructing old Java services to microservices● Interconnecting a service that is not compiled in Java SDK with a service

compiled in Java SDK

JAVA SDK Scenarios● Using distributed transactions● Using Java to compile microservices.● Using protocols except HTTP 1.1 (HTTP 1.1 is the only protocol supported by

ServiceMesh)

8.5 Is the Microservice Bound to the Public Cloud? HowDo I Perform Local Development?

ServiceStage is provided in the public cloud. This allows you to perform O&Moperations on your microservices while they are running. ServiceComb, as theopen-source development framework of ServiceStage, is not bound to the publiccloud. You can use ServiceComb to develop and run microservices in variousscenarios, including in your local environment. By leveraging the features ofServiceComb, ServiceStage integrates some features for commercial use. Thesecommercial features are not open-source, but are free of charge.

You can use the CSE Java SDK to locally develop microservices. For details, seeServiceStage Developer Guide.

8.6 Common Problems with Switching SpringBootApplications to the CSE Java SDK Framework

Failed to Initialize the Container● Symptom: The error message "Unable to start embedded container" is

displayed during initialization.This problem occurs if the resource directory contains application properties.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 24

Page 29: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

● Cause: By default, Spring starts the built-in container (Servlet dependency isimported to Vert.x).

● Solution: Modify SpringApplication.run (TestspringbootApplication.class,args) to web selection disabled. The code is as follows:new SpringApplicationBuilder().sources(TestspringbootApplication.class).web(false).run();

Failed to Initialize Bean Related to Database● Symptom: The error message "Property 'sqlSessionFactory' or

'sqlSessionTemplate' are required" is displayed during initialization.● Cause: By default, spring-jdbc is set to provided for

org.apache.servicecomb:java-chassis-core. As a result, the .jar packagecannot be found when the program is running, leading to initialization failure.

● Solution: Modify scope of spring-jdbc in pom.xml.<dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <scope>compile</scope></dependency>

8.7 What If I Fail to Obtain a Dependency?When the Maven image source is configured, the dependency fails to be obtained,as shown in Figure 8-1.

Figure 8-1 Failed to obtain the dependency

If you need to use a proxy to access the external network, configure the Mavenproxy. Specifically, configure a proxy in the setting.xml file (user configuration) inthe m2 directory in the user directory (for example, C:\Users\yang****\ in theWindows OS) or the setting.xml file (system global configuration) in the confdirectory in the Maven installation directory.

Find the tags in the setting.xml file and configure the proxy information, asshown in the following example.

<proxies> <!-- proxy | Specification for one proxy, to be used in connecting to the network. | --> <proxy> <id>self-defined proxy ID. The proxy configuration must be unique. </id> <active>true</active> <protocol>http</protocol> <username>proxy authentication account</username> <password>proxy authentication password</password> <host>enterprise's proxy address</host>

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 25

Page 30: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

<port>port number of the proxy address</port> </proxy> <proxy> <id>self-defined proxy ID. The proxy configuration must be unique. </id> <active>true</active> <protocol>http</protocol> <username>proxy authentication account</username> <password>proxy authentication password</password> <host>enterprise's proxy address</host> <port>port number of the proxy address</port> </proxy>

</proxies>

8.8 What Database Does the Service Center Use? WhatAre the Differences Between etcd and Eureka?

CSE uses the etcd- and Golang-based service center in the API server layer. UnlikeEureka which manages only dynamic routing data, the CSE service center providesabundant management capabilities for static metadata. For example, the servicecenter provides integrated metadata management for the application, service, andinstance, service-based version and tag management to support dark launch, andservice dependency records based on discovered actions.

Based on the dynamic routing data management of Eureka, the service center canmanage a system with a large scale of microservices deployed, which is highlyuseful for large-scale enterprise-level microservice systems. In addition, the servicecenter provides various fault-tolerance capabilities to handle faults that occurwhen requests are sent from the SDK to the service center, or from the API serverto the etcd, and those occur on the etcd or network partition. With the cachedesign of each level of the API server, the service center provides higheravailability.

Therefore, compared with Eureka, the service center not only enhances themanagement capability, but also enhances its consistency, availability, andpartition tolerance (CAP). Unlike Eureka which sacrifices consistency to ensureavailability, the service center enhances all capabilities of the BASE model.

8.9 What Are the Differences Between theConfiguration Center and Spring Cloud Config?

The configuration center of CSE is developed using Java, and uses etcd as thebackground storage. The configuration center is irrelevant to Spring Cloud Config.Compared with Spring Cloud Config, the configuration center uses multi-dimensional data modeling to organize configuration data, which provides betterdescription capability and better scalability. In addition, the configuration centersupports push and pull modes to notify users of configuration changes morerapidly.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 26

Page 31: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

8.10 Why Should I Use CSE?By leveraging the best experience of microservice construction in multiple Huaweiinternal large-scale systems, Cloud Service Engine (CSE) provides mature andstable microservices for enterprise-level applications. This lowers microservicerequirements for enterprise-level applications.

With CSE, you do not need to worry about the infrastructure of microservicesother than your own microservices. This ensures system stability. In addition, youcan use and govern a microservice once it is deployed. You can also obtainguidance and assistance during microservice development and obtain the latesttechnology information.

8.11 How Can I Obtain the CSE Service Center Address?

QuestionHow can I obtain the CSE service center address?

AnswerLog in to the ServiceStage console, choose Infrastructure > Cloud ServiceEngines, and find Service Center Address.

Figure 8-2 Service center address of the professional engine

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 27

Page 32: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Figure 8-3 Service center address of the exclusive engine

8.12 What Is Service Name Duplication Check?

Question

What is service name duplication check?

Answer

Microservice names, applications, versions, and environments are checked.

A primary key uniquely identifies a microservice.

Ensure that each primary key is unique.

8.13 Why Do I Have to Define Service Contracts?The enterprise-level systems are in large scale use and involve many microservicecomponents. Therefore, unified API management is a key requirement ofenterprises. HUAWEI CLOUD CSE uses contract management for this.

For management: Through contract management, API definition files that complywith API description standards for microservices are defined. In this way, APIdevelopment of multiple development teams can be standardized andcoordinated. This reduces communication costs and facilitating management.

For development: During microservice development, different teams or evendifferent independent software vendors (ISVs) can develop the same applicationor system based on the unified API definition file. This facilitates consistencymaintenance for the overall system. Specifically, modules in a monolithicapplication are called using code. Therefore, any API incompatibility can beresolved during the early compilation with low bug fixing costs. Whenmicroservices are decoupled, services are remotely called. Therefore, APIinconsistency cannot be found during early compilation, resulting in high bugfixing costs. Using service contracts, contract design can be assured, changes canbe strictly reviewed, and code can be reversely generated. This ensures APIcompatibility.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 28

Page 33: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

In addition, for small-scale systems that do not have high requirements on unifiedmanagement, API definition files can be automatically generated through APIs.

ServiceStageFAQs 8 Application Development

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 29

Page 34: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

9 Java SDK FAQs

How Do I Extend AK/SK Decryption Methods?

How Do I Perform Local Development and Testing?

Why Is "Invalid request, header is invalid, ak sk or project is empty." DisplayedWhen I Attempt to Connect to the Service Center?

Why Is "validate ak sk error" Displayed When I Attempt to Connect to the ServiceCenter?

Why Is "get project token from iam failed" Displayed When I Attempt to Connectto the Service Center?

Why Is "Version validate failed" Displayed When I Attempt to Connect to theService Center?

Why Is "Not enough quota" Displayed When I Attempt to Connect to the ServiceCenter?

9.1 How Do I Extend AK/SK Decryption Methods?

SymptomHow do I extend AK/SK decryption methods?

SolutionExtend and implement AKSKCipher: implementscom.huawei.paas.foundation.auth.credentials.AKSKCipher

Implement the name() and decode(TYPE type, char[] encrypted) methods, anduse the @Component annotation to initialize the class as bean. TYPE is of theenumerated value, which can be AK or SK. Generally, only SK needs to beencrypted for storage.

Example:

@Componentpublic class CustomAKSKDepl implements com.huawei.paas.foundation.auth.credentials.AKSKCipher { @Override

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 30

Page 35: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

public String name() { return "base64"; }

@Override public char[] decode(TYPE type, char[] encrypted) { try { String a = new String(Base64.decodeBase64(String.valueOf(encrypted)), "UTF-8"); return a.toCharArray(); } catch (UnsupportedEncodingException e) { return null; } }}

9.2 How Do I Perform Local Development and Testing?The lightweight local service center provides you with service discovery,registration, and query functions during development, commissioning, and testing.

ConceptThis section describes how to locally develop and commission consumer andprovider applications. Both service providers and consumers need to connect to aremote service center. Two methods of building a local service center for localmicroservice commissioning are as follows:

● Start the local service center.● Enable the local service center by using the local file (Mock mechanism).

The local service center is an important component in the microservicearchitecture, and is used for managing, registering, and detecting metadata andinstance metadata. The logic relationship between the service center andmicroservice provider/consumer is as follows:

Prerequisites● JDK 1.8 has been installed, and the JAVA_HOME environment variable has

been correctly configured.

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 31

Page 36: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

● Starting the local service center will occupy ports 30100 and 30103 of theserver, which respectively indicate the backend and frontend service ports ofthe service center. Ensure that these two ports are not in use.

Starting the Local Service Center

Step 1 Go to Downloading the Local Service Center and download the installationpackage of the local service center.

Step 2 Install the package of the service center.● Software package installation: Decompress the installation package to the

installation directory.● Image package installation: Run the following command to install the service

center:docker load -i local-service-center-{version}-docker.tar

NO TE

1. The OS must be 64-bit.2. To change the IP address and port number when installing the software package of

the service center, modify the /../conf/app.conf file. In the file, frontend_host_ipand frontend_host_port respectively represent the IP address and port number formonitoring the frontend service of the service center, and httpaddr and httpportrespectively represent the IP address and port number for monitoring the backendservice of the service center. The following shows how to change the IP addressand port number by taking the backend service of the service center as anexample:If httpaddr is set to 127.0.0.1, the service center can only be accessed by a localprocess. To enable the service center to be accessed by remote processes, sethttpaddr to an external IP address or 0.0.0.0.# listen addresshttpaddr = 127.0.0.1httpport = 30100

Step 3 Start the local service center.● Windows OS: In the installation package, click the start.bat script to start the

local service center.● Linux OS: Run the start.sh script to start the local service center.

NO TE

Before running the start.sh script, run the following command to modify the filepermission:chmod -R 550 /../bin

● Docker container: Run the following command to start the local servicecenter:docker rm -f scdocker run -d --name sc -p 30100:30100 -p 30103:30103 local-service-center:latest

Step 4 Enter http://127.0.0.1:30103 in the address bar of a browser, and access thefrontend page.

Step 5 After the local service center starts, configure the service center address in themicroservice.yaml file that stores SDK configurations, as shown in the following:

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 32

Page 37: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

cse: service: registry: address: http://127.0.0.1:30100 #Backend address and port number of the service center

NO TE

● By default, the listening address of the service center is set to 0.0.0.0. You can set thelistening address to 127.0.0.1 to enhance security.

● If you have customized the IP address and port number when using the service center,change the value of address as required.

● If the configuration center and dashboard are not used, delete related configurations.

When the microservice application is developed, run MainServer on the server tostart the service process and register services with the service center.

Step 6 (Development service providers and consumers) Start the microservice for localtests.

----End

Enabling the Local Service Center Using the Mock Mechanism

Step 1 Create the registry.yaml file for the local service center.springmvctest: - id: "001" version: "1.0" appid: myapp #Commissioning service ID instances: - endpoints: - rest://127.0.0.1:8080

NO TE

In the mock mechanism, you need to prepare service schemas on your own. Currently, onlylocal commissioning for service consumers is supported.

Step 2 Add the following code to the end of the Main function for service consumers.public class xxxClient {public static void main(String[] args) { System.setProperty("local.registry.file", "/path/registry.yaml"); //your code System.clearProperty("local.registry.file");}

NO TE

Set the second parameter of setProperty to the absolute path of registry.yaml in the disk.Path separators vary depending on systems.

Step 3 (Development service consumers) Start the microservice for local tests.

----End

Entering the Development Mode

When the local service center is downloaded for local testing and development, itneeds to be restarted or the version needs to be upgraded every time the code ischanged. Otherwise, an error is displayed.

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 33

Page 38: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Add the following configuration to the microservice.yaml file to enter thedevelopment mode.

service_description.environment: development

Downloading the Local Service Center● local-service-center-2.3.53-unix-amd64.zip● local-service-center-2.3.53-unix-aarch64.zip● local-service-center-2.3.53-windows-amd64.zip● local-service-center-2.3.53-docker-amd64.tar

Downloading the Local CSE● Local-CSE-1.0.3.zip● Local-CSE-1.0.2.zip

9.3 Why Is "Invalid request, header is invalid, ak sk orproject is empty." Displayed When I Attempt toConnect to the Service Center?

Developers can use the service center provided by the public cloud to developservices. To use the service center, a developer must register an account andgenerate AK/SK information in My Credentials for access authentication control.For details about how to connect to the public cloud, see Accessing Applicationsto CSE.

Abnormal Message{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Invalid request, header is invalid, ak sk or project is empty."}

Possible Cause

The AK and SK are not correctly set or carried in the request header.

Fault Locating

Check whether the project depends on the following authentication modules(indirect dependency is permitted, for example, the project depends on the cse-solution-service-engine):

<groupId>com.huawei.paas.cse</groupId> <artifactId>foundation-auth</artifactId>

Check whether the AK/SK in microservice.yaml are correct. Generally, the SK islonger than the AK.

cse: credentials: accessKey: your access key secretKey: your secret key akskCustomCipher: default

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 34

Page 39: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

Specifically, log in to the public cloud and query the AK information in MyCredentials. The SK is saved by the user and cannot be queried. If you forget therelevant credential, delete the credential information and create new information.

9.4 Why Is "validate ak sk error" Displayed When IAttempt to Connect to the Service Center?

Developers can use the service center provided by the public cloud to developservices. To use the service center, a developer must register an account andgenerate AK/SK information in My Credentials for access authentication control.For details about how to connect to the public cloud, see Accessing Applicationsto CSE.

Abnormal Message{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"validate ak sk error\"}"}

Possible CauseThe AK and SK are incorrect.

Fault LocatingCheck whether the AK/SK in microservice.yaml are correct. Specifically, log in tothe public cloud and query the AK information in My Credentials. The SK is savedby the user and cannot be queried. If you forget the relevant credential, delete thecredential information and create new information.

9.5 Why Is "get project token from iam failed"Displayed When I Attempt to Connect to the ServiceCenter?

Developers can use the service center provided by the public cloud to developservices. To use the service center, a developer must register an account andgenerate AK/SK information in My Credentials for access authentication control.For details about how to connect to the public cloud, see Accessing Applicationsto CSE.

Abnormal Message{"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"get project token from iam failed. error:http post failed, statuscode: 400\"}"}

Possible CauseThe project name is incorrect.

Fault LocatingCheck whether the value of cse.credentials.project is correct. Specifically, querythe correct project name in My Credentials. If this configuration item does not

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 35

Page 40: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

exist, the system checks the domain name of the service center by default. If thedomain name does not contain a valid project name, add this configuration itemand ensure that it is a valid project name in My Credentials.

9.6 Why Is "Version validate failed" Displayed When IAttempt to Connect to the Service Center?

Developers can use the service center provided by the public cloud to developservices. To use the service center, a developer must register an account andgenerate AK/SK information in My Credentials for access authentication control.For details about how to connect to the public cloud, see Accessing Applicationsto CSE.

Abnormal Message{"errorCode":"400001","errorMessage":"Invalid parameter(s)","detail":"Version validate failed, rule: {Length: 64,Length: ^[a-zA-Z0-9_\-.]*$}"}

Possible Cause

A new SDK is used, but an earlier SDK of the service center is connected.

Fault Locating

Check the version of the service center. You can download the latest service centerfrom the official website of the public cloud or ServiceComb.

9.7 Why Is "Not enough quota" Displayed When IAttempt to Connect to the Service Center?

Developers can use the service center provided by the public cloud to developservices. To use the service center, a developer must register an account andgenerate AK/SK information in My Credentials for access authentication control.For details about how to connect to the public cloud, see Accessing Applicationsto CSE.

Abnormal Message{"errorCode":"400100","errorMessage":"Not enough quota","detail":"no quota to create instance, ..."}

Possible Cause

There is insufficient quota to add a service instance.

Fault Locating

Log in to the public cloud and view the instance quota on the microservice enginepage. If the quota is sufficient, check the service center address and regioninformation configured in the code.

ServiceStageFAQs 9 Java SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 36

Page 41: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

10 Go SDK FAQs

How Can I Handle a Certificate Loading Error?

What If the Header Name Is Invalid?

10.1 How Can I Handle a Certificate Loading Error?

Symptom

If the preceding error is displayed, the verifyPeer value is set to true but nocertificate is configured. By default, the verifyPeer value in Go-chassis is false andis not changed automatically.

Solution● If a certificate is not necessary, the verifyPeer value changes during

development or continuous integration. In this case, check the code fromcommitting to deployment, and change value true to its default value false.

● If a certificate is necessary, configure it.

10.2 What If the Header Name Is Invalid?

Symptom

This problem is irrelevant to Go-chassis.

ServiceStageFAQs 10 Go SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 37

Page 42: FAQs - HUAWEI CLOUD...7.8 What Database Does the Service Center Use? What Are the Differences Between etcd and Eureka? CSE uses the etcd- and Golang-based service center in the API

SolutionCheck the service code, particularly the customized Go-chassis handler.Specifically, check whether there is an empty header or a non-standard headername.

ServiceStageFAQs 10 Go SDK FAQs

Issue 01 (2021-04-08) Copyright © Huawei Technologies Co., Ltd. 38