4

Hono 部署在 Minikube 集群上(我按照https://www.eclipse.org/hono/getting-started/在本地设置 Hono)并且 Ditto 在 localhost 上运行。我尝试按照本教程进行调整,使其适用于本地部署。不幸的是,我无法将 Ditto 连接到本地 Hono 实例的 AMQP 端点,我尝试了以下方式:

curl -X POST -i -u devops:foobar -H 'Content-Type: application/json' -d '{
  "targetActorSelection": "/system/sharding/connection",
  "headers": {
    "aggregate": false
  },
  "piggybackCommand": {
      "type": "connectivity.commands:testConnection",
      "connection": {
      "id": "hono-example-connection",
      "connectionType": "amqp-10",
      "connectionStatus": "open",
      "failoverEnabled": true,
      "uri": "amqp://consumer%40HONO:verysecret@honotry:15672",
      "sources": [
        {
          "addresses": [
        "telemetry/test_tenant"
          ],
          "authorizationContext": ["nginx:ditto"]
        }
      ]}
    }
}' http://localhost:8080/devops/piggyback/connectivity?timeout=8000

“honotry”解析为“hono-dispatch-router-ext”服务的 IP 地址。

我得到回报:

{"?":{"?":{"type":"devops.responses:errorResponse","status":504,"serviceName":null,"instance":null,"payload":{"status": 504,"error":"connectivity:connection.failed","message":"ID 为 'hono-example-connection' 的连接连接失败。","description":"honotry: 系统错误"}}}}

我不知道为什么会收到此错误消息。

我能够将本地 Ditto 实例连接到 Hono Sandbox:

curl -X POST -i -u devops:foobar -H 'Content-Type: application/json' -d '{
  "targetActorSelection": "/system/sharding/connection",
  "headers": {
    "aggregate": false
  },
  "piggybackCommand": {
      "type": "connectivity.commands:testConnection",
      "connection": {
      "id": "hono-example-connection",
      "connectionType": "amqp-10",
      "connectionStatus": "open",
      "failoverEnabled": true,
      "uri": "amqp://consumer%40HONO:verysecret@hono.eclipse.org:15672",
      "sources": [
        {
          "addresses": [
        "telemetry/test_tenant"
          ],
          "authorizationContext": ["nginx:ditto"]
        }
      ]}
    }
}' http://localhost:8080/devops/piggyback/connectivity?timeout=8000

我得到回报:

{"?":{"?":{"type":"connectivity.responses:testConnection","status":200,"connectionId":"hono-example-connection","testResult":"成功连接 + 初始化映射器"}}}

也可以使用命令行客户端连接本地 Hono AMQP Endpoint:

java -jar hono-cli-*-exec.jar --hono.client.host=honotry --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --spring.profiles.active=receiver --tenant.id=test_tenant

有谁知道如何解决这个问题?先感谢您!

编辑:

kubectl get service -n hono

返回

NAME                                      TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                           AGE
hono-adapter-amqp-vertx                   LoadBalancer   10.98.166.86     10.98.166.86    5672:32672/TCP,5671:32671/TCP     38d
hono-adapter-amqp-vertx-headless          ClusterIP      None             <none>          <none>                            38d
hono-adapter-http-vertx                   LoadBalancer   10.109.22.54     10.109.22.54    8080:30080/TCP,8443:30443/TCP     38d
hono-adapter-http-vertx-headless          ClusterIP      None             <none>          <none>                            38d
hono-adapter-mqtt-vertx                   LoadBalancer   10.102.80.84     10.102.80.84    1883:31883/TCP,8883:30883/TCP     38d
hono-adapter-mqtt-vertx-headless          ClusterIP      None             <none>          <none>                            38d
hono-artemis                              ClusterIP      10.109.194.251   <none>          5671/TCP                          38d
hono-dispatch-router                      ClusterIP      10.96.42.49      <none>          5673/TCP                          38d
hono-dispatch-router-ext                  LoadBalancer   10.98.212.66     10.98.212.66    15671:30671/TCP,15672:30672/TCP   38d
hono-grafana                              ClusterIP      10.97.9.216      <none>          3000/TCP                          38d
hono-prometheus-server                    ClusterIP      10.102.174.24    <none>          9090/TCP                          38d
hono-service-auth                         ClusterIP      10.101.250.119   <none>          5671/TCP                          38d
hono-service-auth-headless                ClusterIP      None             <none>          <none>                            38d
hono-service-device-connection-headless   ClusterIP      None             <none>          <none>                            38d
hono-service-device-registry              ClusterIP      10.108.127.7     <none>          5671/TCP,8443/TCP                 38d
hono-service-device-registry-ext          LoadBalancer   10.108.60.120    10.108.60.120   28080:31080/TCP,28443:31443/TCP   38d
hono-service-device-registry-headless     ClusterIP      None             <none>          <none>                            38d

在 /etc/hosts 中将 honotry 设置为 10.98.212.66。

4

0 回答 0