summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--priv/schema/rabbitmq.schema32
-rw-r--r--test/config_schema_SUITE_data/snippets.config48
2 files changed, 48 insertions, 32 deletions
diff --git a/priv/schema/rabbitmq.schema b/priv/schema/rabbitmq.schema
index 1e2fd6473a..6ab04f0dac 100644
--- a/priv/schema/rabbitmq.schema
+++ b/priv/schema/rabbitmq.schema
@@ -757,6 +757,13 @@ end}.
{mapping, "mirroring_sync_batch_size", "rabbit.mirroring_sync_batch_size",
[{datatype, bytesize}, {validators, ["size_less_than_2G"]}]}.
+%% Peer discovery backend used by autoclustering.
+%%
+
+{mapping, "autocluster.peer_discovery_backend", "rabbit.autocluster.peer_discovery_backend", [
+ {datatype, atom}
+]}.
+
%% Own node type used by autoclustering.
%%
@@ -766,13 +773,18 @@ end}.
{translation, "rabbit.autocluster.node_type",
fun(Conf) ->
- case cuttlefish:conf_get("autocluster.node_type", Conf) of
- undefined ->cuttlefish:unset();
- disc -> disc;
- %% Always cast to `disc`
- disk -> disc;
- ram -> ram;
- _Other -> disc
+ %% if peer discovery backend isn't configured, don't generate
+ %% node type
+ case cuttlefish:conf_get("autocluster.peer_discovery_backend", Conf, undefined) of
+ undefined -> cuttlefish:unset();
+ _Backend ->
+ case cuttlefish:conf_get("autocluster.node_type", Conf) of
+ disc -> disc;
+ %% always cast to `disc`
+ disk -> disc;
+ ram -> ram;
+ _Other -> disc
+ end
end
end}.
@@ -807,12 +819,12 @@ end}.
%% DNS (A records and reverse lookups)-based peer discovery.
%%
-{mapping, "autocluster.dns.hostname", "rabbit.peer_discovery_dns.hostname",
+{mapping, "autocluster.dns.hostname", "rabbit.autocluster.peer_discovery_dns.hostname",
[{datatype, string}]}.
-{translation, "rabbit.peer_discovery_dns.hostname",
+{translation, "rabbit.autocluster.peer_discovery_dns.hostname",
fun(Conf) ->
- case cuttlefish:conf_get("autocluster.dns.hostname", Conf) of
+ case cuttlefish:conf_get("autocluster.dns.hostname", Conf, undefined) of
undefined -> cuttlefish:unset();
Value -> list_to_binary(Value)
end
diff --git a/test/config_schema_SUITE_data/snippets.config b/test/config_schema_SUITE_data/snippets.config
index 114c931622..a64b6e06c9 100644
--- a/test/config_schema_SUITE_data/snippets.config
+++ b/test/config_schema_SUITE_data/snippets.config
@@ -94,28 +94,30 @@ default_permissions.write = .*",
{default_permissions, [<<".*">>, <<".*">>, <<".*">>]}]}],[]}
,
{13,
-"autocluster.classic_config.nodes.peer1 = rabbit@hostname1
+"autocluster.peer_discovery_backend = rabbit_peer_discovery_classic_config
+autocluster.classic_config.nodes.peer1 = rabbit@hostname1
autocluster.classic_config.nodes.peer2 = rabbit@hostname2
autocluster.node_type = disc",
[{rabbit, [
- {autocluster, [{node_type, disc}]},
+ {autocluster, [{peer_discovery_backend, rabbit_peer_discovery_classic_config},
+ {node_type, disc}]},
{cluster_nodes, {[rabbit@hostname2,rabbit@hostname1], disc}}
]}],[]}
,
{13.1,
-"autocluster.classic_config.nodes.peer1 = rabbit@hostname1
+"autocluster.peer_discovery_backend = rabbit_peer_discovery_classic_config
+autocluster.classic_config.nodes.peer1 = rabbit@hostname1
autocluster.classic_config.nodes.peer2 = rabbit@hostname2
autocluster.node_type = disk",
[{rabbit, [
- {autocluster, [{node_type, disc}]},
+ {autocluster, [{peer_discovery_backend, rabbit_peer_discovery_classic_config},
+ {node_type, disc}]},
{cluster_nodes, {[rabbit@hostname2,rabbit@hostname1], disc}}
]}],[]}
,
{13.2,
"autocluster.node_type = ram",
-[{rabbit, [
- {autocluster, [{node_type,ram}]}
-]}],[]}
+[],[]}
,
{14,
"tcp_listen_options.backlog = 128
@@ -746,27 +748,29 @@ tcp_listen_options.linger.timeout = 100",
"tcp_listen_options.linger.timeout = 100",
[{rabbit, [{tcp_listen_options, [{linger, {false, 100}}]}]}],
[]},
-
{75,
-"autocluster.dns.hostname = 192.168.0.2.xip.io
+"
+autocluster.peer_discovery_backend = rabbit_peer_discovery_dns
+autocluster.dns.hostname = 192.168.0.2.xip.io
autocluster.node_type = disc",
[{rabbit, [
- {peer_discovery_dns, [{hostname, <<"192.168.0.2.xip.io">>}]},
- {autocluster, [{node_type, disc}]}
+ {autocluster, [{peer_discovery_dns, [{hostname, <<"192.168.0.2.xip.io">>}]},
+ {peer_discovery_backend, rabbit_peer_discovery_dns},
+ {node_type, disc}]}
]}],[]}
,
-
-{75.1,
-"autocluster.dns.hostname = 192.168.0.2.xip.io
-autocluster.node_type = disk",
+{76,
+"autocluster.peer_discovery_backend = rabbit_peer_discovery_classic_config
+autocluster.node_type = disc",
[{rabbit, [
- {peer_discovery_dns, [{hostname, <<"192.168.0.2.xip.io">>}]},
- {autocluster, [{node_type, disc}]}
-]}],[]}
-,
-{75.2,
-"autocluster.node_type = ram",
+ {autocluster, [{peer_discovery_backend, rabbit_peer_discovery_classic_config},
+ {node_type, disc}]}
+]}],[]},
+{76.1,
+"autocluster.peer_discovery_backend = rabbit_peer_discovery_classic_config
+autocluster.node_type = ram",
[{rabbit, [
- {autocluster, [{node_type, ram}]}
+ {autocluster, [{peer_discovery_backend, rabbit_peer_discovery_classic_config},
+ {node_type, ram}]}
]}],[]}
].