summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2016-10-25 17:50:02 +0300
committerMichael Klishin <mklishin@pivotal.io>2016-10-25 17:50:02 +0300
commit672d0c156b036047010feda8ba787bbad4c699e9 (patch)
tree8835f6721c894a1f0ee31d89f8ac83b900a32958
parent3ad0b674caaa7a898f525933590acfd4f0d99d3c (diff)
downloadrabbitmq-server-git-672d0c156b036047010feda8ba787bbad4c699e9.tar.gz
Initial DNS backend config schema support; decouple autocluster node type key
Since node type won't vary from backend to backend we should pull it up to `autocluster.node_type`.
-rw-r--r--docs/rabbitmq.conf.example7
-rw-r--r--priv/schema/rabbitmq.schema46
-rw-r--r--test/config_schema_SUITE_data/snippets.config39
3 files changed, 78 insertions, 14 deletions
diff --git a/docs/rabbitmq.conf.example b/docs/rabbitmq.conf.example
index f03145b447..9de81548b6 100644
--- a/docs/rabbitmq.conf.example
+++ b/docs/rabbitmq.conf.example
@@ -312,9 +312,14 @@
# autocluster.classic_config.nodes.node3 = rabbit3@hostname
# autocluster.classic_config.nodes.node4 = rabbit4@hostname
+## DNS-based peer discovery. This backend will list A records
+## of the configured hostname and perform reverse lookups for
+## the addresses returned.
+# autocluster.dns.hostname = "rabbitmq.discovery.mycompany.local"
+
## This node's type can be configured. If you are not sure
## what node type to use, always use 'disc'.
-# autocluster.classic_config.node_type = disc
+# autocluster.node_type = disc
## Interval (in milliseconds) at which we send keepalive messages
## to other cluster members. Note that this is not the same thing
diff --git a/priv/schema/rabbitmq.schema b/priv/schema/rabbitmq.schema
index 687101dd74..1e2fd6473a 100644
--- a/priv/schema/rabbitmq.schema
+++ b/priv/schema/rabbitmq.schema
@@ -757,6 +757,27 @@ end}.
{mapping, "mirroring_sync_batch_size", "rabbit.mirroring_sync_batch_size",
[{datatype, bytesize}, {validators, ["size_less_than_2G"]}]}.
+%% Own node type used by autoclustering.
+%%
+
+{mapping, "autocluster.node_type", "rabbit.autocluster.node_type", [
+ {datatype, {enum, [disc, disk, ram]}}
+]}.
+
+{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
+ end
+end}.
+
+%% Classic config-driven autocluster backend.
+%%
%% 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
@@ -767,11 +788,6 @@ end}.
{mapping, "autocluster.classic_config.nodes.$node", "rabbit.cluster_nodes",
[{datatype, atom}]}.
-{mapping, "autocluster.classic_config.node_type", "rabbit.cluster_nodes", [
- {datatype, {enum, [disc, disk, ram]}},
- {default, disc}
-]}.
-
{translation, "rabbit.cluster_nodes",
fun(Conf) ->
Nodes = [V || {_, V} <- cuttlefish_variable:filter_by_prefix("autocluster.classic_config.nodes", Conf)],
@@ -779,15 +795,29 @@ fun(Conf) ->
case Nodes of
[] -> cuttlefish:unset();
Other ->
- case cuttlefish:conf_get("autocluster.classic_config.node_type", Conf, disc) of
+ case cuttlefish:conf_get("autocluster.node_type", Conf, disc) of
disc -> {Other, disc};
- % Always cast to `disc`
+ %% Always cast to `disc`
disk -> {Other, disc};
ram -> {Other, ram}
end
end
end}.
+%% DNS (A records and reverse lookups)-based peer discovery.
+%%
+
+{mapping, "autocluster.dns.hostname", "rabbit.peer_discovery_dns.hostname",
+ [{datatype, string}]}.
+
+{translation, "rabbit.peer_discovery_dns.hostname",
+fun(Conf) ->
+ case cuttlefish:conf_get("autocluster.dns.hostname", Conf) of
+ undefined -> cuttlefish:unset();
+ Value -> list_to_binary(Value)
+ end
+end}.
+
%% Interval (in milliseconds) at which we send keepalive messages
%% to other cluster members. Note that this is not the same thing
@@ -799,6 +829,8 @@ end}.
{mapping, "cluster_keepalive_interval", "rabbit.cluster_keepalive_interval",
[{datatype, integer}]}.
+%% Queue master locator
+%%
{mapping, "queue_master_locator", "rabbit.queue_master_locator",
[{datatype, string}]}.
diff --git a/test/config_schema_SUITE_data/snippets.config b/test/config_schema_SUITE_data/snippets.config
index 8c4319fa53..114c931622 100644
--- a/test/config_schema_SUITE_data/snippets.config
+++ b/test/config_schema_SUITE_data/snippets.config
@@ -96,22 +96,26 @@ default_permissions.write = .*",
{13,
"autocluster.classic_config.nodes.peer1 = rabbit@hostname1
autocluster.classic_config.nodes.peer2 = rabbit@hostname2
-autocluster.classic_config.node_type = disc",
+autocluster.node_type = disc",
[{rabbit, [
+ {autocluster, [{node_type, disc}]},
{cluster_nodes, {[rabbit@hostname2,rabbit@hostname1], disc}}
]}],[]}
,
{13.1,
"autocluster.classic_config.nodes.peer1 = rabbit@hostname1
autocluster.classic_config.nodes.peer2 = rabbit@hostname2
-autocluster.classic_config.node_type = disk",
+autocluster.node_type = disk",
[{rabbit, [
+ {autocluster, [{node_type, disc}]},
{cluster_nodes, {[rabbit@hostname2,rabbit@hostname1], disc}}
]}],[]}
,
{13.2,
-"autocluster.classic_config.node_type = ram",
-[],[]}
+"autocluster.node_type = ram",
+[{rabbit, [
+ {autocluster, [{node_type,ram}]}
+]}],[]}
,
{14,
"tcp_listen_options.backlog = 128
@@ -713,7 +717,7 @@ web_stomp.ssl.password = changeme",
[{rabbitmq_web_stomp,
[{sockjs_opts, [{sockjs_url, "https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js"}]}]}],
[rabbitmq_web_stomp]},
-{69,
+{69,
"auth_backends.1 = http
rabbitmq_auth_backend_http.user_path = http://some-server/auth/user
rabbitmq_auth_backend_http.vhost_path = http://some-server/auth/vhost
@@ -741,5 +745,28 @@ tcp_listen_options.linger.timeout = 100",
{74,
"tcp_listen_options.linger.timeout = 100",
[{rabbit, [{tcp_listen_options, [{linger, {false, 100}}]}]}],
-[]}
+[]},
+
+{75,
+"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}]}
+]}],[]}
+,
+
+{75.1,
+"autocluster.dns.hostname = 192.168.0.2.xip.io
+autocluster.node_type = disk",
+[{rabbit, [
+ {peer_discovery_dns, [{hostname, <<"192.168.0.2.xip.io">>}]},
+ {autocluster, [{node_type, disc}]}
+]}],[]}
+,
+{75.2,
+"autocluster.node_type = ram",
+[{rabbit, [
+ {autocluster, [{node_type, ram}]}
+]}],[]}
].