fix(mria): Reserve replicant role for EE only
This commit is contained in:
parent
39b8cb1789
commit
9da744c423
|
@ -194,18 +194,6 @@ fields("cluster") ->
|
||||||
'readOnly' => true
|
'readOnly' => true
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"core_nodes",
|
|
||||||
sc(
|
|
||||||
node_array(),
|
|
||||||
#{
|
|
||||||
%% This config is nerver needed (since 5.0.0)
|
|
||||||
importance => ?IMPORTANCE_HIDDEN,
|
|
||||||
mapping => "mria.core_nodes",
|
|
||||||
default => [],
|
|
||||||
'readOnly' => true,
|
|
||||||
desc => ?DESC(db_core_nodes)
|
|
||||||
}
|
|
||||||
)},
|
|
||||||
{"autoclean",
|
{"autoclean",
|
||||||
sc(
|
sc(
|
||||||
emqx_schema:duration(),
|
emqx_schema:duration(),
|
||||||
|
@ -600,7 +588,7 @@ fields("node") ->
|
||||||
)},
|
)},
|
||||||
{"role",
|
{"role",
|
||||||
sc(
|
sc(
|
||||||
hoconsc:enum([core, replicant]),
|
hoconsc:enum([core] ++ emqx_schema_hooks:injection_point('node.role')),
|
||||||
#{
|
#{
|
||||||
mapping => "mria.node_role",
|
mapping => "mria.node_role",
|
||||||
default => core,
|
default => core,
|
||||||
|
|
|
@ -22,12 +22,18 @@ schemas() ->
|
||||||
schemas(emqx_release:edition()).
|
schemas(emqx_release:edition()).
|
||||||
|
|
||||||
schemas(Edition) ->
|
schemas(Edition) ->
|
||||||
auth_ext(Edition) ++
|
mria(Edition) ++
|
||||||
|
auth_ext(Edition) ++
|
||||||
cluster_linking(Edition) ++
|
cluster_linking(Edition) ++
|
||||||
authn(Edition) ++
|
authn(Edition) ++
|
||||||
authz() ++
|
authz() ++
|
||||||
customized(Edition).
|
customized(Edition).
|
||||||
|
|
||||||
|
mria(ce) ->
|
||||||
|
[];
|
||||||
|
mria(ee) ->
|
||||||
|
[emqx_enterprise_schema].
|
||||||
|
|
||||||
auth_ext(ce) ->
|
auth_ext(ce) ->
|
||||||
[];
|
[];
|
||||||
auth_ext(ee) ->
|
auth_ext(ee) ->
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
name = emqxcl
|
name = emqxcl
|
||||||
discovery_strategy = static
|
discovery_strategy = static
|
||||||
static.seeds = ~p
|
static.seeds = ~p
|
||||||
core_nodes = ~p
|
|
||||||
}
|
}
|
||||||
").
|
").
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ array_nodes_test() ->
|
||||||
ExpectNodes = ['emqx1@127.0.0.1', 'emqx2@127.0.0.1'],
|
ExpectNodes = ['emqx1@127.0.0.1', 'emqx2@127.0.0.1'],
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Nodes) ->
|
fun(Nodes) ->
|
||||||
ConfFile = to_bin(?BASE_CONF, [Nodes, Nodes]),
|
ConfFile = to_bin(?BASE_CONF, [Nodes]),
|
||||||
{ok, Conf} = hocon:binary(ConfFile, #{format => richmap}),
|
{ok, Conf} = hocon:binary(ConfFile, #{format => richmap}),
|
||||||
ConfList = hocon_tconf:generate(emqx_conf_schema, Conf),
|
ConfList = hocon_tconf:generate(emqx_conf_schema, Conf),
|
||||||
VMArgs = proplists:get_value(vm_args, ConfList),
|
VMArgs = proplists:get_value(vm_args, ConfList),
|
||||||
|
@ -57,11 +56,6 @@ array_nodes_test() ->
|
||||||
{static, [{seeds, ExpectNodes}]},
|
{static, [{seeds, ExpectNodes}]},
|
||||||
ClusterDiscovery,
|
ClusterDiscovery,
|
||||||
Nodes
|
Nodes
|
||||||
),
|
|
||||||
?assertEqual(
|
|
||||||
ExpectNodes,
|
|
||||||
proplists:get_value(core_nodes, proplists:get_value(mria, ConfList)),
|
|
||||||
Nodes
|
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
[["emqx1@127.0.0.1", "emqx2@127.0.0.1"], "emqx1@127.0.0.1, emqx2@127.0.0.1"]
|
[["emqx1@127.0.0.1", "emqx2@127.0.0.1"], "emqx1@127.0.0.1, emqx2@127.0.0.1"]
|
||||||
|
@ -158,7 +152,7 @@ outdated_log_test() ->
|
||||||
|
|
||||||
validate_log(Conf) ->
|
validate_log(Conf) ->
|
||||||
ensure_acl_conf(),
|
ensure_acl_conf(),
|
||||||
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]),
|
||||||
Conf0 = <<BaseConf/binary, (list_to_binary(Conf))/binary>>,
|
Conf0 = <<BaseConf/binary, (list_to_binary(Conf))/binary>>,
|
||||||
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
||||||
ConfList = hocon_tconf:generate(emqx_conf_schema, ConfMap0),
|
ConfList = hocon_tconf:generate(emqx_conf_schema, ConfMap0),
|
||||||
|
@ -214,7 +208,7 @@ validate_log(Conf) ->
|
||||||
|
|
||||||
file_log_infinity_rotation_size_test_() ->
|
file_log_infinity_rotation_size_test_() ->
|
||||||
ensure_acl_conf(),
|
ensure_acl_conf(),
|
||||||
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]),
|
||||||
Gen = fun(#{count := Count, size := Size}) ->
|
Gen = fun(#{count := Count, size := Size}) ->
|
||||||
Conf0 = to_bin(?FILE_LOG_BASE_CONF, [Count, Size]),
|
Conf0 = to_bin(?FILE_LOG_BASE_CONF, [Count, Size]),
|
||||||
Conf1 = [BaseConf, Conf0],
|
Conf1 = [BaseConf, Conf0],
|
||||||
|
@ -292,7 +286,7 @@ log_rotation_count_limit_test() ->
|
||||||
rotation_size = \"1024MB\"
|
rotation_size = \"1024MB\"
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]),
|
||||||
lists:foreach(fun({Conf, Count}) ->
|
lists:foreach(fun({Conf, Count}) ->
|
||||||
Conf0 = <<BaseConf/binary, Conf/binary>>,
|
Conf0 = <<BaseConf/binary, Conf/binary>>,
|
||||||
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
{ok, ConfMap0} = hocon:binary(Conf0, #{format => richmap}),
|
||||||
|
@ -352,7 +346,7 @@ log_rotation_count_limit_test() ->
|
||||||
|
|
||||||
authn_validations_test() ->
|
authn_validations_test() ->
|
||||||
ensure_acl_conf(),
|
ensure_acl_conf(),
|
||||||
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]),
|
||||||
|
|
||||||
OKHttps = to_bin(?BASE_AUTHN_ARRAY, [post, true, <<"https://127.0.0.1:8080">>]),
|
OKHttps = to_bin(?BASE_AUTHN_ARRAY, [post, true, <<"https://127.0.0.1:8080">>]),
|
||||||
Conf0 = <<BaseConf/binary, OKHttps/binary>>,
|
Conf0 = <<BaseConf/binary, OKHttps/binary>>,
|
||||||
|
@ -410,7 +404,7 @@ authn_validations_test() ->
|
||||||
|
|
||||||
listeners_test() ->
|
listeners_test() ->
|
||||||
ensure_acl_conf(),
|
ensure_acl_conf(),
|
||||||
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1", "emqx1@127.0.0.1"]),
|
BaseConf = to_bin(?BASE_CONF, ["emqx1@127.0.0.1"]),
|
||||||
|
|
||||||
Conf = <<BaseConf/binary, ?LISTENERS>>,
|
Conf = <<BaseConf/binary, ?LISTENERS>>,
|
||||||
{ok, ConfMap0} = hocon:binary(Conf, #{format => richmap}),
|
{ok, ConfMap0} = hocon:binary(Conf, #{format => richmap}),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_enterprise, [
|
{application, emqx_enterprise, [
|
||||||
{description, "EMQX Enterprise Edition"},
|
{description, "EMQX Enterprise Edition"},
|
||||||
{vsn, "0.2.2"},
|
{vsn, "0.2.3"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [
|
{applications, [
|
||||||
kernel,
|
kernel,
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
-module(emqx_enterprise_schema).
|
-module(emqx_enterprise_schema).
|
||||||
|
|
||||||
-behaviour(hocon_schema).
|
-behaviour(hocon_schema).
|
||||||
|
-behaviour(emqx_schema_hooks).
|
||||||
|
|
||||||
-include_lib("typerefl/include/types.hrl").
|
-include_lib("typerefl/include/types.hrl").
|
||||||
-include_lib("hocon/include/hoconsc.hrl").
|
-include_lib("hocon/include/hoconsc.hrl").
|
||||||
|
|
||||||
-export([namespace/0, roots/0, fields/1, translations/0, translation/1, desc/1, validations/0]).
|
-export([namespace/0, roots/0, fields/1, translations/0, translation/1, desc/1, validations/0]).
|
||||||
-export([upgrade_raw_conf/1]).
|
-export([upgrade_raw_conf/1]).
|
||||||
|
-export([injected_fields/0]).
|
||||||
|
|
||||||
-define(EE_SCHEMA_MODULES, [
|
-define(EE_SCHEMA_MODULES, [
|
||||||
emqx_license_schema,
|
emqx_license_schema,
|
||||||
|
@ -127,6 +129,11 @@ desc(Name) ->
|
||||||
validations() ->
|
validations() ->
|
||||||
emqx_conf_schema:validations() ++ emqx_license_schema:validations().
|
emqx_conf_schema:validations() ++ emqx_license_schema:validations().
|
||||||
|
|
||||||
|
injected_fields() ->
|
||||||
|
#{
|
||||||
|
'node.role' => [replicant]
|
||||||
|
}.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% helpers
|
%% helpers
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
- Core-replicant feature has been removed from the Open-Source Edition.
|
||||||
|
Starting from release 5.8, all nodes running Open-Source Edition will assume Core role.
|
||||||
|
This change doesn't affect Enterprise Edition users.
|
||||||
|
|
||||||
|
- Obsolete and unused `cluster.core_nodes` configuration parameter has been removed.
|
Loading…
Reference in New Issue