rabbitmq参数配置

rabbittmq配置修改:

  1. 环境变量设置 如: 节点名称,rabbitmq配置文件地址, 节点内部通讯端口等
  2. 配置文件 如: 端口, ip, 网络,内存等
  3. 运行时参数和策略 在运行时设置

rabbitmqctl environment

输出当前节点上正在运行的rabbitmq、plugins和libraries已应用的有效配置

环境变量配置都是使用RABBITMQ_ 开头, 例如:

NameDefault
RABBITMQ_NODE_IP_ADDRESSr若为空,则表示绑定到0.0.0.0
RABBITMQ_NODE_PORT5672
RABBITMQ_DIST_PORTRABBITMQ_NODE_PORT + 20000
RABBITMQ_NODENAMErabbit@$HOSTNAME
RABBITMQ_CONF_ENV_FILE$RABBITMQ_HOME/etc/rabbitmq/rabbitmq-env.conf RPM安装: /etc/rabbitmq/rabbitmq-env.conf
RABBITMQ_USE_LONGNAME

rabbitmq.config配置文件

配置文件详情可以参考官网

https://www.rabbitmq.com/configure.html
KeyDocumentation
tcp_listeners默认: [5672]
num_tcp_acceptors处理tcp连接的erlang进程数目.默认: 10
handshake_timeout握手超时时间,单位毫秒.默认: 10000
ssl_listenersssl配置.Default: []
num_ssl_acceptors处理ssl连接的erlang进程数目, Default: 1
ssl_optionsssl配置.Default: []
ssl_handshake_timeoutssl握手超时,单位毫秒.Default: 5000
vm_memory_high_watermarkl流量控制的内存使用阈值.Default: 0.4
vm_memory_calculation_strategyn内存使用报告方式, 1. rss 使用操作系统rss内存报告 2. erlang 采用erlang内存报告 默认rss
vm_memory_high_watermark_paging_ratio内存高水位的百分比阈值, 当达到阈值,队列将消息持久化到磁盘,以降低内存使用, 与vm_memory_high_watermark一起使用
total_memory_available_override_valueDefault: undefined (not used)使重写可用内存总量成为可能,而不是使用特定于os的方法从环境中推断可用内存总量。只有当节点可用RAM的实际最大数量与节点推断出的值不匹配时,才应该使用这种方法,例如,由于容器化或节点不知道的类似约束。该值可以设置为整数字节数,也可以设置为信息单元(e.g “8GB”)。例如,当该值设置为4GB时,节点将认为它运行在一台具有4GB RAM的机器上。
disk_free_limitDisk free space limit of the partition on which RabbitMQ is storing data. When available disk space falls below this limit, flow control is triggered. The value may be set relative to the total amount of RAM (e.g. {mem_relative, 1.0}). The value may also be set to an integer number of bytes. Or, alternatively, in information units (e.g “50MB”). By default free disk space must exceed 50MB. See the Disk Alarms documentation.Default: 50000000
log_levelsControls the granularity(粒度) of logging. The value is a list of log event category and log level pairs.The level can be one of ‘none’ (no events are logged), ‘error’ (only errors are logged), ‘warning’ (only errors and warning are logged), ‘info’ (errors, warnings and informational messages are logged), or ‘debug’ (errors, warnings, informational messages and debugging messages are logged).At present there are four categories defined. Other, currently uncategorised, events are always logged.The categories are:channel - for all events relating to AMQP channelsconnection - for all events relating to network connectionsfederation - for all events relating to federationmirroring - for all events relating to mirrored queuesDefault: [{connection, info}]
frame_max与客户端协商的允许最大帧大小,单位B, Default: 131072
channel_max与客户端协商的允许最大信道channel个数, 0表示没有限制 .Default: 0
channel_operation_timeout信道运行超时时间, 单位毫秒.Default: 15000
heartbeat服务器与客服端连接的心跳延迟, 单位秒, 设置为0 则表示禁用心跳.Default: 60
default_vhost默认vhost.Default: <<"/">>
default_userDefault: <<“guest”>>
default_passDefault: <<“guest”>>
default_user_tagsDefault: [administrator]
default_permissions.Default: [<<".">>, <<".">>, <<".*">>]
loopback_users设置只能本地访问broker的用户列表Default: [<<“guest”>>]
cluster_nodes配置集群, 雷子只能是disc或者是ram.Default: {[], disc}, 默认为disc磁盘类型节点
server_propertiesList of key-value pairs to announce to clients on connection.Default: []
collect_statisticsStatistics collection mode. Primarily relevant for the management plugin. Options are:none (do not emit statistics events)coarse (emit per-queue / per-channel / per-connection statistics)fine (also emit per-message statistics)You probably don’t want to change this yourself.Default: none
collect_statistics_intervalStatistics collection interval in milliseconds. Primarily relevant for the management plugin.Default: 5000
management_db_cache_multiplierAffects the amount of time the management plugin will cache expensive management queries such as queue listings. The cache will multiply the elapsed time of the last query by this value and cache the result for this amount of time.Default: 5
auth_mechanisms向客户端提供的SASL身份验证机制。Default: [‘PLAIN’, ‘AMQPLAIN’]
auth_backendsList of authentication and authorisation backends to use.*要使用的身份验证和授权后端列表。*Other databases than rabbit_auth_backend_internal are available through plugins. *rabbit_auth_backend_internal之外的其他数据库可以通过插件获得。*Default: [rabbit_auth_backend_internal]
reverse_dns_lookups设置为true,使RabbitMQ对客户端连接执行反向DNS查询,并通过rabbitmqctl和管理插件显示该信息。Default: false
delegate_countNumber of delegate processes to use for intra-cluster communication. On a machine which has a very large number of cores and is also part of a cluster, you may wish to increase this value.Default: 16
trace_vhostsUsed internally by the tracer. You shouldn’t change this.Default: []
tcp_listen_optionsDefault socket options. You probably don’t want to change this.Default:[{backlog, 128}, {nodelay, true}, {linger, {true,0}}, {exit_on_close, false}]
hipe_compile开启erlang的即时编译器,启动会增加延时,当性能能够提升
cluster_partition_handling处理网络分区的方式.Default: ignore
cluster_keepalive_intervalHow frequently nodes should send keepalive messages to other nodes (in milliseconds). Note that this is not the same thing as net_ticktime; missed keepalive messages will not cause nodes to be considered down.Default: 10000
queue_index_embed_msgs_below消息的大小小于该值则直接嵌入到队列索引中, 单位B, Default: 4096
msg_store_index_moduleImplementation module for queue indexing. You are advised to read the persister tuning documentation before changing this.Default: rabbit_msg_store_ets_index
backing_queue_moduleImplementation module for queue contents. You probably don’t want to change this.Default: rabbit_variable_queue
msg_store_file_size_limitTunable value for the persister. You almost certainly should not change this.Default: 16777216
msg_store_credit_disc_bound此值仅在将消息持久化到message store时生效。如果消息嵌入到队列索引中,则修改此设置没有效果,因为写入队列索引时不使用credit_flow。Default: {4000, 800}
mnesia_table_loading_retry_limitNumber of times to retry while waiting for Mnesia tables in a cluster to become available.Default: 10
mnesia_table_loading_retry_timeoutTime to wait per retry for Mnesia tables in a cluster to become available.Default: 30000
queue_index_max_ journal_entriesTunable value for the persister. You almost certainly should not change this.Default: 65536
queue_master_locator队列定位策略, 即创建队列以什么策略判断在哪个broker节点, Default: <<“client-local”>>
mirroring_sync_batch_size要在队列镜像之间同步的消息的批处理大小,请参见批处理同步,Default: 4096
lazy_queue_explicit_ gc_run_operation_threshold惰性队列进行内存回收动作的阈值, Default: 1000
queue_explicit_ gc_run_operation_threshold使用正常队列时进行内存回收动作的阈值,低的值会降低性能, 高的值性能高,但是内存消耗更多.Default: 1000

