rabbitmq_坑

 
1、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的權限node

設置方法:RabbitmqWeb管理網站-->Admin網站

未設置權限時:spa

設置權限:(點擊admin進入設置頁面).net

 

 

 

 2、異常:unable to connect to node rabbit@10: nodedown日誌

網上說要修改主機名,找半天不知道怎麼修改,從新安裝Rabbitmq服務端便可,有時候須要重啓code

 

 3、異常: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= StackTraceserver

緣由:隊列服務端重啓後,隊列發佈端斷開了接口,沒法再次發送消息blog

解決:發送端設置斷開鏈接後自動啓動屬性,默認爲斷開後每隔五秒鐘重試鏈接接口

 var factory = new ConnectionFactory();rabbitmq

factory.AutomaticRecoveryEnabled = true;   //設置端口後自動恢復鏈接屬性便可

 

4、Rabbitmq實際數據文件、日誌文件、配置文件路徑

地址欄輸入:%APPDATA%\RabbitMQ\

C:\Users\Administrator\AppData\Roaming\RabbitMQ

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

相關文章
相關標籤/搜索