溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

出現(xiàn)dubbo錯(cuò)誤ip及ip亂入問(wèn)題怎么辦

發(fā)布時(shí)間:2020-07-11 09:42:56 來(lái)源:億速云 閱讀:783 作者:清晨 欄目:編程語(yǔ)言

這篇文章將為大家詳細(xì)講解有關(guān)出現(xiàn)dubbo錯(cuò)誤ip及ip亂入問(wèn)題怎么辦,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

問(wèn)題

在本地啟動(dòng)dubbo時(shí),服務(wù)注冊(cè)在本地的zookeeper ,但是注冊(cè)IP卻不是本地的iP。產(chǎn)生問(wèn)題,導(dǎo)致consumer 找不到provider ,訪問(wèn)不了服務(wù)。

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

產(chǎn)生原因,隨機(jī)產(chǎn)生,可能是你重啟一下機(jī)器,或者電腦小智一段時(shí)間就會(huì)發(fā)生。

  • 報(bào)錯(cuò)類似
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&timestamp=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 的注冊(cè)中心“dubbo.registry.address” 時(shí)要注意不要配置127.0.0.1 要配置為 localhost。

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

127.0.0.1 localhost

問(wèn)題原因

懷疑原因:為本地配置127.0.0.1 時(shí)由于連著網(wǎng)絡(luò)所以dns 解析解析到了你的網(wǎng)絡(luò)上了。么有解析到本機(jī)造成的。但是并不確定是不是這個(gè)原因。

關(guān)于出現(xiàn)dubbo錯(cuò)誤ip及ip亂入問(wèn)題怎么辦就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI