RabbitMQ日志和Mnesia在环境变量中的位置没有反映?

时间:2016-06-13 14:02:28

标签: rabbitmq rabbitmqctl

我想将Rabbitmq MNESIA目录更改为/disk文件夹而不是默认/var/lib。我使用

/usr/lib/rabbitmq/bin的{​​{1}}进行了更改
rabbitmq-env

重新启动后
RABBITMQ_MNESIA_BASE=/disk/rabbitmq/
RABBITMQ_LOG_BASE=/disk/rabbitmq/log/

但是当我检查状态为

service rabbitmq-server restart
Restarting rabbitmq-server (via systemctl):                [  OK  ]

删除所有更改后,它工作正常。但我希望MNESIA目录为/ disk。我也重新启动了实例。

3 个答案:

答案 0 :(得分:1)

请尝试按照以下步骤操作:

  1. /etc/init.d/rabbitmq-server stop
  2. nano /etc/rabbitmq/rabbitmq-env.conf并添加:

    RABBITMQ_MNESIA_BASE = /磁盘/ RabbitMQ的
    RABBITMQ_LOG_BASE = /磁盘/ RabbitMQ的/日志

  3. chown rabbitmq:rabbitmq /disk/(and all subdirs)

  4. /etc/init.d/rabbitmq-server start

  5. service rabbitmq-server status

  6. 刚试试我的debian:

    root@bae18650cea4:/# service rabbitmq-server status
    Status of node rabbit@bae18650cea4 ...
    [{pid,15240},
     {running_applications,[{rabbit,"RabbitMQ","3.6.2"},
                            {mnesia,"MNESIA  CXC 138 12","4.13.3"},
                            {os_mon,"CPO  CXC 138 46","2.4"},
                            {rabbit_common,[],"3.6.2"},
                            {xmerl,"XML parser","1.3.10"},
                            {ranch,"Socket acceptor pool for TCP protocols.",
                                   "1.2.1"},
                            {sasl,"SASL  CXC 138 11","2.7"},
                            {stdlib,"ERTS  CXC 138 10","2.8"},
                            {kernel,"ERTS  CXC 138 10","4.2"}]},
     {os,{unix,linux}},
     {erlang_version,"Erlang/OTP 18 [erts-7.3] [source] [64-bit] [async-threads:64] [kernel-poll:true]\n"},
     {memory,[{total,139371632},
              {connection_readers,0},
              {connection_writers,0},
              {connection_channels,0},
              {connection_other,0},
              {queue_procs,2592},
              {queue_slave_procs,0},
              {plugins,0},
              {other_proc,18525024},
              {mnesia,58264},
              {mgmt_db,0},
              {msg_index,41880},
              {other_ets,920384},
              {binary,19128},
              {code,19777571},
              {atom,752537},
              {other_system,99274252}]},
     {alarms,[]},
     {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
     {vm_memory_high_watermark,0.4},
     {vm_memory_limit,839966720},
     {disk_free_limit,50000000},
     {disk_free,17685676032},
     {file_descriptors,[{total_limit,1048476},
                        {total_used,2},
                        {sockets_limit,943626},
                        {sockets_used,0}]},
     {processes,[{limit,1048576},{used,137}]},
     {run_queue,0},
     {uptime,399},
     {kernel,{net_ticktime,60}}]
    root@bae18650cea4:/#
    

答案 1 :(得分:1)

而不是这些env变量

RABBITMQ_MNESIA_BASE=/disk/rabbitmq/
RABBITMQ_LOG_BASE=/disk/rabbitmq/log/

尝试

MNESIA_BASE=/disk/rabbitmq/
LOG_BASE=/disk/rabbitmq/log/

在我停止并重新启动后,这至少对我有用。

答案 2 :(得分:0)

我强烈建议安装凳子和setroubleshoot-server,并在适当时使用selinux实施完整的安全解决方案。

请参阅https://www.systutorials.com/docs/linux/man/8-rabbitmq_selinux/

用一些ansible-love-example:

- name: Enabling Selinux by default
  selinux:
    policy: targeted
    state: enforcing

- name: selinux | allow selinux rabbitmq_t
  selinux_permissive:
    name: rabbitmq_t
    permissive: true

- name: Run selinux restore context on /etc
  shell: "restorecon -Rv /etc/"

- name: rabbitmq | Fix the SELINUX fcontenxt
  sefcontext:
    target: '/var/lib/rabbitmq/(.*)?'
    setype: rabbitmq_var_lib_t
    state: present
  notify:
    - reset permissions
    - restart rabbitmq-server

- name: Allow RabbitMQ Selinux TCP to listen on
  seport:
    ports: 5672,15672
    proto: tcp
    setype: rabbitmq_port_t
    state: present