rabbitmq 上的 failed_to_parse_configuration_file

rabbitmq 上的 failed_to_parse_configuration_file

所以我只是想在 rabbitmq 上将默认用户名密码从 guest 更改为其他,但对我来说没有任何效果...这是我的 rabbitmq.conf

[
  {rabbit,
    [
      {default_vhost,       <<"/">>},
      {default_user,        <<"itsme">>},
      {default_pass,        <<"ok">>}
    ]
  }
].

和我的docker-compose:

  rabbitmq:
    image: rabbitmq:3-management-alpine
    container_name: rabbitmq
    hostname: rabbitmq
    restart: always
    # Also tried env_file and environment variables
    # env_file:
    #     - ./docs/server/stack/dev/configs/rabbitmq/.env
    # environment:
    #   RABBITMQ_DEFAULT_USER: itsme
    #   RABBITMQ_DEFAULT_PASS: ok
    ports:
      - 5672:5672
      - 15672:15672
    volumes:
      - ./configs/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
    networks:
      - rabbitmq_network

我收到的错误:

    BOOT FAILED
    
    ===========
    
    Error during startup: {error,failed_to_parse_configuration_file}
    
    Application rabbitmq_prelaunch exited with reason: {{shutdown,{failed_to_start_child,prelaunch,failed_to_parse_configuration_file}},{rabbit_prelaunch_app,start,[normal,[]]}}

{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,failed_to_parse_configuration_file}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}

2022-01-03 11:50:58.446386+00:00 [erro] <0.130.0> Error parsing configuration:

2022-01-03 11:50:58.464588+00:00 [erro] <0.130.0>   - Syntax error in /etc/rabbitmq/rabbitmq.conf after line 1 column 1, parsing incomplete

2022-01-03 11:50:58.464617+00:00 [erro] <0.130.0> Are these files using the Cuttlefish format?

我也尝试将其作为配置文件来执行:

default_user = itsme
default_pass = ok
stomp.default_user = itsme
stomp.default_pass = ok
mqtt.default_user = itsme
mqtt.default_pass = ok
amqp1_0.default_user = itsme

和错误:

{rabbit_prelaunch_app,start,[normal,[]]}}

{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,failed_to_read_advanced_configuration_file}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}

2022-01-03 12:20:01.457976+00:00 [erro] <0.130.0> Failed to load advanced configuration file "/etc/rabbitmq/rabbitmq.config": 2: syntax error before: default_pass

答案1

对我来说,问题在于该文件以“ .config”后缀命名。“ .config”用于高级配置。

将其修改为“ .conf”解决了我的问题。

参考:https://www.rabbitmq.com/configure.html#config-file

相关内容