zoukankan      html  css  js  c++  java
  • rabbitmq坑点与异常处理

    from:http://www.cnblogs.com/gossip/p/4573056.html

    一、None of the specified endpoints were reachable

    这个异常在创建连接时抛出(CreateConnection()),原因一般是ConnectionFactory参数设置不对,比如HostName、UserName、Password

    标准设置:

    var factory = new ConnectionFactory();

    factory.UserName = QueueSetttiong.UserName;   //用户名

    factory.Password = QueueSetttiong.Password;      //密码

    factory.HostName = QueueSetttiong.HostName;  //Rabbitmq服务IP,不包含端口

    factory.Port = AmqpTcpEndpoint.UseDefaultPort;

    factory.VirtualHost = QueueSetttiong.VirtualHost;  //默认为"/"

    factory.Protocol = Protocols.DefaultProtocol;

    部署生产后,factory配置都ok,但是还是抛异常None of the specified endpoints were reachable,最后发现原因是生产机器防火墙未打开RabbitMQ的端口,RabbitMQ的默认端口是:5672

    另外一个可能的原因:未设置VirtualHost的权限

    设置方法:RabbitmqWeb管理网站-->Admin

    未设置权限时:

    设置权限:(点击admin进入设置页面)

    二、异常:unable to connect to node rabbit@10: nodedown

    网上说要修改主机名,找半天不知道怎么修改,重新安装Rabbitmq服务端即可,有时候需要重启

    三、异常:Message:Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=320, text="CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'", classId=0, methodId=0, cause= StackTrace

    原因:队列服务端重启后,队列发布端断开了接口,无法再次发送消息

    解决:发送端设置断开连接后自动启动属性,默认为断开后每隔五秒钟重试连接

    var factory = new ConnectionFactory();

    factory.AutomaticRecoveryEnabled = true;   //设置端口后自动恢复连接属性即可

    四、Rabbitmq实际数据文件、日志文件、配置文件路径

    地址栏输入:%APPDATA%RabbitMQ

    C:UsersAdministratorAppDataRoamingRabbitMQ

    信息来源:C:Program Files (x86)RabbitMQ Server abbitmq_server-3.5.1etc 中的README.txt

  • 相关阅读:
    认识正向代理与反向代理
    python中and和or的用法
    怎样查看端口的占用情况?
    配置FCKeditor
    Ant工具(二)
    myeclipse 提示错误Undefined exploded archive location&deploy project 时不能正常显示 问题的解决
    FCKediter
    Ant工具(一)
    MyEclipse 总是弹出“multiple Errors have Occurred”
    linux下svn的常用代码
  • 原文地址:https://www.cnblogs.com/94cool/p/6437032.html
Copyright © 2011-2022 走看看