refactor: delete UDP multicast clustering strategy

This commit is contained in:
Zaiming (Stone) Shi 2023-12-06 08:36:56 +01:00
parent dfd143eff8
commit d0732aa2a6
4 changed files with 3 additions and 154 deletions

View File

@ -468,7 +468,7 @@ fill_defaults(Conf) ->
Conf1 = emqx_config:fill_defaults(Conf), Conf1 = emqx_config:fill_defaults(Conf),
filter_cluster_conf(Conf1). filter_cluster_conf(Conf1).
-define(ALL_STRATEGY, [<<"manual">>, <<"static">>, <<"dns">>, <<"etcd">>, <<"k8s">>, <<"mcast">>]). -define(ALL_STRATEGY, [<<"manual">>, <<"static">>, <<"dns">>, <<"etcd">>, <<"k8s">>]).
filter_cluster_conf(#{<<"cluster">> := #{<<"discovery_strategy">> := Strategy} = Cluster} = Conf) -> filter_cluster_conf(#{<<"cluster">> := #{<<"discovery_strategy">> := Strategy} = Cluster} = Conf) ->
Cluster1 = maps:without(lists:delete(Strategy, ?ALL_STRATEGY), Cluster), Cluster1 = maps:without(lists:delete(Strategy, ?ALL_STRATEGY), Cluster),

View File

@ -154,7 +154,7 @@ fields("cluster") ->
)}, )},
{"discovery_strategy", {"discovery_strategy",
sc( sc(
hoconsc:enum([manual, static, dns, etcd, k8s, mcast]), hoconsc:enum([manual, static, dns, etcd, k8s]),
#{ #{
default => manual, default => manual,
desc => ?DESC(cluster_discovery_strategy), desc => ?DESC(cluster_discovery_strategy),
@ -208,11 +208,6 @@ fields("cluster") ->
?R_REF(cluster_static), ?R_REF(cluster_static),
#{} #{}
)}, )},
{"mcast",
sc(
?R_REF(cluster_mcast),
#{importance => ?IMPORTANCE_HIDDEN}
)},
{"dns", {"dns",
sc( sc(
?R_REF(cluster_dns), ?R_REF(cluster_dns),
@ -251,81 +246,6 @@ fields(cluster_static) ->
} }
)} )}
]; ];
fields(cluster_mcast) ->
[
{"addr",
sc(
string(),
#{
default => <<"239.192.0.1">>,
desc => ?DESC(cluster_mcast_addr),
'readOnly' => true
}
)},
{"ports",
sc(
hoconsc:array(integer()),
#{
default => [4369, 4370],
'readOnly' => true,
desc => ?DESC(cluster_mcast_ports)
}
)},
{"iface",
sc(
string(),
#{
default => <<"0.0.0.0">>,
desc => ?DESC(cluster_mcast_iface),
'readOnly' => true
}
)},
{"ttl",
sc(
range(0, 255),
#{
default => 255,
desc => ?DESC(cluster_mcast_ttl),
'readOnly' => true
}
)},
{"loop",
sc(
boolean(),
#{
default => true,
desc => ?DESC(cluster_mcast_loop),
'readOnly' => true
}
)},
{"sndbuf",
sc(
emqx_schema:bytesize(),
#{
default => <<"16KB">>,
desc => ?DESC(cluster_mcast_sndbuf),
'readOnly' => true
}
)},
{"recbuf",
sc(
emqx_schema:bytesize(),
#{
default => <<"16KB">>,
desc => ?DESC(cluster_mcast_recbuf),
'readOnly' => true
}
)},
{"buffer",
sc(
emqx_schema:bytesize(),
#{
default => <<"32KB">>,
desc => ?DESC(cluster_mcast_buffer),
'readOnly' => true
}
)}
];
fields(cluster_dns) -> fields(cluster_dns) ->
[ [
{"name", {"name",
@ -1100,8 +1020,6 @@ desc("cluster") ->
?DESC("desc_cluster"); ?DESC("desc_cluster");
desc(cluster_static) -> desc(cluster_static) ->
?DESC("desc_cluster_static"); ?DESC("desc_cluster_static");
desc(cluster_mcast) ->
?DESC("desc_cluster_mcast");
desc(cluster_dns) -> desc(cluster_dns) ->
?DESC("desc_cluster_dns"); ?DESC("desc_cluster_dns");
desc(cluster_etcd) -> desc(cluster_etcd) ->
@ -1423,17 +1341,6 @@ map(Name, Type) -> hoconsc:map(Name, Type).
cluster_options(static, Conf) -> cluster_options(static, Conf) ->
[{seeds, conf_get("cluster.static.seeds", Conf, [])}]; [{seeds, conf_get("cluster.static.seeds", Conf, [])}];
cluster_options(mcast, Conf) ->
{ok, Addr} = inet:parse_address(conf_get("cluster.mcast.addr", Conf)),
{ok, Iface} = inet:parse_address(conf_get("cluster.mcast.iface", Conf)),
Ports = conf_get("cluster.mcast.ports", Conf),
[
{addr, Addr},
{ports, Ports},
{iface, Iface},
{ttl, conf_get("cluster.mcast.ttl", Conf, 1)},
{loop, conf_get("cluster.mcast.loop", Conf, true)}
];
cluster_options(dns, Conf) -> cluster_options(dns, Conf) ->
[ [
{name, conf_get("cluster.dns.name", Conf)}, {name, conf_get("cluster.dns.name", Conf)},

View File

@ -7,12 +7,6 @@ When drop mode is activated or deactivated, a message is printed in the logs."""
common_handler_drop_mode_qlen.label: common_handler_drop_mode_qlen.label:
"""Queue Length before Entering Drop Mode""" """Queue Length before Entering Drop Mode"""
cluster_mcast_addr.desc:
"""Multicast IPv4 address."""
cluster_mcast_addr.label:
"""Cluster Multicast Address"""
desc_cluster_dns.desc: desc_cluster_dns.desc:
"""Service discovery via DNS SRV records.""" """Service discovery via DNS SRV records."""
@ -33,12 +27,6 @@ Note: contents of this file are secret, so it's necessary to set permissions to
rpc_keyfile.label: rpc_keyfile.label:
"""RPC Keyfile""" """RPC Keyfile"""
cluster_mcast_recbuf.desc:
"""Size of the kernel-level buffer for incoming datagrams."""
cluster_mcast_recbuf.label:
"""Cluster Muticast Sendbuf"""
cluster_autoheal.desc: cluster_autoheal.desc:
"""If <code>true</code>, the node will try to heal network partitions automatically.""" """If <code>true</code>, the node will try to heal network partitions automatically."""
@ -208,12 +196,6 @@ Otherwise, the client might opt for IPv4, even if the server is on IPv6."""
rpc_ipv6_only.label: rpc_ipv6_only.label:
"""Use IPv6 Only""" """Use IPv6 Only"""
cluster_mcast_buffer.desc:
"""Size of the user-level buffer."""
cluster_mcast_buffer.label:
"""Cluster Muticast Buffer"""
rpc_authentication_timeout.desc: rpc_authentication_timeout.desc:
"""Timeout for the remote node authentication.""" """Timeout for the remote node authentication."""
@ -226,12 +208,6 @@ cluster_call_retry_interval.desc:
cluster_call_retry_interval.label: cluster_call_retry_interval.label:
"""Cluster Call Retry Interval""" """Cluster Call Retry Interval"""
cluster_mcast_sndbuf.desc:
"""Size of the kernel-level buffer for outgoing datagrams."""
cluster_mcast_sndbuf.label:
"""Cluster Muticast Sendbuf"""
rpc_driver.desc: rpc_driver.desc:
"""Transport protocol used for inter-broker communication""" """Transport protocol used for inter-broker communication"""
@ -405,12 +381,6 @@ rpc_socket_sndbuf.desc:
rpc_socket_sndbuf.label: rpc_socket_sndbuf.label:
"""RPC Socket Sndbuf""" """RPC Socket Sndbuf"""
cluster_mcast_ttl.desc:
"""Time-to-live (TTL) for the outgoing UDP datagrams."""
cluster_mcast_ttl.label:
"""Cluster Multicast TTL"""
log_file_handler_file.desc: log_file_handler_file.desc:
"""Name the log file.""" """Name the log file."""
@ -435,12 +405,6 @@ desc_cluster_k8s.desc:
desc_cluster_k8s.label: desc_cluster_k8s.label:
"""Cluster Kubernetes""" """Cluster Kubernetes"""
desc_cluster_mcast.desc:
"""Service discovery via UDP multicast."""
desc_cluster_mcast.label:
"""Cluster Multicast"""
rpc_cacertfile.desc: rpc_cacertfile.desc:
"""Path to certification authority TLS certificate file used to validate <code>rpc.certfile</code>.<br/> """Path to certification authority TLS certificate file used to validate <code>rpc.certfile</code>.<br/>
Note: certificates of all nodes in the cluster must be signed by the same CA.""" Note: certificates of all nodes in the cluster must be signed by the same CA."""
@ -505,12 +469,6 @@ cluster_etcd_prefix.desc:
cluster_etcd_prefix.label: cluster_etcd_prefix.label:
"""Cluster Etcd Prefix""" """Cluster Etcd Prefix"""
cluster_mcast_iface.desc:
"""Local IP address the node discovery service needs to bind to."""
cluster_mcast_iface.label:
"""Cluster Multicast Interface"""
log_burst_limit_window_time.desc: log_burst_limit_window_time.desc:
"""See <code>max_count</code>.""" """See <code>max_count</code>."""
@ -583,13 +541,6 @@ desc_cluster_call.desc:
desc_cluster_call.label: desc_cluster_call.label:
"""Cluster Call""" """Cluster Call"""
cluster_mcast_ports.desc:
"""List of UDP ports used for service discovery.<br/>
Note: probe messages are broadcast to all the specified ports."""
cluster_mcast_ports.label:
"""Cluster Multicast Ports"""
log_overload_kill_mem_size.desc: log_overload_kill_mem_size.desc:
"""Maximum memory size that the log handler process is allowed to use.""" """Maximum memory size that the log handler process is allowed to use."""
@ -694,12 +645,6 @@ node_crash_dump_file.desc:
node_crash_dump_file.label: node_crash_dump_file.label:
"""Crash Dump File""" """Crash Dump File"""
cluster_mcast_loop.desc:
"""If <code>true</code>, loop UDP datagrams back to the local socket."""
cluster_mcast_loop.label:
"""Cluster Multicast Loop"""
rpc_socket_keepalive_interval.desc: rpc_socket_keepalive_interval.desc:
"""The interval between keepalive messages.""" """The interval between keepalive messages."""
@ -803,9 +748,7 @@ cluster_discovery_strategy.desc:
- static: Configure static nodes list by setting <code>seeds</code> in config file.<br/> - static: Configure static nodes list by setting <code>seeds</code> in config file.<br/>
- dns: Use DNS A record to discover peer nodes.<br/> - dns: Use DNS A record to discover peer nodes.<br/>
- etcd: Use etcd to discover peer nodes.<br/> - etcd: Use etcd to discover peer nodes.<br/>
- k8s: Use Kubernetes API to discover peer pods. - k8s: Use Kubernetes API to discover peer pods."""
- mcast: Deprecated since 5.1, will be removed in 5.2.
This supports discovery via UDP multicast."""
cluster_discovery_strategy.label: cluster_discovery_strategy.label:
"""Cluster Discovery Strategy""" """Cluster Discovery Strategy"""

View File

@ -174,7 +174,6 @@ libcoap
lifecycle lifecycle
localhost localhost
lwm lwm
mcast
mnesia mnesia
mountpoint mountpoint
mqueue mqueue