4Manuals

  • PDF Cloud HOME

如何在无数据库和声明式配置中访问Kong服务 Download

    应用JAVAEE,微服务和容器 如何使用Spring Boot将HL7格式转换为json格式并发布到activemq的不同主题? 我需要正确的方法将模板文件放置在微服务中 终点电车和终点电车有什么区别?

我已经用声明性的方式配置了kong。我的服务和路线已配置为。

services:
 - name: mock-service
   url: http://mockbin.org/request
   path: /
   tags:
   - example
   routes:
    - name: mock-route
      methods:
      - GET
      hosts: ["mockbin.org"]
      paths: ["/mock"] 

我的服务和路线已注册,我可以看到响应为

http://localhost:8001/services  :-  Response 


{ 
   "next":null,
   "data":[ 
      { 
         "host":"mockbin.org",
         "created_at":1577708204,
         "connect_timeout":60000,
         "id":"9ff0ee4e-7c2b-51e3-9490-f93f946547e8",
         "protocol":"http",
         "name":"mock-service",
         "read_timeout":60000,
         "port":80,
         "path":"/request",
         "updated_at":1577708204,
         "client_certificate":null,
         "tags":[ 
            "example"
         ],
         "write_timeout":60000,
         "retries":5
      }
   ]
}


http://localhost:8001/routes   Response

{ 
   "next":null,
   "data":[ 
      { 
         "id":"21113e89-d366-5f75-b44a-cef07644d282",
         "tags":null,
         "updated_at":1577708204,
         "destinations":null,
         "headers":null,
         "protocols":[ 
            "http",
            "https"
         ],
         "created_at":1577708204,
         "snis":null,
         "hosts":[ 
            "mockbin.org"
         ],
         "name":"mock-route",
         "preserve_host":false,
         "regex_priority":0,
         "strip_path":true,
         "sources":null,
         "methods":[ 
            "GET"
         ],
         "https_redirect_status_code":426,
         "paths":[ 
            "/mock"
         ],
         "service":{ 
            "id":"9ff0ee4e-7c2b-51e3-9490-f93f946547e8"
         }
      }
   ]
}

When i am trying to acess the my mockbin service though kong . i not getting the response .

http://localhost:8000/mock    if host is not passed in header

{
"message": "no Route matched with those values"
}


http://localhost:8000/mock   if host is passed in header

-header 

 Host   mockbin.org

 response status :- 500 

 An unexpected error occurred

kong日志文件中的错误:

2019/12/30 17:46:44 [notice] 60919#0: *2 [kong] init.lua:298 declarative config loaded from /var/kong.yml, context: init_worker_by_lua*
2019/12/30 17:46:44 [warn] 60917#0: *1 [lua] globalpatches.lua:52: sleep(): executing a blocking 'sleep' (0.001 seconds), context: init_worker_by_lua*
2019/12/30 17:49:56 [error] 60920#0: *1586 upstream timed out (110: Connection timed out) while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://3.228.254.201:80/request", host: "mockbin.org"
2019/12/30 17:49:56 [error] 60920#0: *1586 [lua] balancer.lua:917: balancer_execute(): DNS resolution failed: dns server error: 100 cache only lookup failed. Tried: ["(short)mockbin.org:(na) - cache-miss","mockbin.org:1 - cache only lookup failed/dns server error: 100 cache only lookup failed","mockbin.org:33 - cache only lookup failed/dns server error: 100 cache only lookup failed","mockbin.org:5 - cache only lookup failed/dns server error: 100 cache only lookup failed"] while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://3.228.254.201:80/request", host: "mockbin.org"
2019/12/30 17:49:56 [error] 60920#0: *1586 [lua] init.lua:800: balancer(): failed to retry the dns/balancer resolver for mockbin.org' with: dns server error: 100 cache only lookup failed while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://3.228.254.201:80/request", host: "mockbin.org"
2019/12/30 17:57:02 [error] 60918#0: *6694 upstream timed out (110: Connection timed out) while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://3.228.254.201:80/request", host: "mockbin.org"
2019/12/30 17:58:02 [error] 60918#0: *6694 upstream timed out (110: Connection timed out) while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://52.21.131.234:80/request", host: "mockbin.org"
2019/12/30 17:58:02 [error] 60918#0: *6694 [lua] balancer.lua:917: balancer_execute(): DNS resolution failed: dns server error: 100 cache only lookup failed. Tried: ["(short)mockbin.org:(na) - cache-miss","mockbin.org:1 - cache only lookup failed/dns server error: 100 cache only lookup failed","mockbin.org:33 - cache only lookup failed/dns server error: 100 cache only lookup failed","mockbin.org:5 - cache only lookup failed/dns server error: 100 cache only lookup failed"] while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://52.21.131.234:80/request", host: "mockbin.org"
2019/12/30 17:58:02 [error] 60918#0: *6694 [lua] init.lua:800: balancer(): failed to retry the dns/balancer resolver for mockbin.org' with: dns server error: 100 cache only lookup failed while connecting to upstream, client: 172.21.200.35, server: kong, request: "GET /mock HTTP/1.1", upstream: "http://52.21.131.234:80/request", host: "mockbin.org"

我已经按照文章进行了解决。但没有成功。

https://docs.konghq.com/0.13.x/getting-started/configuring-a-service/

https://www.jerney.io/secure-apis-kong-keycloak-1/

https://medium.com/@vasista/explaining-kong-plugins-key-authentication-and-rate-limiting-on-flask-api-9f922c4f051

0 个答案:

没有答案



Similar searches
    就绪的API自动化框架 无法删除目录中的所有文件 无法使用Protractor Azure Pipeline运行conf.js SQL:执行窗口功能并找到百分比 我如何触发MDI Windows表单的自动注销