Merge pull request #13250 from thalesmg/ds-singleton-m-20240613
feat: enforce singleton discovery strategy when using DS `builtin_local` backend
This commit is contained in:
commit
f5eb3e7471
|
@ -28,7 +28,7 @@
|
|||
{gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}},
|
||||
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.2"}}},
|
||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}},
|
||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.4"}}},
|
||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.42.2"}}},
|
||||
{emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.3"}}},
|
||||
|
|
|
@ -1954,10 +1954,6 @@ zones_field_schema() ->
|
|||
}
|
||||
).
|
||||
|
||||
desc("persistent_session_store") ->
|
||||
"Settings for message persistence.";
|
||||
desc("persistent_session_builtin") ->
|
||||
"Settings for the built-in storage engine of persistent messages.";
|
||||
desc("persistent_table_mria_opts") ->
|
||||
"Tuning options for the mria table.";
|
||||
desc("stats") ->
|
||||
|
|
|
@ -134,10 +134,27 @@ roots() ->
|
|||
lists:flatmap(fun roots/1, common_apps()).
|
||||
|
||||
validations() ->
|
||||
[{check_node_name_and_discovery_strategy, fun validate_cluster_strategy/1}] ++
|
||||
[
|
||||
{check_node_name_and_discovery_strategy, fun validate_cluster_strategy/1},
|
||||
{validate_durable_sessions_strategy, fun validate_durable_sessions_strategy/1}
|
||||
] ++
|
||||
hocon_schema:validations(emqx_schema) ++
|
||||
lists:flatmap(fun hocon_schema:validations/1, common_apps()).
|
||||
|
||||
validate_durable_sessions_strategy(Conf) ->
|
||||
DSEnabled = hocon_maps:get("durable_sessions.enable", Conf),
|
||||
DiscoveryStrategy = hocon_maps:get("cluster.discovery_strategy", Conf),
|
||||
DSBackend = hocon_maps:get("durable_storage.messages.backend", Conf),
|
||||
case {DSEnabled, DSBackend} of
|
||||
{true, builtin_local} when DiscoveryStrategy =/= singleton ->
|
||||
{error, <<
|
||||
"cluster discovery strategy must be 'singleton' when"
|
||||
" durable storage backend is 'builtin_local'"
|
||||
>>};
|
||||
_ ->
|
||||
ok
|
||||
end.
|
||||
|
||||
common_apps() ->
|
||||
Edition = emqx_release:edition(),
|
||||
lists:filtermap(
|
||||
|
@ -166,7 +183,7 @@ fields("cluster") ->
|
|||
)},
|
||||
{"discovery_strategy",
|
||||
sc(
|
||||
hoconsc:enum([manual, static, dns, etcd, k8s]),
|
||||
hoconsc:enum([manual, static, singleton, dns, etcd, k8s]),
|
||||
#{
|
||||
default => manual,
|
||||
desc => ?DESC(cluster_discovery_strategy),
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Added a new `cluster.discovery_strategy` value: `singleton`. By choosing this option, there will be effectively no clustering, and the node will reject connection attempts to and from other nodes.
|
2
mix.exs
2
mix.exs
|
@ -55,7 +55,7 @@ defmodule EMQXUmbrella.MixProject do
|
|||
{:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true},
|
||||
{:esockd, github: "emqx/esockd", tag: "5.11.2", override: true},
|
||||
{:rocksdb, github: "emqx/erlang-rocksdb", tag: "1.8.0-emqx-5", override: true},
|
||||
{:ekka, github: "emqx/ekka", tag: "0.19.3", override: true},
|
||||
{:ekka, github: "emqx/ekka", tag: "0.19.4", override: true},
|
||||
{:gen_rpc, github: "emqx/gen_rpc", tag: "3.3.1", override: true},
|
||||
{:grpc, github: "emqx/grpc-erl", tag: "0.6.12", override: true},
|
||||
{:minirest, github: "emqx/minirest", tag: "1.4.1", override: true},
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}},
|
||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.11.2"}}},
|
||||
{rocksdb, {git, "https://github.com/emqx/erlang-rocksdb", {tag, "1.8.0-emqx-5"}}},
|
||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.3"}}},
|
||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.19.4"}}},
|
||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "3.3.1"}}},
|
||||
{grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.12"}}},
|
||||
{minirest, {git, "https://github.com/emqx/minirest", {tag, "1.4.1"}}},
|
||||
|
|
Loading…
Reference in New Issue