【原创】RabbitMQ启动参数具体含义

简介:
     本文详细说明了 rabbitmq 服务程序启动时配置参数的含义。 
?
1
2
[root@Betty mnt] # ps aux|grep rabbit
root      3588  0.3  0.9 133420 37812 ?        Sl   09:35   0:11 /usr/local/lib/erlang/erts-5 .9.2 /bin/beam .smp -W w -K true -A30 -P 1048576 -- -root /usr/local/lib/erlang -progname erl -- -home /root -- -pa /usr/local/sbin/ .. /ebin -noshell -noinput -s rabbit boot -sname rabbit@Betty -boot start_sasl -kernel inet_default_connect_options [{nodelay, true }] -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger { file , "/var/log/rabbitmq/rabbit@Betty.log" } -rabbit sasl_error_logger { file , "/var/log/rabbitmq/rabbit@Betty-sasl.log" } -rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/local/sbin/../plugins" -rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/rabbit@Betty-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@Betty" -noshell -noinput

     我们通常使用 erl <arguments> 命令启动 Erlang 的运行时系统,其中  arguments 就是我们启动时指定的各种参数。其类型如下:

  • +    emulator flag            there are a small number of "-" flags which now actually are emulator flags
  • -    flag    {init flag, user flag}  init process interprets init flags, and stores user flags.    
  • --   plain argument          init process plain argument, -extra causes everything that follows to become plain arguments

可以在 Erlang shell 或者 code 中通过如下调用获取相应的值:

  • init:get_argument/1                -- 获取指定 user flag 或者系统自定义 flag 的值
  • init:get_arguments/0              -- 获取所有 user flag 和系统自定义 flag 的值
  • init:get_plain_arguments/0     -- 获取所有 plain argument 的值

     下面将上面的启动参数进行分解说明:

/usr/local/lib/erlang/erts-5.9.2/bin/beam.smp  

-W w  
?
1
2
3
4
5
==========
+W w | i
Sets the mapping of warning messages for error_logger.
Messages sent to the error logger using one of the warning routines can be mapped either to errors (default), warnings (+W w), or info reports (+W i). The current mapping can be retrieved using error_logger:warning_map /0 . See error_logger(3) for further information.
==========
-K true  
?
1
2
3
4
==========
+K true | false
Enables or disables the kernel poll functionality if the emulator supports it. Default is false (disabled). If the emulator does not support kernel poll, and the +K flag is passed to the emulator, a warning is issued at startup.
==========
-A30  
?
1
2
3
4
==========
+A size
Sets the number of threads in async thread pool, valid range is 0-1024. Default is 0.
==========
-P 1048576  
?
1
2
3
4
5
==========
+P Number
Sets the maximum number of concurrent processes for this system. Number must be in the range 16..134217727.
Default is 32768.
==========
--  
?
1
2
3
4
==========
--(init flag)
Everything following -- up to the next flag (-flag or +flag) is considered plain arguments and can be retrieved using init:get_plain_arguments /0 .
==========

-root /usr/local/lib/erlang  
-progname erl  

--  
-home /root  
--  

-pa /usr/local/sbin/../ebin  
?
1
2
3
4
5
6
7
==========
-pa Dir1 Dir2 ...
Adds the specified directories to the beginning of the code path, similar to code:add_pathsa /1 . See code(3).
As an alternative to -pa, if several directories are to be prepended to the code and the directories have a common parent directory, that parent directory could be specified in the ERL_LIBS environment variable. See code(3).
-pz Dir1 Dir2 ...
Adds the specified directories to the end of the code path, similar to code:add_pathsz /1 . See code(3).
==========
-noshell  
-noinput  
?
1
2
3
4
5
6
==========
-noinput
Ensures that the Erlang runtime system never tries to read any input. Implies -noshell.
-noshell
Starts an Erlang runtime system with no shell. This flag makes it possible to have the Erlang runtime system as a component in a series of UNIX pipes.
==========
-s rabbit boot  
?
1
2
3
4
==========
-s Mod [Func [Arg1, Arg2, ...]](init flag)
Makes init call the specified function . Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as atoms. See init(3).
==========
-sname rabbit  @Betty   -boot start_sasl  
?
1
2
3
4
5
==========
-sname Name
Makes the Erlang runtime system into a distributed node, similar to -name, but the host name portion of the node name Name@Host will be the short name, not fully qualified.
This is sometimes the only way to run distributed Erlang if the DNS (Domain Name System) is not running. There can be no communication between nodes running with the -sname flag and those running with the -name flag, as node names must be unique in distributed Erlang systems.
==========

