How Do I Handle a Microservice Registry Failure (Java Chassis)?
When a microservice is successfully deployed, register it with the service center and the configuration center to enable the microservice discovery and governance capabilities. The microservice registry fails when any of the following conditions are 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.
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:- 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 AK/SK in the microservice.yaml file is correct. To obtain correct AK/SK, see Managing Access Keys.
cse: credentials: accessKey: your access key secretKey: your secret key akskCustomCipher: default
- 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):
- If the following error message is displayed, the AK/SK information is incorrectly 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 obtain correct 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 is incorrectly 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 is correct. 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 a service 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 microservice engine page. If the quota is sufficient, check the service center address and region information configured in the code. Note that you need to check the instance 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 the service center or configuration center. Therefore, no error code can be found in the service center or configuration center.
Connection refused: no further information
Checking method:
- Check whether IP addresses of the service center and configuration center in 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
- If IP addresses of the service center and configuration center are correct, run the following commands to check whether the network is normal.
ping <configurationcenter ip>
If ping command execution is successful, the network connection is normal.
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 domain name. Then, run the ping command.
- If the network is normal, run the following command to obtain the IP address of the service center or configuration center.
If the following information is displayed, configure the obtained IP address and domain name in the local /etc/hosts file.
10.153.78.18 cse.cn-north-1.myhuaweicloud.com
- Check whether IP addresses of the service center and configuration center in the microservice.yaml file are correct. If not, correct them.
- In addition, if a microservice port number is occupied, the microservice may fail to start. In this case, you can run the following command to check whether the service monitoring port is occupied.
If the port is occupied by another application, modify the microservice.yaml file 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot