Skip to content

Cannot set upstream, eureka is not initialized #6688

@flash520

Description

@flash520

Description

在路由中配置使用 eureka 服务发现,配置过程中未提示错误,但在请求路由时,出现如下错误
[error] 49#49: *1459 [lua] init.lua:520: http_access_phase(): failed to set upstream: discovery eureka is uninitialized, client: 192.168.1.94, server: _, request: "POST /movie/DescribeVideoList HTTP/1.1", host: "apisix.dev.xxx.cn"

apisix config.yaml配置文件如下

apisix:
  node_listen: 9080              # APISIX listening port
  enable_ipv6: false

  allow_admin:                  # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
    - 0.0.0.0/0              # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.

  admin_key:
    - name: "admin"
      key: edd1c9f034335f136f87ad84b625c8f1
      role: admin                 # admin: manage all configuration data
                                  # viewer: only can view configuration data
    - name: "viewer"
      key: 4054f7cf07e344346cd3f287985e76a2
      role: viewer
  
  enable_control: true
  control:
    ip: "0.0.0.0"
    port: 9092

  discovery:                       # service discovery center
    eureka:
      host:                        # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
        - "http://admin:admin@10.42.1.54:7000" # Access address of Eureka Server started by Spring Boot
      prefix: "/eureka/"

etcd:
  host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
    - "http://10.42.1.220:2379"     # multiple etcd address
  prefix: "/apisix"               # apisix configurations prefix
  timeout: 30                     # 30 seconds

plugin_attr:
  prometheus:
    export_addr:
      ip: "0.0.0.0"
      port: 9091

路由配置如下:

{
  "uri": "/movie/DescribeVideoList",
  "name": "xx列表",
  "methods": [
    "POST"
  ],
  "upstream": {
    "timeout": {
      "connect": 6,
      "send": 6,
      "read": 6
    },
    "type": "roundrobin",
    "scheme": "http",
    "discovery_type": "eureka",
    "pass_host": "pass",
    "service_name": "CLASS-MOVIE",
    "keepalive_pool": {
      "idle_timeout": 60,
      "requests": 1000,
      "size": 320
    }
  },
  "status": 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions