RabbitMQ環境變量設置

RabbitMQ的配置可以由三種方式進行定製。

環境變量

配置文件

運行時參數和策略

(1)環境變量:

定義端口、配置文件的位置(rabbitmq.config)和名值對(可以通過shell,也可以通過rabbitmq-env.conf)

rabbitmq-env.conf文件的位置是固定的${RabbitMQ-PREFIX}/etc/rabbitmq/rabbitmq-env.conf,不可改變。

rabbitmq-env.conf定義的變量會覆蓋rabbitmq啓動腳本的內置參數。

環境變量中的rabbitmq參數和rabbitmq-env.conf是一致的。(環境變量中的參數都有RABBITMQ_前綴)

#example rabbitmq-env.conf file entries
#Rename the node
NODENAME=bunny@myhost
#Config file location and new filename bunnies.config
CONFIG_FILE=/etc/rabbitmq/testdir/bunnies
rabbitmq的變量優先級:

shell環境變量->rabbitmq-env.conf->內置變量值

Name Default Description
RABBITMQ_NODE_IP_ADDRESS the empty string - meaning bind to all network interfaces. Change this if you only want to bind to one network interface.
RABBITMQ_NODE_PORT 5672  
RABBITMQ_NODENAME
  • Unix*: rabbit@$HOSTNAME
  • Windows:rabbit@%COMPUTERNAME%
The node name should be unique per erlang-node-and-machine combination. To run multiple nodes, see theclustering guide.
RABBITMQ_SERVICENAME Windows Service: RabbitMQ The name of the installed service. This will appear in services.msc.
RABBITMQ_CONSOLE_LOG Windows Service: Set this variable to new or reuse to redirect console output from the server to a file named%RABBITMQ_SERVICENAME%.debug in the default RABBITMQ_BASE directory.
  • If not set, console output from the server will be discarded (default).
  • new A new file will be created each time the service starts.
  • reuse The file will be overwritten each time the service starts.
RABBITMQ_CTL_ERL_ARGS None Parameters for the erl command used when invoking rabbitmqctl. This should be overridden for debugging purposes only.
RABBITMQ_SERVER_ERL_ARGS
  • Unix*: "+K true +A30 +P 1048576 -kernel inet_default_connect_options [{nodelay,true}]"
  • Windows: None
Standard parameters for the erlcommand used when invoking the RabbitMQ Server. This should be overridden for debugging purposes only.
RABBITMQ_SERVER_START_ARGS None Extra parameters for the erl command used when invoking the RabbitMQ Server. This will not overrideRABBITMQ_SERVER_ERL_ARGS.

rabbitmq-env.conf還定義了一些列環境變量指出RabbitMQ的數據庫文件、日誌文件、插件、配置文件的地址。

Name Description
RABBITMQ_BASE This base directory contains sub-directories for the RabbitMQ server's database and log files. Alternatively, set RABBITMQ_MNESIA_BASEand RABBITMQ_LOG_BASE individually.
RABBITMQ_CONFIG_FILE The name of the configuration file, without the .config extension. If the configuration file is present it is used by the server to configure RabbitMQ components. This file is also used to auto-configure RabbitMQ clusters.
RABBITMQ_MNESIA_BASE This base directory contains sub-directories for the RabbitMQ server's Mnesia database files, one for each node, unlessRABBITMQ_MNESIA_DIR is set explicitly. (In addition to Mnesia files this location also contains message storage and index files as well as schema and cluster details.)
RABBITMQ_MNESIA_DIR The directory where this RabbitMQ node's Mnesia database files are placed. (In addition to Mnesia files this location also contains message storage and index files as well as schema and cluster details.)
RABBITMQ_LOG_BASE This base directory contains the RabbitMQ server's log files, unlessRABBITMQ_LOGS or RABBITMQ_SASL_LOGS are set explicitly.
RABBITMQ_LOGS The path of the RabbitMQ server's Erlang log file. This variable cannot be overridden on Windows.
RABBITMQ_SASL_LOGS The path of the RabbitMQ server's Erlang SASL (System Application Support Libraries) log file. This variable cannot be overridden on Windows.
RABBITMQ_PLUGINS_DIR The directory in which the plugins are found.
RABBITMQ_PLUGINS_EXPAND_DIR Working directory used to expand enabled plugins when starting the server.
RABBITMQ_ENABLED_PLUGINS_FILE This file records explicitly enabled plugins.
RABBITMQ_PID_FILE File in which the process id is placed for use by rabbitmqctl wait.

Name Location
RABBITMQ_BASE (Not used)
RABBITMQ_CONFIG_FILE $RABBITMQ_HOME/etc/rabbitmq/rabbitmq
RABBITMQ_MNESIA_BASE $RABBITMQ_HOME/var/lib/rabbitmq/mnesia
RABBITMQ_MNESIA_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME
RABBITMQ_LOG_BASE $RABBITMQ_HOME/var/log/rabbitmq
RABBITMQ_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME.log
RABBITMQ_SASL_LOGS $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME-sasl.log
RABBITMQ_PLUGINS_DIR $RABBITMQ_HOME/plugins
RABBITMQ_PLUGINS_EXPAND_DIR $RABBITMQ_MNESIA_BASE/$RABBITMQ_NODENAME-plugins-expand
RABBITMQ_ENABLED_PLUGINS_FILE $RABBITMQ_HOME/etc/rabbitmq/enabled_plugins
RABBITMQ_PID_FILE $RABBITMQ_MNESIA_DIR.pid


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章