rabbitmq aws autodiscovery插件的正确配置是什么

时间:2018-01-25 10:38:59

标签: rabbitmq

我正在尝试在AWS上的自动缩放组中在ELB后面建立一个RabbitMQ群集。虽然手动构建群集可以正常工作,从而确认实例具有相互检测的适当安全组和角色,但我不清楚群集指南auto-discovery pluginrecommends配置。我使用的是RabbitMQ 3.7.2,插件安装正确。

$ rabbitmqctl status
Status of node rabbit@ip-172-xxx ...
[{pid,4904},
 {running_applications,
     [{rabbitmq_peer_discovery_aws,
          "AWS-based RabbitMQ peer discovery backend","3.7.2"},
      {rabbitmq_peer_discovery_common,
          "Modules shared by various peer discovery backends","3.7.2"},
      {rabbit,"RabbitMQ","3.7.2"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.2"},
      {rabbitmq_aws,
          "A minimalistic AWS API interface used by rabbitmq-autocluster (3.6.x) and other RabbitMQ plugins",
          "3.7.2"},
      {os_mon,"CPO  CXC 138 46","2.4.3"},
      {mnesia,"MNESIA  CXC 138 12","4.15.1"},
      {lager,"Erlang logging framework","3.5.1"},
      {ranch_proxy_protocol,"Ranch Proxy Protocol Transport","1.4.4"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.4.0"},
      {ssl,"Erlang/OTP SSL application","8.2.1"},
      {public_key,"Public key infrastructure","1.5"},
      {asn1,"The Erlang ASN1 compiler version 5.0.3","5.0.3"},
      {crypto,"CRYPTO","4.1"},
      {xmerl,"XML parser","1.3.15"},
      {inets,"INETS  CXC 138 49","6.4.2"},
      {jsx,"a streaming, evented json parsing toolkit","2.8.2"},
      {recon,"Diagnostic tools for production use","2.3.2"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.1.2"},
      {syntax_tools,"Syntax tools","2.1.3"},
      {sasl,"SASL  CXC 138 11","3.1"},
      {stdlib,"ERTS  CXC 138 10","3.4.2"},
      {kernel,"ERTS  CXC 138 10","5.4"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64] [hipe] [kernel-poll:true]\n"},
 {memory,
     [{connection_readers,14208},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,17536},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,25608},
      {other_proc,26377728},
      {metrics,184432},
      {mgmt_db,0},
      {mnesia,79832},
      {other_ets,1938864},
      {binary,1129008},
      {msg_index,29360},
      {code,25069173},
      {atom,1041593},
      {other_system,9184858},
      {allocated_unused,15000984},
      {reserved_unallocated,0},
      {strategy,rss},
      {total,[{erlang,65092200},{rss,76500992},{allocated,80093184}]}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,415571968},
 {disk_free_limit,50000000},
 {disk_free,6836322304},
 {file_descriptors,
     [{total_limit,924},{total_used,4},{sockets_limit,829},{sockets_used,2}]},
 {processes,[{limit,1048576},{used,216}]},
 {run_queue,0},
 {uptime,2707},
 {kernel,{net_ticktime,60}}]

我的问题与文档中的这些字段有关:

cluster_formation.peer_discovery_backend = rabbit_peer_discovery_aws
cluster_formation.aws.region = us-east-1
cluster_formation.aws.access_key_id = ANIDEXAMPLE
cluster_formation.aws.secret_key = WjalrxuTnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY
cluster_formation.aws.use_autoscaling_group = true

这些字段应该添加到哪个格式?它应该在/etc/rabbitmq/rabbitmq.config还是其他地方?有人可以提供配置示例吗?

1 个答案:

答案 0 :(得分:0)

配置如下:

{rabbit, [
    {cluster_formation, [
        {peer_discovery_backend, rabbit_peer_discovery_aws},
        {peer_discovery_aws, [
            {aws_ec2_region, "us-east-1"},
            {aws_autoscaling, true}
        ]}, 
        {node_cleanup, [
            {cleanup_only_log_warning, false}
        ]}
    ]}
}
Rabbitmq-server中的

priv/schema/rabbit.schema和rabbitmq-peer-discovery-aws插件中的priv/schema/rabbitmq_peer_discovery_aws.schema在新旧配置格式之间都有一些映射

我建议使用IAM Instance Profiles为EC2实例提供凭据。提供示例后,它将自动选择这些示例。