V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
UnrealEngine
V2EX  ›  PHP

RabbitMq 连接失败,查看 mq 日志显示连接成功但是又立马关闭了

  •  
  •   UnrealEngine · 120 天前 · 1130 次点击
    这是一个创建于 120 天前的主题,其中的信息可能已经有所发展或是发生改变。

    日志:

    2023-12-28 17:02:07 2023-12-28 13:02:07.875320+00:00 [info] <0.8575.0> accepting AMQP connection <0.8575.0> (172.26.0.8:45438 -> 172.26.0.2:5672)

    2023-12-28 17:02:07 2023-12-28 13:02:07.877505+00:00 [info] <0.8575.0> connection <0.8575.0> (172.26.0.8:45438 -> 172.26.0.2:5672): user 'guest' authenticated and granted access to vhost '/'

    2023-12-28 17:02:07 2023-12-28 13:02:07.877753+00:00 [info] <0.8575.0> closing AMQP connection <0.8575.0> (172.26.0.8:45438 -> 172.26.0.2:5672, vhost: '/', user: 'guest')

    代码:

    //创建连接 $this->connection = new \AMQPConnection($this->config); if (!$this->connection->connect()) { throw new \Exception('RabbitMQ 创建连接失败'); }

    config:

    array( 'host' => rabbitmq 'port' => 5672 'login' => guest 'password' => guest 'vhost' => '' );

    rabbitmq 安装成功也能成功进入管理页面

    4 条回复    2023-12-30 18:34:13 +08:00
    UnrealEngine
        1
    UnrealEngine  
    OP
       120 天前
    UnrealEngine
        2
    UnrealEngine  
    OP
       120 天前
    connect()直接返回了 null ,用 try catch 试过也不抛出异常
    ainon
        3
    ainon  
       120 天前
    看看 php 侧可有问题
    UnrealEngine
        4
    UnrealEngine  
    OP
       119 天前
    @ainon #3 扩展都安装好了的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3007 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:33 · PVG 21:33 · LAX 06:33 · JFK 09:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.