在 AWS 上部署时,我遇到了 rabbitmq 的一个奇怪问题。
当我启动主服务器并将从服务器连接到它时,一切都很顺利,集群中有两个服务器。当我将第二个从服务器添加到主服务器时,它只是挂在 join_cluster 上,并将无限期等待而不会抛出任何错误。一旦我停止第一个从服务器,第二个从服务器就会立即加入。我找不到有这个问题的人或任何限制从服务器数量的设置。
这是我在主机文件中添加一个指向主服务器的 IP 条目后在两个从服务器上运行的步骤
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster rabbit@master
rabbitmqctl start_app
这是我的 rabbitmq.config 文件。
[
{rabbit,
[
{tcp_listeners, [{{ rabbitmq_amqp_port }}]},
%% SSL listeners are configured in the same fashion as TCP listeners,
%% including the option to control the choice of interface.
%%
%% {ssl_listeners, [5671]},
%% Maximum time for AMQP 0-8/0-9/0-9-1 handshake (after socket connection
%% and SSL handshake), in milliseconds.
%%
%% {handshake_timeout, 10000},
{log_levels, [{connection, info}]},
{loopback_users, [<<"{{ rabbitmq_loopback_user }}">>]},
%% Configuring SSL.
%% See http://www.rabbitmq.com/ssl.html for full documentation.
%%
%% {ssl_options, [{cacertfile, "/path/to/testca/cacert.pem"},
%% {certfile, "/path/to/server/cert.pem"},
%% {keyfile, "/path/to/server/key.pem"},
%% {verify, verify_peer},
%% {fail_if_no_peer_cert, false}]},
{default_vhost, <<"{{ rabbitmq_default_vhost }}">>},
{default_user, <<"{{ rabbitmq_default_user }}">>},
{default_pass, <<"{{ rabbitmq_default_pass }}">>},
{default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
{default_user_tags, [{{ rabbitmq_default_user_tags }}]},
{channel_max, 128},
%% Customising Socket Options.
%%
%% See (http://www.erlang.org/doc/man/inet.html#setopts-2) for
%% further documentation.
%%
%% {tcp_listen_options, [binary,
%% {packet, raw},
%% {reuseaddr, true},
%% {backlog, 128},
%% {nodelay, true},
%% {exit_on_close, false}]},
{vm_memory_high_watermark, {{ rabbitmq_high_watermark }} },
{vm_memory_high_watermark_paging_ratio, {{ rabbitmq_high_watermark_paging }} },
%% Set disk free limit (in bytes). Once free disk space reaches this
%% lower bound, a disk alarm will be set - see the documentation
%% listed above for more details.
%%
%% {disk_free_limit, 50000000},
{disk_free_limit, {mem_relative, {{rabbitmq_disk_free_limit}} }}
%% Make clustering happen *automatically* at startup - only applied
%% to nodes that have just been reset or started for the first time.
%% See http://www.rabbitmq.com/clustering.html#auto-config for
%% further details.
%%
%% {cluster_nodes, {['[email protected]'], disc}},
]}
].
完整文章可在 rabbitmq 邮件列表上查看https://groups.google.com/forum/#!topic/rabbitmq-users/Mzb2EhFUD0w