Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
2017-04-27 16:04
716 查看
转载自:http://blog.csdn.net/top_code/article/details/52279072
启动的Dubbo 服务的时候报错,异常信息如下:
2
3
4
5
6
7
1
2
3
4
5
6
7
报错的大概意思是 Dubbo在保存服务列表时失败,Can not lock the registry cache file /root/.dubbo/dubbo-registry-10.141.4.168.cache,拿不到文件锁,无法保存服务列表。
出现这个的原因是服务向ZK注册的同时,会缓存Consumer的列表,写入user.home/.dubbo/dubbo-registry-” + url.getHost() + “.cache 这个文件,当在同一个机器上启动多个Provider的时候,就会出现文件锁争用的问题,报上面这个错误。
既然是由于竞争文件锁导致的,那么让服务模块各自缓存自己的cache文件就可以避免这样的问题了。
具体做法是:在provider的xml配置文件中加入 file=”${catalina.home}/dubbo-registry/dubbo-registry.properties” ,如下:
1
这样就会在catalina.home目录下生成dubbo-registry这个目录,cache文件就缓存在这个里边了。
AbstractRegistry lock problem:https://github.com/alibaba/dubbo/issues/81
provider:服务提供者
启动的Dubbo 服务的时候报错,异常信息如下:
2016-08-22 16:44:40.588 | DubboSaveRegistryCache-thread-1 | WARN | com.alibaba.dubbo.common.logger.log4j.Log4jLogger:Log4jLogger.java(78) | [DUBBO] Failed to save registry store file, cause: Can not lock the registry cache file /root/.dubbo/dubbo-registry-10.141.4.168.cache, ignore and retry later, maybe multi java process use the file, please config: dubbo.registry.file=xxx.properties, dubbo version: 2.8.3, current host: 127.0.0.1 java.io.IOException: Can not lock the registry cache file /root/.dubbo/dubbo-registry-10.141.4.168.cache, ignore and retry later, maybe multi java process use the file, please config: dubbo.registry.file=xxx.properties at com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:193) ~[dubbo-2.8.3.jar:2.8.3] at com.alibaba.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:150) [dubbo-2.8.3.jar:2.8.3] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]1
2
3
4
5
6
7
1
2
3
4
5
6
7
报错的大概意思是 Dubbo在保存服务列表时失败,Can not lock the registry cache file /root/.dubbo/dubbo-registry-10.141.4.168.cache,拿不到文件锁,无法保存服务列表。
错误原因
出现这个的原因是服务向ZK注册的同时,会缓存Consumer的列表,写入user.home/.dubbo/dubbo-registry-” + url.getHost() + “.cache 这个文件,当在同一个机器上启动多个Provider的时候,就会出现文件锁争用的问题,报上面这个错误。
解决办法
既然是由于竞争文件锁导致的,那么让服务模块各自缓存自己的cache文件就可以避免这样的问题了。具体做法是:在provider的xml配置文件中加入 file=”${catalina.home}/dubbo-registry/dubbo-registry.properties” ,如下:
<dubbo:registry id="zkcenter" protocol="zookeeper" address="${dubbo.zk_address}" file="${catalina.home}/dubbo-registry/dubbo-registry.properties"/>1
1
这样就会在catalina.home目录下生成dubbo-registry这个目录,cache文件就缓存在这个里边了。
参考资料
AbstractRegistry lock problem:https://github.com/alibaba/dubbo/issues/81provider:服务提供者
相关文章推荐
- Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
- Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
- Dubbo java.io.IOException: Can not lock the registry cache file
- Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
- Dubbo java.io.IOException: Can not lock the registry cache file
- dubbo Can not lock the registry cache file
- dubbo Can not lock the registry cache file
- Dubbo java.io.IOException: Can not lock the registry cache file
- Dubbo java.io.IOException: Can not lock the registry cache file
- Dubbo java.io.IOException: Can not lock the registry cache file
- dubbo的Failed to save registry store file问题
- samba 提示Failed to initialize the registry: WERR_CAN_NOT_COMPLETE 无法启动
- vmware, failed to lock the file 的解决
- VMware启动系统报错,reason: failed to lock the file.
- VMWare出现文件未能锁定(Failed to lock the file)的解决方法
- 强制关机 VMware Wrokstation Error (failed to get exclusive lock on the configuration file----)
- Failed to save the updated manifest to the file
- Shrink VmWare File VMDK——Failed to open the disk. The file specified is not a virtual disk
- VMware 启动报错 "Failed to lock the file"解决办法
- 编译错误:Failed to save the updated manifest to the file ..........