Recently, we have built a unified technology platform within the company, which uses Alibaba Spring Cloud technology stack. The original NACOS version is 1.3.2, and the official NACOS version has been upgraded to 2.0.1 recently. According to the introduction, the upgrade of the major version has greatly improved the service discovery and stability. It happened that the company where I worked needed to migrate the old Docker cluster platform to K8S cluster platform and planned to migrate the public components such as nacOS, Sentinel, Skywalking, elk, etc., so I encountered some problems in the process of upgrading NACOS, and I made a record here. Provide a guide for future employees who may need the same.

Spring Cloud Alibaba:2.2.5 RELEASE 3 Spring Boot:2.3.6 RELEASE 4 Nacos Server:1.3.2

1. Deploy the Nacos cluster on K8s according to the official deployment document:… 2, will be used to switch to the new address Nacos clusters Modify the configuration files of the environment, the configuration and the registered address of nacos is revised as follows: nacos – headless. Nacos. SVC. Cluster. The local: 8848 3, redeploy the application, found no error application, also is normal

Four, encountered problems and solutions

1. A few days later, due to the service problems of K8S node, the NACOS server was interrupted for several minutes, and the connection was abnormal in the application program. Applications submitted to the “[com. Alibaba. Nacos. Client. Naming] failed to update serviceName: DEFAULT_GROUP @ @ fone – auth – test. The IpV4 address is incorrect.

After the error is reported, the application loses connection to the NACOS Server and the service registration information is not visible on the NACOS Server. Restart the application.

2. View the official upgrade document……

Later, I found that the original application side also needs to be upgraded, that is, the JAR package of the client side needs to be upgraded to 2.0.1, because the existing version of Alibaba Spring Cloud still does not support NACOS2.0.1

Therefore, you need to manually exclude the old 1.3.2 package and reference the latest 2.0.1 version, as follows:

3, because the latest NACOS2.0.1 version has two new ports:

GRpc port client: 9848

GRpc port server: 9849

Jraft port: 7848 (compatible with 1.4.x election port)

Therefore, it is important to add the access permission of the port 9848/9849/7848 on the server firewall and VPN access policy. Otherwise, after the developer upgrades the local JAR package, the local application cannot access the server

V. Summary of problems

1, upgrade the basic components must consult the official materials (upgrade strategy, evaluation of the impact on the existing application) before carrying out, do not blindly, in this also suggests that nacOS upgrade steps should have a quick link or Tips to link to compatibility and use

2. Nacos official mentioned that the new NACOS 2.0.1 Server could support the old client ApI connection, but in fact there were defects in the test. After the Server was disconnected, the client was abnormal, and the subsequent service could not be automatically discovered and registered

3. The new service opens two more ports than before, which requires the server and VPN (the company has the security control requirements and opens the ports on demand)

4. Until now, the version of Spring Cloud Alibaba has been upgraded to 2021.1, but it still supports Nacos 1.4.1, and does not support Nacos 2.0.1.