配置文件路径

对于rabbitmq而言,常用的配置文件有mnesia【Erlang的分布式数据库】相关配置,config配置文件,log日志 相关的配置。

方式1,通过rabbitmqctl控制台:
用administrator角色的账号登录,Overview–》点击Nodes 进入即可:
RabbitMQ 使用问题总结RabbitMQ 使用问题总结

方式2,进入rabbitmq安装目录下的 sbin文件夹

# 查看路径
ps -ef |grep rabbitmq

#  查看配置信息:
vim /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.15/sbin/rabbitmq-defaults

-----

CONFIG_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq
LOG_BASE=${SYS_PREFIX}/var/log/rabbitmq
MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia
ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins

PLUGINS_DIR="${RABBITMQ_HOME}/plugins"

系统会自动的给这些文件加上后缀名。

如何修改config_file的路径?

方式一:
直接在rabbit的安装路径的sbin下的文件rabbitmq-defaults中 修改 CONFIG_FILE的值

方式二:
找到 rabbit的安装路径的sbin下的文件rabbitmq-defaults中 ,所有环境变量的配置文件 的 文件路径 CONF_ENV_FILE,【当然这个路径值也可以改变】,到对应的路径 找到对应的文件(如果没有,新建即可),然后 在里边新增内容:CONFIG_FILE=${SYS_PREFIX}/etc/xxxxxConfig, 这个时候 新增的这个配置路径 将会覆盖 rabbitmq-defaults中配置的 CONFIG_FILE的值。然后 再在 对应的路径放置 对应的文件即可。

页面出现:/etc/rabbitmq/rabbitmq.config(not found)

解决如下:
1、没有对应的配置文件

find / -name "rabbitmq.config.example"  找到相应的模板配置文件进行拷贝
cp /usr/share/doc/rabbitmq-server-3.6.15/rabbitmq.config.example /etc/rabbitmq/
mv /etc/rabbitmq/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config
service rabbitmq-server restart

2、配置文件编写错误

修改配置文件:/etc/rabbitmq/rabbitmq-env.conf,/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.15/sbin/rabbitmq-defaults 

# 注意此配置行没有后缀.conf ,系统会自动的给这些文件加上后缀名。
CONFIG_FILE=/etc/rabbitmq/rabbitmq

“error in config file \”/etc/rabbitmq/rabbitmq.config\” (none): no ending <dot> found”

解决方法:
出现这个问题.肯定是/etc/rabbitmq/rabbitmq.config这个配置文件写的有问题.主要是格式符号.比如:

%% -*- mode: erlang -*-
%% ----------------------------------------------------------------------------
%% RabbitMQ Sample Configuration File.
%%
%% Related doc guide: http://www.rabbitmq.com/configure.html. See
%% http://rabbitmq.com/documentation.html for documentation ToC.
%% ----------------------------------------------------------------------------
[
 {rabbit,
  [%%
   {tcp_listeners, [5672]},
    {ssl_listeners, [5671]},
    {ssl_options, [{cacertfile,           "/etc/rabbitmq/ssl/cacert.pem"},
                   {certfile,             "/etc/rabbitmq/ssl/rabbitmq-server.cert.pem"},
                   {keyfile,              "/etc/rabbitmq/ssl/rabbitmq-server.key.pem"},
                   {verify,               verify_peer},
                   {fail_if_no_peer_cert, true}]},
    {vm_memory_high_watermark, 0.7}
  ]},
 %% ----------------------------------------------------------------------------
 %% Advanced Erlang Networking/Clustering Options.
 %%
 %% Related doc guide: http://www.rabbitmq.com/clustering.html
 %% ----------------------------------------------------------------------------
 {kernel,
  [%% Sets the net_kernel tick time.
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ Management Plugin
 %%
 %% Related doc guide: http://www.rabbitmq.com/management.html
 %% ----------------------------------------------------------------------------
 {rabbitmq_management,
  [%% Preload schema definitions from a previously exported definitions file. See
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ Shovel Plugin
 %%
 %% Related doc guide: http://www.rabbitmq.com/shovel.html
 %% ----------------------------------------------------------------------------
 {rabbitmq_shovel,
  [{shovels,
    [%% A named shovel worker.
    ]}
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ STOMP Plugin
 %%
 %% Related doc guide: http://www.rabbitmq.com/stomp.html
 %% ----------------------------------------------------------------------------
 {rabbitmq_stomp,
  [%% Network Configuration - the format is generally the same as for the broker
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ MQTT Plugin
 %%
 %% Related doc guide: https://github.com/rabbitmq/rabbitmq-mqtt/blob/stable/README.md
 %%
 %% ----------------------------------------------------------------------------
 {rabbitmq_mqtt,
  [%% Set the default user name and password. Will be used as the default login
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ AMQP 1.0 Support
 %%
 %% Related doc guide: https://github.com/rabbitmq/rabbitmq-amqp1.0/blob/stable/README.md
 %%
 %% ----------------------------------------------------------------------------
 {rabbitmq_amqp1_0,
  [%% Connections that are not authenticated with SASL will connect as this
  ]},
 %% ----------------------------------------------------------------------------
 %% RabbitMQ LDAP Plugin
 %%
 %% Related doc guide: http://www.rabbitmq.com/ldap.html.
 %%
 %% ----------------------------------------------------------------------------
 {rabbitmq_auth_backend_ldap,
  [%%
  ]}
].

#最后面的句号一定要有

rabbitmq config的配置相关的官方文档:http://www.rabbitmq.com/configure.html
官方给出的一个 示例配置:https://github.com/rabbitmq/rabbitmq-server/blob/v3.8.x/deps/rabbit/docs/rabbitmq.conf.example
拷贝以上实例文档 到 对应的rabbitmq的安装目录下的文件:/etc/rabbitmq , 取名配置文件名称为 rabbitmq.config,重启rabbit,那么当前文件 就为 当前rabbit所使用。