国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Java > 正文

解決dubbo錯誤ip及ip亂入問題的方法

2024-07-14 08:43:39
字體:
來源:轉載
供稿:網友

問題

在本地啟動dubbo時,服務注冊在本地的zookeeper ,但是注冊IP卻不是本地的iP。產生問題,導致consumer 找不到provider ,訪問不了服務。

  • 例如 本地IP為 10.0.0.1 ,但是zookeeper上的注冊ip 可能是 196.168.0.1

產生原因,隨機產生,可能是你重啟一下機器,或者電腦小智一段時間就會發生。

  • 報錯類似
com.alibaba.dubbo.remoting.RemotingException: client(url: dubbo://100.106.199.34:20880/con.xxxx.xxxx.xxxx.xxxx.NginxLogService?accesslog=./logs/xxxx-xxxx-provider-dubbo.log&anyhost=true&application=xxxx-xxxx&check=false&codec=dubbo&default.accesslog=true&default.check=false&default.delay=-1&default.loadbalance=roundrobin&default.retries=0&default.timeout=60000&delay=-1&dubbo=2.8.4&generic=false&heartbeat=60000&interface=cn.xxxx.xxxx.xxxx.xxxx.NginxLogService&logger=slf4j&methods=getModelPage&organization=xxxx&owner=xxxx&pid=38690&side=consumer×tamp=1545988767460) failed to connect to server /100.106.199.34:20880 client-side timeout 3000ms (elapsed: 3004ms) from netty client 100.106.199.34 using dubbo version 2.8.4 at com.alibaba.dubbo.remoting.transport.netty.NettyClient.doConnect(NettyClient.java:147) at com.alibaba.dubbo.remoting.transport.AbstractClient.connect(AbstractClient.java:280) at com.alibaba.dubbo.remoting.transport.AbstractClient$1.run(AbstractClient.java:145) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.remoting.RemoteConnectFailureException: Could not connect to remote service [rmi://192.168.72.235:20881/com.ztesoft.zsmartcity.ynzw.demo.service.DemoService]; nested exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: 
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.xxx.xxx.service.LoginService. No provider available for the service com.xxxx.xxxx.service.LoginService:3.0 from the url zookeeper://202.106.199.37:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=xxx&application.version=3.0&check=false&default.timeout=5000&dubbo=2.5.3&interface=com.xxx.xxx.service.LoginService&methods=aLogin,bPassword,userLogin,modifyPasswordLogin,validate,fVersion,xLogout,userLogout,getTest,getCode,aLogin,aToken,aUser&pid=2200&revision=1.0&side=consumer×tamp=1462534379328&version=3.0 to the consumer 202.106.199.37 use dubbo version 2.5.3

解決方法

在程序配置文件中 配置dubbo 的注冊中心“dubbo.registry.address” 時要注意不要配置127.0.0.1 要配置為 localhost。

然后在配置本地的/etc/hosts 文件中

127.0.0.1 localhost

問題原因

懷疑原因:為本地配置127.0.0.1 時由于連著網絡所以dns 解析解析到了你的網絡上了。么有解析到本機造成的。但是并不確定是不是這個原因。

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對VeVb武林網的支持。


注:相關教程知識閱讀請移步到JAVA教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 哈尔滨市| 沁阳市| 双牌县| 称多县| 乌兰浩特市| 泰兴市| 漯河市| 图们市| 海宁市| 名山县| 二连浩特市| 九龙坡区| 武川县| 徐汇区| 巍山| 和田县| 简阳市| 福建省| 马尔康县| 武义县| 怀集县| 巴东县| 浮山县| 河源市| 木里| 鸡西市| 十堰市| 大埔区| 青浦区| 建瓯市| 甘南县| 德庆县| 樟树市| 旌德县| 靖远县| 罗江县| 青铜峡市| 谷城县| 焦作市| 河南省| 莱芜市|