You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/08/26 08:37:16 UTC
[GitHub] [apisix] 123fuxiaohui opened a new issue #4904: 集成eureka注册中心失败
123fuxiaohui opened a new issue #4904:
URL: https://github.com/apache/apisix/issues/4904
### Issue description
apisix配置如下:
**conf/config.yaml**
```
apisix:
discovery: eureka
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment
role: admin
eureka:
host: 'http://127.0.0.1:8761'
prefix: "/eureka/"
fetch_interval: 30 # 从 eureka 中拉取数据的时间间隔,默认30秒
weight: 100 # default weight for node
timeout:
connect: 2000 # 连接 eureka 的超时时间,默认2000ms
send: 2000 # 向 eureka 发送数据的超时时间,默认2000ms
read: 5000 # 从 eureka 读数据的超时时间,默认5000ms
```
**upstream 配置如下**
```
{
"modifiedIndex": 293,
"value": {
"id": "369827360922403711",
"type": "roundrobin",
"create_time": 1629963884,
"update_time": 1629963884,
"service_name": "BJHL-CONSUMER-DEMO",
"name": "apisix-demo",
"discovery_type": "eureka"
},
"key": "/apisix/upstreams/369827360922403711",
"createdIndex": 293
}
```
route 配置如下
```
{
"modifiedIndex": 293,
"value": {
"id": "369827360922403711",
"type": "roundrobin",
"create_time": 1629963884,
"update_time": 1629963884,
"service_name": "BJHL-CONSUMER-DEMO",
"name": "apisix-demo",
"discovery_type": "eureka"
},
"key": "/apisix/upstreams/369827360922403711",
"createdIndex": 293
}
```
访问的时候报错:
2021/08/26 16:02:49 [error] 10324#6650627: *1336 [lua] init.lua:485: http_access_phase(): failed to set upstream: _**discovery eureka is uninitialized**_, client: ::1, server: _, request: "GET /fxh-test/hello HTTP/1.1", host: "localhost:9080"
1,如果想集成eureka注册中心需要怎么配置呢
2,apisix-dashboard 配置upstream的类型为service_name的话,只能通过数据视图吗
### Environment
- apisix version (cmd: `apisix version`):
- OS (cmd: `uname -a`):
- OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
- etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
- apisix-dashboard version, if have:
- luarocks version, if the issue is about installation (cmd: `luarocks --version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tzssangglass commented on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908001797
> invalid response body:
after get response from eureka, decoding the body as a json failed.
> body: �����������S�o�0��_,
can you see what character encoding your Eureka is using?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward edited a comment on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward edited a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907971060
APISIX conf.config.yaml:
`discovery: # service discovery center
eureka:
host: # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
- "http://127.0.0.1:8080"
prefix: /eureka/v2/
fetch_interval: 30 # default 30s
weight: 100 # default weight for node
timeout:
connect: 2000 # default 2000ms
send: 2000 # default 2000ms
read: 5000 # default 5000ms`
I notice Eureka REST operations is different:
Query for all instances | GET /eureka/v2/apps | HTTP Code: 200 on success Output: JSON/XML
-- | -- | --
so I change apisix conf, discovery.eureka.prefix = /eureka/v2/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward edited a comment on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
mangoGoForward edited a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908068473
> @mangoGoForward If your question is different from this issue, please open a new issue.
I open a issue on [#4929](https://github.com/apache/apisix/issues/4929) @tzssangglass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward commented on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908068473
> @mangoGoForward If your question is different from this issue, please open a new issue.
I open a issue on [issue 4929](https://github.com/apache/apisix/issues/4929)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward removed a comment on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward removed a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907971060
APISIX conf.config.yaml:
```
discovery: # service discovery center
eureka:
host: # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
- "http://127.0.0.1:8080"
prefix: /eureka/v2/
fetch_interval: 30 # default 30s
weight: 100 # default weight for node
timeout:
connect: 2000 # default 2000ms
send: 2000 # default 2000ms
read: 5000 # default 5000ms
```
I notice Eureka REST operations is different:
Query for all instances | GET /eureka/v2/apps | HTTP Code: 200 on success Output: JSON/XML
-- | -- | --
so I change apisix conf, discovery.eureka.prefix = /eureka/v2/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward commented on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907969607
I got some error log when APISIX starts up
`2021/08/30 10:33:22 [error] 6236#3458403: *14277 [lua] eureka.lua:96: service_info(): url :http://127.0.0.1:8080/eureka/v2/, context: ngx.timer
2021/08/30 10:41:37 [error] 6564#3463510: *11 [lua] eureka.lua:197: invalid response body: � �S�o�0�_,>�@�����PEeh� ��x8vd;tQ���sB�QU�6�C�w�|�^�乒�4ڱ�;�u�{��<� �Y;�(��K�H��z��DS�&ߞ��,��ۇ�ݔ�R;�c�lA-K0 ��'c���D�pPT��W5�ߠt����Tn�F]z�����9��i��7/�����늒��>H�b�Qw�m�[��Ca����3�!/,�_��A�
��*$7���3�m&���G��{jo�.�Mi�{%E4��|�h�C+�=�'��F�ey��CG�డ����"�O�AN��4�(l��&6��Ńt���R��čo���h4�oƽu �jⷠq���q��I�74� ��8n�w����C�J��p���RE3�VԮ5�r_.!s�h��)�k^���p��UO��'��MU-��b��)���#(��R���Ky(%�Sml��@����&��s����+���C"N/7$:�ƾ���9I��5��-_`���|4�?���^r�ͧI2O��;=�g6��H\ err: Expected value but found invalid token at character 1, context: ngx.timer`
Environment
apisix version (cmd: apisix version):2.9
OS (cmd: uname -a):Darwin niyaoaidaodeMacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
OpenResty / Nginx version (cmd: nginx -V or openresty -V):nginx version: openresty/1.19.3.2
etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):{"version":"2.9","last_report_time":1630291416,"boot_time":1630291297,"etcd_version":"3.5.0","up_time":153,"hostname":"niyaoaidaodeMacBook-Pro.local","id":"f13398f9-bed6-44f1-9ad4-50c9d73401bb"}
apisix-dashboard version, if have:
luarocks version, if the issue is about installation (cmd: luarocks --version):/usr/local/bin/luarocks 3.7.0
@tokers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward commented on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907971060
APISIX conf.config.yaml:
`discovery: # service discovery center
eureka:
host: # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
- "http://127.0.0.1:8080"
prefix: /eureka/v2/
fetch_interval: 30 # default 30s
weight: 100 # default weight for node
timeout:
connect: 2000 # default 2000ms
send: 2000 # default 2000ms
read: 5000 # default 5000ms`
I notice Eureka REST operations is different:
Query for all instances | GET /eureka/v2/apps | HTTP Code: 200 on success Output: JSON/XML
-- | -- | --
so I change apisix conf, discovery.eureka.prefix = /eureka/v2/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tzssangglass commented on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908002451
@mangoGoForward If your question is different from this issue, please open a new issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-906859440
@123fuxiaohui Have you ever tried to keep a close eye on the error.log (about eureka), especially when APISIX starts up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward edited a comment on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
mangoGoForward edited a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908068473
> @mangoGoForward If your question is different from this issue, please open a new issue.
I open a issue on [issue 4929](https://github.com/apache/apisix/issues/4929) @tzssangglass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward edited a comment on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward edited a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907969607
I got some error log when APISIX starts up
`2021/08/30 10:33:22 [error] 6236#3458403: *14277 [lua] eureka.lua:96: service_info(): url :http://127.0.0.1:8080/eureka/v2/, context: ngx.timer
2021/08/30 10:41:37 [error] 6564#3463510: *11 [lua] eureka.lua:197: invalid response body: ���������S�o�0�_,>�@�����PEeh� ��x8vd;tQ���sB�QU�6�C�w�|�^�乒�4ڱ�;�u�{��<� �Y;�(��K�H��z��DS�&ߞ��,��ۇ�ݔ�R;�c�lA-K0 ��'c���D�pPT��W5�ߠt����Tn�F]z�����9��i��7/�����늒��>H�b�Qw�m�[��Ca����3�!/,�_��A�
��*$7���3�m&���G��{jo�.�Mi�{%E4��|�h�C+�=�'��F�ey��CG�డ����"�O�AN��4�(l��&6��Ńt���R��čo���h4�oƽu��jⷠq���q��I�74� ��8n�w����C�J��p���RE3�VԮ5�r_.!s�h��)�k^���p��UO��'��MU-��b��)���#(��R���Ky(%�Sml��@����&��s����+���C"N/7$:�ƾ���9I��5��-_`���|4�?���^r�ͧI2O��;=�g6��H\�� err: Expected value but found invalid token at character 1, context: ngx.timer`
Environment
apisix version (cmd: apisix version):2.9
OS (cmd: uname -a):Darwin niyaoaidaodeMacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
OpenResty / Nginx version (cmd: nginx -V or openresty -V):nginx version: openresty/1.19.3.2
etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):{"version":"2.9","last_report_time":1630291416,"boot_time":1630291297,"etcd_version":"3.5.0","up_time":153,"hostname":"niyaoaidaodeMacBook-Pro.local","id":"f13398f9-bed6-44f1-9ad4-50c9d73401bb"}
apisix-dashboard version, if have:
luarocks version, if the issue is about installation (cmd: luarocks --version):/usr/local/bin/luarocks 3.7.0
APISIX conf.config.yaml:
```
discovery: # service discovery center
eureka:
host: # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
- "http://127.0.0.1:8080"
prefix: /eureka/v2/
fetch_interval: 30 # default 30s
weight: 100 # default weight for node
timeout:
connect: 2000 # default 2000ms
send: 2000 # default 2000ms
read: 5000 # default 5000ms
```
I notice Eureka REST operations is different:
Query for all instances | GET /eureka/v2/apps | HTTP Code: 200 on success Output: JSON/XML
-- | -- | --
so I change apisix conf, discovery.eureka.prefix = /eureka/v2/
I got instances via curl correctly
`
curl --compressed -i -X GET "http://localhost:8080/eureka/v2/apps" -H "Accept: application/json"
`
@tokers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward edited a comment on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
mangoGoForward edited a comment on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-907971060
APISIX conf.config.yaml:
```
discovery: # service discovery center
eureka:
host: # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
- "http://127.0.0.1:8080"
prefix: /eureka/v2/
fetch_interval: 30 # default 30s
weight: 100 # default weight for node
timeout:
connect: 2000 # default 2000ms
send: 2000 # default 2000ms
read: 5000 # default 5000ms
```
I notice Eureka REST operations is different:
Query for all instances | GET /eureka/v2/apps | HTTP Code: 200 on success Output: JSON/XML
-- | -- | --
so I change apisix conf, discovery.eureka.prefix = /eureka/v2/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tzssangglass commented on issue #4904: 集成eureka注册中心失败
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-906517657
pls provide env info
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] mangoGoForward commented on issue #4904: Integration of eureka as discovery registry fail
Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on issue #4904:
URL: https://github.com/apache/apisix/issues/4904#issuecomment-908063613
> can you see what character encoding your Eureka is using?
Eureka start on tomcat, and I set tomcat conf.server.xml character encoding to "UTF-8"
`<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />
`
And I got correct response via curl or use chrome to visit "http://localhost:8080/eureka/v2/apps"
```
$ curl --compressed -i -X GET "http://localhost:8080/eureka/v2/apps" -H "Accept: application/json"
HTTP/1.1 200
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Type: application/json
Content-Length: 554
Date: Mon, 30 Aug 2021 06:15:18 GMT
{"applications":{"versions__delta":"1","apps__hashcode":"UP_1_","application":[{"name":"EUREKA","instance":[{"instanceId":"niyaoaidaodeMacBook-Pro.local","hostName":"niyaoaidaodeMacBook-Pro.local","app":"EUREKA","ipAddr":"127.0.0.1","status":"UP","overriddenStatus":"UNKNOWN","port":{"$":8080,"@enabled":"true"},"securePort":{"$":443,"@enabled":"false"},"countryId":1,"dataCenterInfo":{"@class":"com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo","name":"MyOwn"},"leaseInfo":{"renewalIntervalInSecs":30,"durationInSecs":90,"registrationTimestamp":1630303157467,"lastRenewalTimestamp":1630304120244,"evictionTimestamp":0,"serviceUpTimestamp":1630303156998},"metadata":{"@class":"java.util.Collections$EmptyMap"},"appGroupName":"UNKNOWN","homePageUrl":"http://niyaoaidaodeMacBook-Pro.local:8080/","statusPageUrl":"http://niyaoaidaodeMacBook-Pro.local:8080/Status","healthCheckUrl":"http://niyaoaidaodeMacBook-Pro.local:8080/healthcheck","vipAddress":"eureka.mydomain.net","isCoordinatingDisco
veryServer":"true","lastUpdatedTimestamp":"1630303157467","lastDirtyTimestamp":"1630303156955","actionType":"ADDED"}]}]}}
```

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org