RabbitMQ-无法找到 rabbitmq.conf 文件

RabbitMQ-无法找到 rabbitmq.conf 文件

我正在使用 RabbitMQ 3.7.7,并在 Windows Server 2012 R2 Standard 上执行了以下步骤进行安装:

  1. 使用向导中的默认选择安装 Erlang OTO 21 (10.0.1),无需在向导中进行任何更改。
  2. 使用向导中的默认选择安装 RabbitMQ 3.7.7,无需在向导中进行任何更改。
  3. 在安装过程中,我没有创建任何环境变量等。
  4. 完成 Erlang 和 RabbitMQ 安装后,RabbitMQ 服务将启动,默认情况下,将在路径下创建日志\AppData\Roaming\RabbitMQ\log。目前,我们可以在此日志中看到太多“INFO”条目,并且日志很快就会被填满,这将不必要地以每天近 500 MB 的速度占用磁盘空间,从而导致几天内出现其他问题。我们感兴趣的是,日志文件中只记录“Error”,而不应记录“Info”。
  5. 从运行 -> services.msc,停止 RabbitMQ 服务。
  6. 日志文件提到了配置文件的路径如下:
    配置文件:c:/Users/MANPRE~1.SIN/AppData/Roaming/RabbitMQ/advanced.config
    :c:/Users/MANPRE~1.SIN/AppData/Roaming/RabbitMQ/rabbitmq.conf

由于我无法在文件夹下找到 rabbitmq.conf 文件\AppData\Roaming\RabbitMQ,我宁愿期望日志中的配置条目为“未找到 rabbitmq.conf”,但日志中没有这样的条目。

  1. 但是,我能够rabbitmq.config.example在同一路径下找到文件。我取消注释代码并从文件中删除注释,然后按如下方式保存文件:

