如何解决通过dockerswarm连接到Qpid时,质子未知的主机
我正在使用docker swarm构建集成环境。我对qpid / amqp / proton / pika不太了解。这些组件既可以在本地也可以在各自的docker容器中通过组合和旋转来实现预期的工作。
我有一个使用python和qpid服务器的质子客户端,当使用docker-compose时成功启动了
services:
qpid:
image: XX/qpidj:latest
restart: on-failure
volumes:
- ./build_tools/Qpid:/qpid
client:
build:
context: .
dockerfile: Dockerfile
restart: on-failure
environment:
WAIT_HOSTS: qpid:5672
WAIT_HOSTS_TIMEOUT: 180
services:
qpid:
image: XX/qpidj:latest
volumes:
- ./Qpid:/qpid
networks:
- test
ports:
- "5672:5672"
client:
image: XX/client:develop
environment:
WAIT_HOSTS: qpid:5672
WAIT_HOSTS_TIMEOUT: 180
networks:
- test
networks:
# create network first using this as attachable does not appear to blend
# docker network create -d overlay --attachable <name>
test:
external: true
driver: overlay
但是质子抱怨未知的宿主。请参阅下面的调试日志转储
2020-09-07 11:47:09,317 DEBUG:document_converter: Starting Qpid Handler
2020-09-07 11:47:09,318 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_init(<proton._reactor.TimerSelectable object at 0x7f3ea91e9c18>)
2020-09-07 11:47:09,318 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._reactor.TimerSelectable object at 0x7f3ea91e9c18>)
2020-09-07 11:47:09,318 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_INIT(<proton._endpoints.Connection 0x7f3ea91e9c50 ~ 0x23f7ab0>)
2020-09-07 11:47:09,318 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_LOCAL_OPEN(<proton._endpoints.Connection 0x7f3ea91e9f60 ~ 0x23f7ab0>)
2020-09-07 11:47:09,318 DEBUG:proton: connecting to Url('amqp://qpid:5672')...
2020-09-07 11:47:09,319 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_SESSION_INIT(<proton._endpoints.Session 0x7f3ea91e9f28 ~ 0x23f8810>)
2020-09-07 11:47:09,319 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_SESSION_LOCAL_OPEN(<proton._endpoints.Session 0x7f3ea91e9f60 ~ 0x23f8810>)
2020-09-07 11:47:09,319 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_LINK_INIT(<proton._endpoints.Sender 0x7f3ea91e9f28 ~ 0x23f9290>)
2020-09-07 11:47:09,319 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_LINK_LOCAL_OPEN(<proton._endpoints.Sender 0x7f3ea91e9be0 ~ 0x23f9290>)
2020-09-07 11:47:09,320 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_LINK_INIT(<proton._endpoints.Receiver 0x7f3ea91e9fd0 ~ 0x23f9710>)
2020-09-07 11:47:09,320 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_LINK_LOCAL_OPEN(<proton._endpoints.Receiver 0x7f3ea91e9be0 ~ 0x23f9710>)
2020-09-07 11:47:09,320 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_BOUND(<proton._endpoints.Connection 0x7f3ea91e9fd0 ~ 0x23f7ab0>)
2020-09-07 11:47:09,323 DEBUG:proton: Connect trying first transport address: (<AddressFamily.AF_INET: 2>,<SocketKind.soCK_STREAM: 1>,6,'',('10.0.2.196',5672))
2020-09-07 11:47:09,324 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT(<proton._transport.Transport 0x7f3eafe383c8 ~ 0x23f9b90>)
2020-09-07 11:47:09,325 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_init(<proton._handlers.ConnectSelectable object at 0x7f3ea91e9be0>)
2020-09-07 11:47:09,325 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,326 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,326 DEBUG:proton: Connection succeeded
2020-09-07 11:47:09,327 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,327 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_final(<proton._handlers.ConnectSelectable object at 0x7f3ea91e9be0>)
2020-09-07 11:47:09,327 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_init(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,327 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,328 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,328 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,329 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_writable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,329 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,330 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,330 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,339 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,339 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_readable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,342 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT(<proton._transport.Transport 0x7f3eb1460128 ~ 0x23f9b90>)
2020-09-07 11:47:09,342 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,343 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,343 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,343 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_writable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,343 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,344 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,344 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,346 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,346 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_readable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,346 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT(<proton._transport.Transport 0x7f3eafe383c8 ~ 0x23f9b90>)
2020-09-07 11:47:09,346 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,347 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,347 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,347 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_writable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,347 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,348 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,348 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,352 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,352 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_readable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,352 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_REMOTE_OPEN(<proton._endpoints.Connection 0x7f3eb1460128 ~ 0x23f7ab0>)
2020-09-07 11:47:09,352 DEBUG:proton: connected to qpid
2020-09-07 11:47:09,353 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_REMOTE_CLOSE(<proton._endpoints.Connection 0x7f3eafe383c8 ~ 0x23f7ab0>)
2020-09-07 11:47:09,353 ERROR:proton: UnkNown hostname in connection open: 'qpid'
2020-09-07 11:47:09,353 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT_TAIL_CLOSED(<proton._transport.Transport 0x7f3ea91e9f28 ~ 0x23f9b90>)
2020-09-07 11:47:09,353 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,353 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_LOCAL_CLOSE(<proton._endpoints.Connection 0x7f3ea91e9dd8 ~ 0x23f7ab0>)
2020-09-07 11:47:09,353 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT(<proton._transport.Transport 0x7f3eafe383c8 ~ 0x23f9b90>)
2020-09-07 11:47:09,354 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,354 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Yielding
2020-09-07 11:47:09,354 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_quiesced(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,354 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_writable(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,354 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT_HEAD_CLOSED(<proton._transport.Transport 0x7f3eafe383c8 ~ 0x23f9b90>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT_CLOSED(<proton._transport.Transport 0x7f3eb1460128 ~ 0x23f9b90>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_updated(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_final(<proton._selectable.Selectable object at 0x7f3ea91e9fd0>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_CONNECTION_UNBOUND(<proton._endpoints.Connection 0x7f3eafe383c8 ~ 0x23f7ab0>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: PN_TRANSPORT(<proton._transport.Transport 0x7f3eb1460128 ~ 0x23f9b90>)
2020-09-07 11:47:09,355 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: selectable_final(<proton._reactor.TimerSelectable object at 0x7f3ea91e9c18>)
2020-09-07 11:47:09,356 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Stopping
2020-09-07 11:47:09,356 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> recvd Event: reactor_final(<proton._reactor.Container object at 0x7f3ea91e99e8>)
2020-09-07 11:47:09,356 DEBUG:proton: <proton._reactor.Container object at 0x7f3ea91e99e8> Stopping
我已经从与同一基本映像连接到相同docker网络的容器中连接到qpid,并且我已经成功运行
amqpcli send qpid 5672 exchange simple_message -m "Hello there" -v default -u guest
我得到了答复
Connecting to queue @ qpid:5672... SUCCESS!
Message successfully published to exchange [exchange]!
我也可以成功运行nslookup并卷曲qpid:8080-nslookup报告了上面的'10 .0.2.196'地址-尽管Docker检查网络测试显示
"4af056b5f2a7021df9130a9d370f05176776382b5972306709b77166f4ef4c24": {
"Name": "test_qpid.1.btrzcdn0ixxq4o73qkoziq7dh","EndpointID": "d5a2f63145d21f87ea8a86136b816b9dd1b78fa6189864ff1a7c773577242a89","MacAddress": "02:42:0a:00:02:c5","IPv4Address": "10.0.2.197/24","IPv6Address": ""
所以我的问题是质子/ dockerswarm在后台执行什么操作以连接到我的qpid容器,为什么它仅在通过compose而不是swarm运行时才起作用(当前是1个节点swarm,试图使它正常工作) 请让我知道是否需要更多信息
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。