bug: discovery Eureka cannot automatically proxy to a new node
Issue description
register a new instance to Eureka,but can't proxy to this instance
Environment
- apisix version (cmd:
apisix version): 1.4 - OS:mac os
Minimal test code / Steps to reproduce the issue
1. 2. 3.
What's the actual result? (including assertion message & call stack if applicable)
oldnode host":"172.16.50.93","port":8888 newnode host":"172.16.50.93","port":8081 apisix balance proxy to oldnode not to newnode after make reload it‘s OK
What's the expected result?
please make a try with this PR: https://github.com/apache/incubator-apisix/pull/1835/files
I think this PR should fix this bug.
I tried with this PR and copied the code that different from main to my own branch ,but it always proxy to old
2020/07/14 10:37:02 [info] 60274#3150962: 173669 [lua] balancer.lua:193: pick_server(): [{"host":"172.16.50.93","port":8889,"metadata":{"management.port":"8889","commit-time":"2019-08-27T14:48:42+0800","git-short-commitid":"11efbdd","commit-branch":"dev","jar-version":"0.10.2","msv-version":"1.7.2","commit-message":"Merge branch 'apollo-generator' into 'dev'","git-commitid":"11efbdd805134d9e5ff7a0cd41aea0f6241c9602"},"weight":100},{"host":"172.16.50.93","port":8081,"metadata":{"management.port":"8081"},"weight":100}] while connecting to upstream, client: ::1, server: , request: "GET /atel/all/cmdb/apps HTTP/1.1", host: "localhost:9080"
2020/07/14 10:37:02 [info] 60274#3150962: 173669 [lua] balancer.lua:239: pick_server(): ctx: {"plugins":[{"priority":1008,"version":0.1,"schema":{"properties":{"regex_uri":{"maxItems":2,"description":"new uri that substitute from client uri for upstream, lower priority than uri property","items":{"description":"regex uri","type":"string"},"minItems":2,"type":"array"},"uri":{"maxLength":4096,"pattern":"\/.","minLength":1,"description":"new uri for upstream","type":"string"},"scheme":{"type":"string","enum":["http","https"],"description":"new scheme for upstream"},"host":{"type":"string","pattern":"[0-9a-zA-Z-.]+$","description":"new host for upstream"},"headers":{"type":"object","minProperties":1,"description":"new headers for request"}},"type":"object","minProperties":1},"check_schema":"function: 0x17ec5e38","name":"proxy-rewrite","rewrite":"function: 0x17ec6050"},"table: 0x1808d110"],"conf_id":"1","conf_type":"route","conf_version":140,"var":{"host":"localhost","request_method":"GET","uri":"/atel/all/cmdb/apps","remote_addr":"::1","upstream_uri":"/cmdb/apps","is_args":"","_request":"cdata
@qiujiayu do you have time to take a look at this bug?
@qiujiayu do you have time to take a look at this bug? Is this problem solved now?
@membphis Is this problem solved now?
@qiujiayu do you have time to fix this issue?
@Hmemories I think this bug has not been fixed. would like to fix it by yourself?
we can support Eureka in plugin, set the upstream node by this way: https://github.com/apache/apisix/blob/master/apisix/plugins/example-plugin.lua#L91
it should be a new way which is simpler.
I have an idea to solve this problem,do you think it's feasible?

ping @membphis
it seems fine, welcome PR