Error reporting when Dubbo service starts

Recently, I encountered a problem in the process of optimizing the Dubbo project, and reported an error when starting dubbo

Linux environment + Dubbo 2.5.3

java.lang.IllegalArgumentException: Invalid registry store file /pub/.dubbo/dubbo-registry-224.5.6.7.cache, cause: Failed to create directory /pub/.dubbo!

When multiple applications of a service use dubbo to update the local cache of the registration center, when updating the local cache conflicts, the above warning is reported;

After consulting the data, it is found that the reason for this problem is that when Dubbo registers with Zookeeper, it also caches a Consumer file list and writes it into the file /pub/.dubbo/dubbo-registry-224.5.6.7.cache. When When starting multiple providers on the same machine, there will be concurrency problems when starting at the same time, creating or writing the file at the same time, and this problem will occur.

Since it is caused by file locks, settings are made in the Dubbo configuration, and the respective service provider modules cache their own Consumers to avoid file lock problems.

The specific method is: add file="${catalina.home}/dubbo-registry/dubbo-registry.properties" in the provider's xml configuration file

In this way, the dubbo-registry directory will be generated under the catalina.home directory, and the cache file will be cached in this directory.

Related dubbo issues can refer to: https://my.oschina.net/greki/blog/550976

Guess you like

Origin blog.csdn.net/m0_54850467/article/details/126716902