RabbitMQ Configuration

RabbitMQ配置文件


无论是rabbitmq.conf 还是 advanced.config,必须重启MQ才能生效

how to find tconfiguration file location

  1. 通过日志文件定位配置文件的位置
     Starting RabbitMQ 3.8.22 on Erlang 24.0.5 [jit]
     Copyright (c) 2007-2021 VMware, Inc. or its affiliates.
     Licensed under the MPL 2.0. Website: https://rabbitmq.com
    
      ##  ##      RabbitMQ 3.8.22
      ##  ##
      ##########  Copyright (c) 2007-2021 VMware, Inc. or its affiliates.
      ######  ##
      ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.com
    
      Erlang:      24.0.5 [jit]
      TLS Library: OpenSSL - OpenSSL 1.1.1l  24 Aug 2021
    
      Doc guides:  https://rabbitmq.com/documentation.html
      Support:     https://rabbitmq.com/contact.html
      Tutorials:   https://rabbitmq.com/getstarted.html
      Monitoring:  https://rabbitmq.com/monitoring.html
    
      Logs: <stdout>
    
      Config file(s): /etc/rabbitmq/rabbitmq.conf
    
      Starting broker...2021-09-14 06:52:49.916 [info] <0.273.0> 
     node           : rabbit@498d558c3fd6
     home dir       : /var/lib/rabbitmq
     config file(s) : /etc/rabbitmq/rabbitmq.conf
     cookie hash    : 4FFwJpsh8bXPGt3Kx+ytBA==
     log(s)         : <stdout>
     database dir   : /var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6
  2. 通过诊断命令定位

    root@498d558c3fd6:/# rabbitmq-diagnostics status
    Status of node rabbit@498d558c3fd6 ...
    Runtime
    
    OS PID: 272
    OS: Linux
    Uptime (seconds): 2199
    Is under maintenance?: false
    RabbitMQ version: 3.8.22
    Node name: rabbit@498d558c3fd6
    Erlang configuration: Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]
    Erlang processes: 401 used, 1048576 limit
    Scheduler run queue: 1
    Cluster heartbeat timeout (net_ticktime): 60
    
    Plugins
    
    Enabled plugin file: /etc/rabbitmq/enabled_plugins
    Enabled plugins:
    
     * rabbitmq_prometheus
     * prometheus
     * rabbitmq_management
     * amqp_client
     * rabbitmq_web_dispatch
     * cowboy
     * cowlib
     * rabbitmq_management_agent
    
    Data directory
    
    Node data directory: /var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6
    Raft data directory: /var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6/quorum/rabbit@498d558c3fd6
    
    Config files
    
     * /etc/rabbitmq/rabbitmq.conf
    
    Log file(s)
    
     * <stdout>
    
    Alarms
    
    (none)
    
    Memory
    
    Total memory used: 0.1473 gb
    Calculation strategy: rss
    Memory high watermark setting: 0.4 of available memory, computed to: 1.5293 gb
    
    reserved_unallocated: 0.0688 gb (46.68 %)
    code: 0.0361 gb (24.53 %)
    other_proc: 0.0295 gb (20.01 %)
    other_system: 0.0249 gb (16.89 %)
    other_ets: 0.0033 gb (2.24 %)
    plugins: 0.0015 gb (1.03 %)
    atom: 0.0014 gb (0.97 %)
    binary: 6.0e-4 gb (0.41 %)
    mgmt_db: 4.0e-4 gb (0.26 %)
    metrics: 2.0e-4 gb (0.16 %)
    mnesia: 1.0e-4 gb (0.06 %)
    quorum_ets: 0.0 gb (0.03 %)
    msg_index: 0.0 gb (0.02 %)
    connection_other: 0.0 gb (0.0 %)
    allocated_unused: 0.0 gb (0.0 %)
    connection_channels: 0.0 gb (0.0 %)
    connection_readers: 0.0 gb (0.0 %)
    connection_writers: 0.0 gb (0.0 %)
    queue_procs: 0.0 gb (0.0 %)
    queue_slave_procs: 0.0 gb (0.0 %)
    quorum_queue_procs: 0.0 gb (0.0 %)
    
    File Descriptors
    
    Total: 2, limit: 1048479
    Sockets: 0, limit: 943629
    
    Free Disk Space
    
    Low free disk space watermark: 0.05 gb
    Free disk space: 21.7624 gb
    
    Totals
    
    Connection count: 0
    Queue count: 0
    Virtual host count: 1
    
    Listeners
    
    Interface: [::], port: 15672, protocol: http, purpose: HTTP API
    Interface: [::], port: 15692, protocol: http/prometheus, purpose: Prometheus exporter API over HTTP
    Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
    Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
    root@498d558c3fd6:/# 

