2017-08-16 133 views
0

我已經在網絡適配器定義爲Bridge的CentOS虛擬機中安裝了RabbitMQ。 我正在嘗試配置RabbitMQ管理以便通過機器的IP地址訪問WebApp。配置如下:RabbitMQ管理訪問問題

{rabbitmq_management, 
    [%% Pre-Load schema definitions from the following JSON file. See 
    %% http://www.rabbitmq.com/management.html#load-definitions 
    %% 
    %% {load_definitions, "/path/to/schema.json"}, 

    %% Log all requests to the management HTTP API to a file. 
    %% 
    %% {http_log_dir, "/path/to/access.log"}, 

    %% Change the port on which the HTTP listener listens, 
    %% specifying an interface for the web server to bind to. 
    %% Also set the listener to use SSL and provide SSL options. 
    %% 
    %% {listener, [{port,  12345}, 
    %%    {ip,  "192.168.1.131"}, 
    %%    {ssl,  false}, 
    %%    {ssl_opts, [{cacertfile, "/path/to/cacert.pem"}, 
    %%       {certfile, "/path/to/cert.pem"}, 
    %%       {keyfile, "/path/to/key.pem"}]}]}, 

    {listener, [{port, 12345},{ip, "192.168.1.131"}]} 

    %% Configure how long aggregated data (such as message rates and queue 
    %% lengths) is retained. Please read the plugin's documentation in 
    %% https://www.rabbitmq.com/management.html#configuration for more 
    %% details. 
    %% 
    %% {sample_retention_policies, 
    %% [{global, [{60, 5}, {3600, 60}, {86400, 1200}]}, 
    %% {basic, [{60, 5}, {3600, 60}]}, 
    %% {detailed, [{10, 5}]}]} 
    ]}, 

正如你在上面看到的,我已經配置了監聽器{port, 12345},{ip, "192.168.1.131"}

當啓動服務器我遇到了以下錯誤:

Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details. 

日誌如下:

Aug 16 16:18:15 localhost.localdomain rabbitmqctl[5630]: - cookie hash: PmW6Wh1PELt7r55GMh8s7g== 
Aug 16 16:18:15 localhost.localdomain systemd[1]: rabbitmq-server.service: control process exited, code=exited status=2 
Aug 16 16:18:15 localhost.localdomain systemd[1]: Failed to start RabbitMQ broker. 
Aug 16 16:18:15 localhost.localdomain systemd[1]: Unit rabbitmq-server.service entered failed state. 
Aug 16 16:18:15 localhost.localdomain systemd[1]: rabbitmq-server.service failed. 

能否請你讓我知道什麼是錯的配置?

感謝

回答

0

正確的配置文件是:

[ 
{rabbitmq_management, 
    [ 
    {listener, [{port, 12345},{ip, "192.168.0.102"}]} 
    ]} 

]. 

測試它:

curl -X GET -u test:test http://192.168.0.102:12345/api/overview | python -m json.tool 

{ 
    "cluster_name": "[email protected]", 
    "contexts": [ 
     { 
      "description": "RabbitMQ Management", 
      "ip": "192.168.0.102", 
      "node": "[email protected]", 
      "path": "/", 
      "port": "12345", 
      "ssl_opts": [] 
     } 
    ], 
....