-kernel inet_default_connect_options [{nodelay,true}]  
-sasl errlog_type error  
-sasl sasl_error_logger false  
-rabbit error_logger {file,"/var/log/rabbitmq/rabbit@Betty.log"}  
-rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit@Betty-sasl.log"}  
-rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins"  
-rabbit plugins_dir "/usr/local/sbin/../plugins"  
-rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/rabbit@Betty-plugins-expand"  
-os_mon start_cpu_sup false  
-os_mon start_disksup false  
-os_mon start_memsup false  
-mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@Betty"  
?
1
2
3
4
5
==========
-Application Par Val
Sets the application configuration parameter Par to the value Val for the application Application, see app(4)
and application(3).
==========

-noshell 
-noinput

注:
上面参数中的 emulator flag 均使用的 - 号作为前缀,其在erts-5.9.2中的说明如下: 

It can be noted that there are a small number of "-" flags which now actually are emulator flags

      上面未进行解释说明的 -root /usr/local/lib/erlang 、-progname erl 和 -home /root 均为 user flag 。这些参数为运行时系统自动定义的。其中

  • root         The installation directory of Erlang/OTP, $ROOT.
  • progname     The name of the program which started Erlang.
  • home         The home directory.
上面多处出现 -- 但其后并未指定任何 plain argument 。 
相关实践学习
RocketMQ一站式入门使用
从源码编译、部署broker、部署namesrv,使用java客户端首发消息等一站式入门RocketMQ。
消息队列 MNS 入门课程
1、消息队列MNS简介 本节课介绍消息队列的MNS的基础概念 2、消息队列MNS特性 本节课介绍消息队列的MNS的主要特性 3、MNS的最佳实践及场景应用 本节课介绍消息队列的MNS的最佳实践及场景应用案例 4、手把手系列:消息队列MNS实操讲 本节课介绍消息队列的MNS的实际操作演示 5、动手实验:基于MNS,0基础轻松构建 Web Client 本节课带您一起基于MNS,0基础轻松构建 Web Client
目录
相关文章
|
5月前
|
消息中间件 Java Maven
消息中间件系列教程(11) -RabbitMQ -案例代码(通配符模式)
消息中间件系列教程(11) -RabbitMQ -案例代码(通配符模式)
38 0
|
9月前
|
消息中间件 存储 前端开发
28个案例问题分析---16---消息队列的作用和意义--RabbitMq
28个案例问题分析---16---消息队列的作用和意义--RabbitMq
82 0
|
消息中间件 缓存 Kafka
彻底搞懂 Kafka 消息大小相关参数设置的规则
Kafka 消息大小的设置还是挺复杂的一件事,而且还分版本,需要注意的参数巨多,而且每个都长得差不多,不但分版本,还需要注意生产端、broker、消费端的设置,而且还要区分 broker 级别还是 topic 级别的设置,而且还需要清楚知道每个配置的含义。 本文通过相关参数的解析说明,再结合实战测试,帮助你快速搞明白这些参数的含义以及规则。
1167 0
彻底搞懂 Kafka 消息大小相关参数设置的规则
|
消息中间件 缓存 Java
RabbitMQ 的第一个程序
RabbitMQ 的第一个程序
96 1
RabbitMQ 的第一个程序
|
消息中间件 Java Spring
RabbitMQ的深入理解和最简单的用途说明
RabbitMQ 在上一家公司已经接触过了, 但是懵懵懂懂的. 不是很清楚. 具体怎么个逻辑.  这次公司打算搭建新的系统. 领导要求研究一下MQ.  经过研究得出的结论是.
1475 0
|
消息中间件 监控
轻松搞定RabbitMQ5:主题机制与RPC调用
轻松搞定RabbitMQ(六)——主题 翻译地址:http://www.rabbitmq.com/tutorials/tutorial-five-java.html 在上一篇博文中,我们进一步改良了日志系统。
|
消息中间件 C# 数据安全/隐私保护
一个C#操作RabbitMQ的完整例子
一、下载RabbitMQ http://www.rabbitmq.com/install-windows.html   二、下载OTP http://www.erlang.org/downloads   三、安装OTP、RabbitMQ 四、配置RabbitMQ 找到bat的目录 执行相关命令    1.
3245 0
|
消息中间件 存储 Java
Apache ActiveMQ实战(1)-基本安装配置与消息类型
ActiveMQ简介 ActiveMQ是一种开源的,实现了JMS1.1规范的,面向消息(MOM)的中间件,为应用程序提供高效的、可扩展的、稳定的和安全的企业级消息通信。
1995 0