如何验证当前生效的配置

  1. rabbitmq-diagnostics environment
    root@498d558c3fd6:/# rabbitmq-diagnostics environment
    Application environment of node rabbit@498d558c3fd6 ...
    [{amqp_client,
         [{prefer_ipv6,false},{ssl_options,[]},{writer_gc_threshold,1000000000}]},
     {asn1,[]},
     {aten,
         [{detection_threshold,0.99},
          {heartbeat_interval,100},
          {poll_interval,5000},
          {scaling_factor,1.5}]},
     {compiler,[]},
     {cowboy,[]},
     {cowlib,[]},
     {credentials_obfuscation,[{enabled,true}]},
     {crypto,[{fips_mode,false},{rand_cache_size,896}]},
     {cuttlefish,[]},
     {gen_batch_server,[]},
     {goldrush,[]},
     {inets,[]},
     {jsx,[]},
     {kernel,
         [{inet_default_connect_options,[{nodelay,true}]},
          {inet_dist_listen_max,25672},
          {inet_dist_listen_min,25672},
          {logger,
              [{handler,default,logger_std_h,
                   #{config => #{type => standard_io},
                     formatter =>
                         {logger_formatter,
                             #{legacy_header => true,single_line => false}}}}]},
          {logger_level,notice},
          {logger_sasl_compatible,false},
          {shell_docs_ansi,auto},
          {shutdown_func,{rabbit_prelaunch,shutdown_func}}]},
     {lager,
         [{async_threshold,20},
          {async_threshold_window,5},
          {colored,false},
          {colors,
              [{debug,"\e[0;38m"},
               {info,"\e[1;37m"},
               {notice,"\e[1;36m"},
               {warning,"\e[1;33m"},
               {error,"\e[1;31m"},
               {critical,"\e[1;35m"},
               {alert,"\e[1;44m"},
               {emergency,"\e[1;41m"}]},
          {crash_log,"log/crash.log"},
          {crash_log_count,5},
          {crash_log_date,"$D0"},
          {crash_log_msg_size,65536},
          {crash_log_rotator,lager_rotator_default},
          {crash_log_size,10485760},
          {error_logger_format_raw,true},
          {error_logger_hwm,5000},
          {error_logger_hwm_original,50},
          {error_logger_redirect,true},
          {extra_sinks,
              [{error_logger_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_channel_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_connection_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_feature_flags_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_federation_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_ldap_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_mirroring_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_prelaunch_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_queue_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_ra_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_shovel_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]},
               {rabbit_log_upgrade_lager_event,
                   [{handlers,[{lager_forwarder_backend,[lager_event,info]}]},
                    {rabbit_handlers,
                        [{lager_forwarder_backend,[lager_event,info]}]}]}]},
          {handlers,
              [{lager_console_backend,
                   [{formatter_config,
                        [date," ",time," ",color,"[",severity,"] ",
                         {pid,[]},
                         " ",message,"\r\n"]},
                    {level,debug}]}]},
          {log_root,"/var/log/rabbitmq"},
          {rabbit_handlers,
              [{lager_console_backend,
                   [{formatter_config,
                        [date," ",time," ",color,"[",severity,"] ",
                         {pid,[]},
                         " ",message,"\r\n"]},
                    {level,debug}]}]}]},
     {mnesia,[{dir,"/var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6"}]},
     {observer_cli,[{plugins,[]},{scheduler_usage,disable}]},
     {os_mon,
         [{start_cpu_sup,false},
          {start_disksup,false},
          {start_memsup,false},
          {start_os_sup,false}]},
     {prometheus,[]},
     {public_key,[]},
     {ra,[{data_dir,"/var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6/quorum"},
          {logger_module,rabbit_log_ra_shim},
          {wal_max_batch_size,4096},
          {wal_max_size_bytes,536870912}]},
     {rabbit,
         [{auth_backends,[rabbit_auth_backend_internal]},
          {auth_mechanisms,['PLAIN','AMQPLAIN']},
          {autocluster,
              [{peer_discovery_backend,rabbit_peer_discovery_classic_config}]},
          {autoheal_state_transition_timeout,60000},
          {background_gc_enabled,false},
          {background_gc_target_interval,60000},
          {backing_queue_module,rabbit_priority_queue},
          {channel_max,2047},
          {channel_operation_timeout,15000},
          {channel_tick_interval,60000},
          {cluster_keepalive_interval,10000},
          {cluster_nodes,{[],disc}},
          {cluster_partition_handling,ignore},
          {collect_statistics,fine},
          {collect_statistics_interval,5000},
          {config_entry_decoder,[{passphrase,undefined}]},
          {connection_max,infinity},
          {consumer_timeout,1800000},
          {credit_flow_default_credit,{400,200}},
          {default_consumer_prefetch,{false,0}},
          {default_permissions,[<<".*">>,<<".*">>,<<".*">>]},
          {default_user,<<"guest">>},
          {default_user_tags,[administrator]},
          {default_vhost,<<"/">>},
          {delegate_count,16},
          {disk_free_limit,50000000},
          {disk_monitor_failure_retries,10},
          {disk_monitor_failure_retry_interval,120000},
          {enabled_plugins_file,"/etc/rabbitmq/enabled_plugins"},
          {feature_flags_file,
              "/var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6-feature_flags"},
          {fhc_read_buffering,false},
          {fhc_write_buffering,true},
          {frame_max,131072},
          {halt_on_upgrade_failure,true},
          {handshake_timeout,10000},
          {heartbeat,60},
          {lager_default_file,tty},
          {lager_log_root,"/var/log/rabbitmq"},
          {lager_upgrade_file,tty},
          {lazy_queue_explicit_gc_run_operation_threshold,1000},
          {log,[{console,[{enabled,true}]}]},
          {loopback_users,[]},
          {max_message_size,134217728},
          {memory_monitor_interval,2500},
          {mirroring_flow_control,true},
          {mirroring_sync_batch_size,4096},
          {mnesia_table_loading_retry_limit,10},
          {mnesia_table_loading_retry_timeout,30000},
          {msg_store_credit_disc_bound,{4000,800}},
          {msg_store_file_size_limit,16777216},
          {msg_store_index_module,rabbit_msg_store_ets_index},
          {msg_store_io_batch_size,4096},
          {msg_store_shutdown_timeout,600000},
          {num_ssl_acceptors,10},
          {num_tcp_acceptors,10},
          {password_hashing_module,rabbit_password_hashing_sha256},
          {plugins_dir,"/opt/rabbitmq/plugins"},
          {plugins_expand_dir,
              "/var/lib/rabbitmq/mnesia/rabbit@498d558c3fd6-plugins-expand"},
          {proxy_protocol,false},
          {queue_explicit_gc_run_operation_threshold,1000},
          {queue_index_embed_msgs_below,4096},
          {queue_index_max_journal_entries,32768},
          {quorum_cluster_size,3},
          {quorum_commands_soft_limit,32},
          {reverse_dns_lookups,false},
          {server_properties,[]},
          {ssl_allow_poodle_attack,false},
          {ssl_apps,[asn1,crypto,public_key,ssl]},
          {ssl_cert_login_from,distinguished_name},
          {ssl_handshake_timeout,5000},
          {ssl_listeners,[]},
          {ssl_options,[]},
          {tcp_listen_options,
              [{backlog,128},
               {nodelay,true},
               {linger,{true,0}},
               {exit_on_close,false}]},
          {tcp_listeners,[5672]},
          {trace_vhosts,[]},
          {track_auth_attempt_source,false},
          {tracking_execution_timeout,15000},
          {vhost_restart_strategy,continue},
          {vm_memory_calculation_strategy,rss},
          {vm_memory_high_watermark,0.4},
          {vm_memory_high_watermark_paging_ratio,0.5},
          {writer_gc_threshold,1000000000}]},
     {rabbit_common,[]},
     {rabbitmq_management,
         [{content_security_policy,
              "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'"},
          {cors_allow_origins,[]},
          {cors_max_age,1800},
          {http_log_dir,none},
          {load_definitions,none},
          {management_db_cache_multiplier,5},
          {process_stats_gc_timeout,300000},
          {stats_event_max_backlog,250},
          {tcp_config,[{port,15672}]}]},
     {rabbitmq_management_agent,
         [{rates_mode,basic},
          {sample_retention_policies,
              [{global,[{605,5},{3660,60},{29400,600},{86400,1800}]},
               {basic,[{605,5},{3600,60}]},
               {detailed,[{605,5}]}]}]},
     {rabbitmq_prelaunch,[]},
     {rabbitmq_prometheus,[{return_per_object_metrics,false}]},
     {rabbitmq_web_dispatch,[]},
     {ranch,[]},
     {recon,[]},
     {sasl,[{errlog_type,error},{sasl_error_logger,tty}]},
     {ssl,[]},
     {stdlib,[]},
     {stdout_formatter,[]},
     {syntax_tools,[]},
     {sysmon_handler,
         [{busy_dist_port,true},
          {busy_port,false},
          {gc_ms_limit,0},
          {heap_word_limit,0},
          {port_limit,100},
          {process_limit,100},
          {schedule_ms_limit,0}]},
     {tools,[{file_util_search_methods,[{[],[]},{"ebin","esrc"},{"ebin","src"}]}]},
     {xmerl,[]}]

     

posted @ 2021-09-14 15:43  MacoPlus  阅读(579)  评论(0编辑  收藏  举报