''' [
{rabbit,[{tcp_listeners,[5672]},
{tcp_listeners,[{"127.0.0.1", 5672},
{"::1", 5672}]},
{ssl_listeners,[5671]},
{num_tcp_acceptors,10},
{num_ssl_acceptors,1},
{handshake_timeout,10000},
{reverse_dns_lookups,false},
{loopback_users,[<<"guest">>]},
{loopback_users,[]},
{ssl_options,[{cacertfile,"/path/to/testca/cacert.pem"},
{certfile,"/path/to/server/cert.pem"},
{keyfile,"/path/to/server/key.pem"},
{verify,verify_peer},
{fail_if_no_peer_cert,false}]},
{auth_mechanisms,['PLAIN','AMQPLAIN']},
{auth_backends,[rabbit_auth_backend_internal]},
{auth_mechanisms,['EXTERNAL']},
{auth_backends,[rabbit_auth_backend_ldap]},
{ssl_cert_login_from,distinguished_name},
{ssl_handshake_timeout,5000},
{ssl_allow_poodle_attack,false},
{password_hashing_module,rabbit_password_hashing_sha256},
{config_entry_decoder,[{passphrase,<<“mypassphrase”>>}]}
{config_entry_decoder,[{passphrase,{file,“/path/to/passphrase/file”}}]}
{config_entry_decoder,[{passphrase,prompt}]}
{config_entry_decoder,[{cipher,aes_cbc256},
{hash,sha512},
{iterations,1000}]}
{default_vhost,<<"/">>},
{default_user,<<"guest">>},
{default_pass,<<"guest">>},
{default_permissions,[<<"。“>>,<<”。">>, <<".*">>]},
{default_user_tags, [administrator]},
{heartbeat, 60},
{frame_max, 131072},
{initial_frame_max, 4096},
{channel_max, 0},
{connection_max, infinity},
{tcp_listen_options, [{backlog, 128},
{nodelay, true},
{exit_on_close, false}]},
{vm_memory_high_watermark, 0.4},
{vm_memory_high_watermark, {absolute, 1073741824}},
{vm_memory_high_watermark, {absolute, "1024M"}},
{vm_memory_high_watermark_paging_ratio, 0.5},
{vm_memory_calculation_strategy, rss},
{memory_monitor_interval,2500},
{total_memory_available_override_value,“5000MB”},
{disk_free_limit,50000000},
{disk_free_limit,“50MB”},
{disk_free_limit,“50000kB”},
{disk_free_limit,“2GB”},
{disk_free_limit,{mem_relative,2.0}},
{queue_master_locator,<<“client-local”>>},
{mirroring_sync_batch_size,4096},
{mirroring_flow_control,true},
{server_properties,[]},
{cluster_partition_handling,ignore},
{mirroring_sync_batch_size,4096},
{cluster_nodes,{['[电子邮件保护]'], disc}},
{cluster_keepalive_interval,10000},
{collect_statistics,none},
{collect_statistics_interval,5000},
{trace_vhosts,[]},
{hipe_compile,false},
{delegate_count,16},
{mnesia_table_loading_retry_limit,10},
{mnesia_table_loading_retry_timeout,30000},
{queue_index_embed_msgs_below,4096},
{queue_index_max_journal_entries,32768},
{msg_store_credit_disc_bound,{4000,800}},
{msg_store_io_batch_size,4096},
{credit_flow_default_credit,{400,200}},
{channel_operation_timeout, 15000},
{queue_explicit_gc_run_operation_threshold,1000},
{lazy_queue_explicit_gc_run_operation_threshold,1000},
{disk_monitor_failure_retries,10},
{disk_monitor_failure_retry_interval,120000},
{background_gc_enabled,false},
{background_gc_target_interval,60000},
{msg_store_file_size_limit,16777216},
{fhc_write_buffering,true},
{fhc_read_buffering,false}
]},
{kernel,[{net_ticktime,60}]},
{rabbitmq_management,[{load_definitions,“/path/to/exported/definitions.json”},
{http_log_dir, “/path/to/rabbitmq/logs/http”},
{listener,[{port,12345},
{ip, “127.0.0.1”},
{ssl,true},
{ssl_opts,[{cacertfile, “/path/to/cacert.pem”},{certfile
, “/path/to/cert.pem”},{keyfile , “ /path/to/key.pem”}]}]},{rates_mode,basic},{sample_retention_policies,[{global,[{60 , 5},{3600, 60},{86400, 1200}]},
{ basic,[{
60 , 5},{3600, 60}]}, {detailed,[{10, 5}]}] }, {rabbitmq_shovel, [{shovels, [{my_first_shovel, [{sources, [{brokers, ["amqp://user:








[电子邮件保护]/my_vhost”]},{declarations,[]}]},{destinations,[{broker,“amqp://”},{declarations,[]}]},{queue,<<“your-queue-name-goes-here”>>},{prefetch_count,10},{ack_mode,on_confirm},{publish_fields,[{exchange,<<“my_exchange”>>},{routing_key,<<“from_shovel”>>}]},{publish_properties,[{delivery_mode,2}]},{reconnect_delay,2.5}]}]} {defaults,[{
prefetch_count
,0},
{ack_mode,on_confirm},
{publish_fields,[]}, { publish_properties , [ {delivery_mode,2}]},
{ reconnect_delay, 2.5 } ] } ]},









{rabbitmq_stomp,
[
{tcp_listeners,[{“127.0.0.1”,61613},
{“::1”,61613}]},
{ssl_listeners,[61614]},
{num_tcp_acceptors,10},
{num_ssl_acceptors,1},
{ssl_cert_login,true},
{default_user,
[{login,“guest”},
{passcode,“guest”}]},
{implicit_connect,true},
{proxy_protocol,false}
]
},

{rabbitmq_mqtt,
[
{default_user,<<“guest”>>},
{default_pass,<<“guest”>>},
{allow_anonymous,true},
{vhost,<<“/”>>},
{exchange,<<“amq.topic”>>},
{subscription_ttl,1800000},
{prefetch,10},
{tcp_listeners,[1883]},
{ssl_listeners,[]},
{num_tcp_acceptors,10},
{num_ssl_acceptors,1},
{tcp_listen_options,[
{backlog,128},
{linger,{true,0}},
{exit_on_close,false}
]},
{proxy_protocol,false}
]},

{rabbitmq_amqp1_0,
[
{default_user,"guest"},
{protocol_strict_mode,false}
]},

{rabbitmq_auth_backend_ldap,
[
{servers,[“your-server-name-goes-here”]},
{use_ssl,false},
{port,389},
{timeout,infinity},
{log,false},
{user_dn_pattern,“cn = $ {username},ou = People,dc = example,dc = com”},
{dn_lookup_attribute,“userPrincipalName”},
{dn_lookup_base,“DC = gopivotal,DC = com”},
{other_bind,as_user},
{vhost_access_query,{in_group,“ou = $ {vhost} - users,ou = vhosts,dc = example,dc = com”}},{resource_access_query,{constant,true}},
{tag_queries,[]}
]},

{lager,[
{log_root,“/var/log/rabbitmq”},
{handlers,[
{lager_file_backend,[{file,“rabbit.log”},
{level,info},
{date,“”},
{size,0}]}
]},
{extra_sinks,[{rabbit_log_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_channel_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_conection_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_mirroring_lager_event,[{handlers, [{lager_forwarder_backend,[lager_event, info]}]}]}
]}
]}
].
'''

  1. 将文件 RabbitMQ.config.example 重命名为rabbitmq.conf
  2. 打开 RabbitMQ 命令提示符,并执行命令 rabbitmq-pluginsenablerabbitmq_management
  3. 从运行 -> services.msc,启动 RabbitMQ 服务。
  4. 重新启动服务器。
  5. 但此后,日志记录停止了,这并不是因为上述更改起作用了,而是因为 RabbitMQ 停止工作了。

