After Nacos started, the client worker log was printed all the time
Phenomenon
Print the clientworker log all the time
2020-08-24 00:57:30.977 INFO [12932] --- [.cn_8848-public] c.a.n.client.config.impl.ClientWorker : [fixed-nacos.itlym.cn_8848-public] [data-received] dataId=common.yml, group=DEFAULT_GROUP, tenant=public, md5=8c191cace81179b01fb745b5d027c1c8, content=xxx
2020-08-24 00:57:30.989 INFO [12932] --- [.cn_8848-public] c.a.n.client.config.impl.ClientWorker : [fixed-nacos.itlym.cn_8848-public] [data-received] dataId=sms-center.yml, group=DEFAULT_GROUP, tenant=public, md5=f12bc945ba0c1d39f3dea2e0977db712, content=xxx
...
Cause analysis
Root cause
Having seen the source code of Nacos before, Nacos will check whether the configuration items are consistent with the server configuration items every 10ms. If not, it will pull the latest configuration from the server therefore, if the MD5 algorithms of Nacos client and Nacos server are different, it will lead to misjudgment, thus constantly refreshing and printing the client worker logs.
Direct cause
My Nacos server is 1.3, and the client uses spring cloud Alibaba. Version
. Click to find that the Nacos client version is 1.2
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Here, the
spring-cloud-alibaba-dependencies
‘s official website and warehouse have not been updated for a long time, which is easy to make complaints about users and waste a lot of investigation time.
Other possible reasons
The public
is set in the namespace. See the Nacos GitHub
At this time, the best way to solve this problem is not to set the namespace. Otherwise, when Nacos releases a new version, it may be 1.4
Solution
Method 1:
Change the version of client and Nacos server to the same, as follows
client:
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<artifactId>com.alibaba.nacos</artifactId>
<groupId>nacos-client</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>1.3.2</version>
</dependency>
Method 2:
Because spring cloud Alibaba dependencies leaves the gap of properties specified version (default < nacos.client.version> 1.2.1)
so you only need to add
<properties>
<nacos.client.version>1.2.1</nacos.client.version>
</properties>
Note: if spring cloud starter Nacos config
is introduced, it can’t be avoided by this scheme, because ‘spring cloud Alibaba dependencies’ has hard coding problems. When importing, you should actively specify the version.
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>1.3.0</version>
</dependency>
Method 3 (middleware upgrade scheme suitable for existing system):
Download the Nacos client Version 1.2.1 code, modify its md5util package path to a new one, and then re publish it to the local or private warehouse.
Read More:
- NACOS error com.alibaba.nacos.api.exception.NacosException: failed to req API:/api//nacos/v1/ns/instance
- [Solved] failed to req API:/nacos/v1/ns/instance after all servers
- [Solved] com.alibaba.nacos.api.exception.NacosException: failed to req API
- Caused by: java.lang.ClassNotFoundException: com.alibaba.nacos.api.naming.NamingMaintainService
- Java was started but returned exit code = 13
- Java was started but returned exit code = 13 problem solving
- Kibana was degraded from 7.0 to 6.8 and started to report an error
- When vivado2017 is started, the “error when launching” dialog box will pop up vivado.bat : Launcher time out”
- [Solved] Appium Android, Appium settings and Unclock method will be installed every time the phone is started
- Kafka reported error shutdown broker because all log dirs in… Have failed
- Nacos failed to start [How to Solve]
- SQL query time group_ Was cut by group_ CONCAT()
- Solution to the problem of failure to elect leaders when offline service is reported in Nacos
- A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): Headers and client
- Microsoft edge was unable to log in. Error code: 3,15, – 2147023579
- An error is reported when Clickhouse is started. The error log information is: structure needs cleaning
- Using openfeign to remotely call the startup program to report an error
- Solution to the incomplete display of big data files printed by pychar
- Docker Nacos deployment uses container name to access 400 bad request
- Nacos starts in cluster mode and reports an error