我正在尝试在 AWS 上的自动缩放组中的 ELB 后面设置 RabbitMQ 集群。虽然手动构建集群有效,从而确认实例具有适当的安全组和角色来相互检测,但我不清楚 auto-discovery plugin 的配置。聚类指南 recommends .我正在使用 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 还是其他地方?有人可以提供配置示例吗?
最佳答案
配置如下:
{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}
]}
]}
}
priv/schema/rabbit.schema在 rabbitmq-server 和 priv/schema/rabbitmq_peer_discovery_aws.schema在 rabbitmq-peer-discovery-aws 插件源中有一些新旧配置格式之间的映射
我建议使用 IAM Instance Profiles为 EC2 实例提供凭据。通过提供的示例,它会自动选择这些。
关于rabbitmq - rabbitmq aws 自动发现插件的正确配置是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48440854/