rabbitmq提供三种方式来定制化server
1、environment variables:定义端口、文件路径、服务名称等,可以使用shell和rabbitmq-env.conf定义;
2、configuration file:定义权限、集群、插件等,可以使用rabbitmq.config配置;
3、runtime parameters :运行时参数,如集群设置等;
大多数设置使用第一、二中设置;
config file location
verify configuration(how to find config file location)
the active configuration file can be verified by inspecting rabbitmq log file,it will show up in the log file at the top.
Customize Rabbitmq Environment(unix)
You can creat/edit rabbitmq-env.conf to define enviroment variables. Its location is configurable using the RABBITMQ_CONF_EVN_FILE environment variable.
You can use the standard variable names but drop the RABBITMQ_ prefix in rabbitmq-env.conf.
RabbitMQ Environment Variables
RabbitMQ environment variable names have the prefix RABBITMQ_ . A typical variable called RABBTIMQ_variable_name is set as follows:
a shell environment variable called RABBITMQ_variable_name is used if this is defined;
otherwise, a variable called variable_name is used if this is set in the rabbitmq-env.conf;
otherwise, a system-specified default value is used.
name | default | description |
---|---|---|
RABBITMQ_NODE_PORT | 5672 | |
RABBITMQ_DIST_PORT | RABBITMQ_NODE_PORT+20000 | Port used for inter-node and CLI tool communition |
RABBITMQ_NODENAME | UNIX:rabbit@$HOSTNAME | the node name must be unique per erlang-node-and-machine |
RABBITMQ_CONF_ENV_FILE | UNIX:$RABBITMQ_HOME/etc/rabbitmq/rabbitmq-env.conf | Port used for inter-node and CLI tool communition |
RABBITMQ_CONFIG_FILE | /etc/rabbitmq/rabbitmq | the rabbitmq.config file location,erlang 在运行时会自动添加.config后缀到这个变量值后面 |
Configuration File
该配置文件运行自定义rabbitmq的server,erlang,plugins,文件格式是一个标准的erlang配置文件格式,rabbitmq server源文件有一个配置文件实例,名称为:rabbitmq.config.example
name | default | description |
tcp_listener | [5672] | List of ports which to listen for AMQP connections,Can contain integers or tuples. |
num_tcp_acceptors | 10 | The number of erlang process that will accept connetions for the tcp listeners. |
channel_max | 0 | Maximum permissible number of channels to negotiate clients,setting to 0 means unlimited. |
heartbeat | 60 | Value representing the heartbeat delay,in seconds. |
default_vhost | / | Virtual host to create when RabbitMQ create a new database. |
default_user | guest | |
default_pass | guest | |
default_permissions | [<<".*">>, <<".*">>, <<".*">>] | Permissions to assign to the default user when creating it. |
loopback_users | [<<"guest">>] | List of users which are only permitted to connect the broker via a loopback interface. |
queue_master_locator | client-local | queue master location strategy. Avaliable strategies are: min-masters client-local random |