keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

服务以域名形式注册在eureka上后,我们的包就无法连接了 #60

Closed xkcomeon closed 2 years ago

xkcomeon commented 2 years ago

File "/usr/local/lib/python3.7/site-packages/py_eureka_client/eureka_client.py", line 1284, in do_service return self.walk_nodes(app_name, service, prefer_ip, prefer_https, walk_using_urllib) File "/usr/local/lib/python3.7/site-packages/py_eureka_client/eureka_client.py", line 1240, in walk_nodes raise http_client.URLError("Try all up instances in registry, but all fail") urllib.error.URLError: <urlopen error Try all up instances in registry, but all fail>

keijack commented 2 years ago

Could you please provide the xml from http://[your-eureka-server]/v2/apps, and the code how you call do_service ?

xkcomeon commented 2 years ago
3f8b8588-c181-4ca4-9c3f-7fa33421f5b9 config-service-test.xxxxxxxxxx.com SERVICE-CONFIG config-service-test.xxxxxxxxxx.com UP UNKNOWN 80 443 1 MyOwn 30 90 1644488362293 1645165181335 0 1644488362293 http://config-service-test.xxxxxxxxxx.com:80null SERVICE-CONFIG config-service-test.xxxxxxxxxx.com:443 false 1644488362293 1644488362278 ADDED
xkcomeon commented 2 years ago

"

3f8b8588-c181-4ca4-9c3f-7fa33421f5b9 config-service-test.xxxxxxxxxx.com SERVICE-CONFIG config-service-test.xxxxxxxxxx.com UP UNKNOWN 80 443 1 MyOwn 30 90 1644488362293 1645165181335 0 1644488362293 http://config-service-test.xxxxxxxxxx.com:80null SERVICE-CONFIG config-service-test.xxxxxxxxxx.com:443 false 1644488362293 1644488362278 ADDED "
xkcomeon commented 2 years ago

hostName 和 ipAddr 填充的都是 域名 我看后面拼接url的时候多加了port导致异常

xkcomeon commented 2 years ago

带标签贴出来格式被github去除掉了

xkcomeon commented 2 years ago

`

3f8b8588-c181-4ca4-9c3f-7fa33421f5b9
<hostName>config-service-test.xxxxxxxxxx.com</hostName> 
<app>SERVICE-CONFIG</app> 
<ipAddr>config-service-test.xxxxxxxxxx.com</ipAddr> 
<status>UP</status> 
<overriddenstatus>UNKNOWN</overriddenstatus> 
<port enabled="true">80</port> 
<securePort enabled="false">443</securePort> 
<countryId>1</countryId> 
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">   
    <name>MyOwn</name> 
</dataCenterInfo> 
<leaseInfo>   
    <renewalIntervalInSecs>30</renewalIntervalInSecs>   
    <durationInSecs>90</durationInSecs>   
    <registrationTimestamp>1644488362293</registrationTimestamp>   
    <lastRenewalTimestamp>1645165181335</lastRenewalTimestamp>   
    <evictionTimestamp>0</evictionTimestamp>   
    <serviceUpTimestamp>1644488362293</serviceUpTimestamp> 
</leaseInfo> 
<metadata class="java.util.Collections$EmptyMap" /> 
<healthCheckUrl>http://config-service-test.xxxxxxxxxx.com:80null</healthCheckUrl> 
<vipAddress>SERVICE-CONFIG</vipAddress> 
<secureVipAddress>config-service-test.xxxxxxxxxx.com:443</secureVipAddress> 
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> 
<lastUpdatedTimestamp>1644488362293</lastUpdatedTimestamp> 
<lastDirtyTimestamp>1644488362278</lastDirtyTimestamp> 
<actionType>ADDED</actionType>    

`

xkcomeon commented 2 years ago

大佬 有微信么 加上微信啊 具体给你反馈

keijack commented 2 years ago

Do you mean that when concatenating url and port like http://config-service-test.xxxxxxxxxx.com:80 visited by do_service will fail?

If you can debug you code, could you please check whether the port matches the protocol (say: 80 to http, and 443 to https) ?

I think we should discuss this issue here and make it as a record.

xkcomeon commented 2 years ago

http://config-service-test.xxxxxxxxxx.com:80 使requests包请求是正常的 但是用我们包里的do_service()方法是失败的

xkcomeon commented 2 years ago

好像是urllib.request 请求的问题 do_service 使用了这个请求

xkcomeon commented 2 years ago

urllib.request 不支持请求 http://config-service-test.xxxxxxxxxx.com:80这样的链接

keijack commented 2 years ago

I just trim the port when it's a default port, please check out 0.10.3 and try.

xkcomeon commented 2 years ago

好的 感谢🙏

keijack commented 2 years ago

Close issue for the problem seems being resolved, If you have any other problem, please submit a new one.