加密配置:

加密值必须在Erlang内部 encrypted 元组:{encrypted, …}

例如:

[
  {rabbit, [
      {default_user, <<"guest">>},
      {default_pass,
        {encrypted,
         <<"cPAymwqmMnbPXXRVqVzpxJdrS8mHEKuo2V+3vt1u/fymexD9oztQ2G/oJ4PAaSb2c5N/hRJ2aqP/X0VAfx8xOQ==">>
        }
      },
      {config_entry_decoder, [
             {passphrase, <<"mypassphrase">>}
         ]}
    ]}
].

优化网络配置:

网络优化是为量提高吞吐量, 比如禁用nagle算法,增大tcp缓冲区大小, 在linux中,默认会自动调整tcp大小,通常在80kb - 120kb 可以使用rabbitmq.tcp_listen_options 调整配置

rabbitmq需要系统确保有足够的文件句柄数来支持客户端与broker的交互

rabbitmq parameter 运行时参数

有vhost parameter 还有 global parameter 所对应的的值都是json类型的

rabbitmqctl set_parameter  set_parameter [-p <vhostpath>] <component_name> <name> <value>
rabbitmqctl list_parameters  [-p <vhostpath>]
rabbitmqctl clear_parameter clear_parameter [-p <vhostpath>] <component_name> <key>

设置policy

 rabbitmqctl  set_policy [-p <vhostpath>] [--priority <priority>] [--apply-to <apply-to>] 
 rabbitmqctl  clear_policy [-p <vhostpath>] <name>
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值