确认 RabbitMQ 无法正常工作,因为 URLhttp://localhost:15672/无法启动,之前通过默认安装可以正常启动,但现在却出现代理和防火墙错误。

  1. 一些在线博客建议从 .conf 文件中删除不需要的内容,因此我将文件更改为如下内容:

[
{lager,[
{log_root," / var / log / rabbitmq"},
{handlers,[
{lager_file_backend,[{file," rabbit.log"},
{level,info},
{date,""},
{size,0}]}
]},
{extra_sinks,[ {rabbit_log_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_channel_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_conection_lager_event,[{handlers,[{lager_forwarder_backend,[lager_event,info]}]}]},
{rabbit_mirroring_lager_event,[{handlers, [{lager_forwarder_backend,[lager_event, info]}]}]}
]}
]}
].

完成上述操作后,我执行了 RabbitMQ 命令“rabbitmq-plugins”启用“rabbitmq_management”并重新启动了服务器和 rabbitmq 服务,仍然是 RabbitMQ 的登录页面'http://本地主机:15672/' 不能打开。

  1. 其他一些博客建议将.conf 文件保留为:

[ {rabbit,[{log_levels,[{connection,error}]}]} ]。

完成上述操作后,我执行了 RabbitMQ 命令“rabbitmq-plugins”启用“rabbitmq_management”并重新启动了服务器和 rabbitmq 服务,仍然是 RabbitMQ 的登录页面'http://本地主机:15672/' 不能打开。

我浏览了几个博客和论坛,但还是无法确定我哪里出了问题。当我将配置文件重命名为“.conf”时,我深深怀疑出了问题,因为那时 RabbitMQ 停止了工作。

如果您能指出我错在哪里,或者能指导我找到 .conf 文件,我将不胜感激。

答案1

之前我也遇到过一些链接,要求在 .conf 文件中添加以下行:
log.file.level = error
log.connection.level = error
log.channel.level = error

但我无法弄清楚它到底位于 .conf 文件的哪个部分下。

我再次尝试清除 .conf 文件的内容并仅保留 .conf 文件中的以下 3 行:
log.file.level = error
log.connection.level = error
log.channel.level = error

而且它有效。

您可以设置日志级别根据您的要求。
&可以参考这里&这里了解更多信息。

因此,RabbitMQ.conf 文件仅位于路径 - \AppData\Roaming\RabbitMQ,唯一的问题是 .conf 文件的格式过时,无法正常工作。更正格式后,它就可以正常工作了。

相关内容