Merge configurations of ekka library
This commit is contained in:
parent
96777a4da8
commit
041b9100ed
39
etc/emq.conf
39
etc/emq.conf
|
@ -8,50 +8,63 @@
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
|
|
||||||
## Cluster name
|
## Cluster name
|
||||||
cluster.name = emqcluster
|
cluster.name = emqcl
|
||||||
|
|
||||||
## Cluster discovery strategy: manual | static | mcast | dns | etcd
|
## Cluster discovery strategy: manual | static | mcast | dns | etcd | k8s
|
||||||
cluster.discovery = mcast
|
cluster.discovery = etcd
|
||||||
|
|
||||||
## Cluster Autoheal: on | off
|
## Cluster Autoheal: on | off
|
||||||
cluster.autoheal = off
|
cluster.autoheal = on
|
||||||
|
|
||||||
## Clean down node of the cluster
|
## Clean down node of the cluster
|
||||||
cluster.clean_down = 1h
|
cluster.autoclean = 5m
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Cluster with static node list
|
## Cluster with static node list
|
||||||
|
|
||||||
## cluster.static.seeds = emq1@127.0.0.1,emq@127.0.0.1
|
## cluster.static.seeds = ekka1@127.0.0.1,ekka2@127.0.0.1
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Cluster with multicast
|
## Cluster with multicast
|
||||||
|
|
||||||
cluster.mcast.addr = 239.192.0.1
|
cluster.mcast.addr = 239.192.0.1
|
||||||
|
|
||||||
cluster.mcast.ports = 4369,4370,4371
|
cluster.mcast.ports = 4369,4370
|
||||||
|
|
||||||
cluster.mcast.iface = 0.0.0.0
|
cluster.mcast.iface = 0.0.0.0
|
||||||
|
|
||||||
cluster.mcast.ttl = 1
|
cluster.mcast.ttl = 255
|
||||||
|
|
||||||
cluster.mcast.loop = on
|
cluster.mcast.loop = on
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Cluster with DNS
|
## Cluster with DNS
|
||||||
|
|
||||||
## cluster.dns.name = localhost
|
cluster.dns.name = localhost
|
||||||
|
|
||||||
## cluster.dns.app = emqx
|
cluster.dns.app = emqx
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Cluster with Etcd
|
## Cluster with Etcd
|
||||||
|
|
||||||
## cluster.etcd.addr = http://127.0.0.1:2367
|
cluster.etcd.server = http://127.0.0.1:2379
|
||||||
|
|
||||||
## cluster.etcd.prefix = ekkacluster
|
cluster.etcd.prefix = emqcluster
|
||||||
|
|
||||||
## cluster.etcd.node_ttl = 1h
|
cluster.etcd.node_ttl = 1m
|
||||||
|
|
||||||
|
##--------------------------------------------------------------------
|
||||||
|
## Cluster with k8s
|
||||||
|
|
||||||
|
cluster.k8s.apiserver = http://10.110.111.204:8080
|
||||||
|
|
||||||
|
cluster.k8s.service_name = emq
|
||||||
|
|
||||||
|
## Address Type: ip | dns
|
||||||
|
cluster.k8s.address_type = ip
|
||||||
|
|
||||||
|
## The Erlang application name
|
||||||
|
cluster.k8s.app_name = emq
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
##--------------------------------------------------------------------
|
||||||
## Node Args
|
## Node Args
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
%% @doc Cluster name
|
%% @doc Cluster name
|
||||||
{mapping, "cluster.name", "ekka.cluster_name", [
|
{mapping, "cluster.name", "ekka.cluster_name", [
|
||||||
{default, emqcluster},
|
{default, ekka},
|
||||||
{datatype, atom}
|
{datatype, atom}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -17,16 +17,15 @@
|
||||||
{datatype, atom}
|
{datatype, atom}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
%% @doc Clean down node from the cluster
|
||||||
|
{mapping, "cluster.autoclean", "ekka.cluster_autoclean", [
|
||||||
|
{datatype, {duration, ms}}
|
||||||
|
]}.
|
||||||
|
|
||||||
%% @doc Cluster autoheal
|
%% @doc Cluster autoheal
|
||||||
{mapping, "cluster.autoheal", "ekka.cluster_autoheal", [
|
{mapping, "cluster.autoheal", "ekka.cluster_autoheal", [
|
||||||
{datatype, flag},
|
{datatype, flag},
|
||||||
{default, on}
|
{default, off}
|
||||||
]}.
|
|
||||||
|
|
||||||
%% @doc Clean down node from the cluster
|
|
||||||
{mapping, "cluster.clean_down", "ekka.cluster_clean_down", [
|
|
||||||
{datatype, {duration, ms}},
|
|
||||||
{default, "1h"}
|
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -81,7 +80,6 @@
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Cluster with DNS
|
%% Cluster with DNS
|
||||||
|
|
||||||
{mapping, "cluster.dns.name", "ekka.cluster_discovery", [
|
{mapping, "cluster.dns.name", "ekka.cluster_discovery", [
|
||||||
{datatype, string}
|
{datatype, string}
|
||||||
]}.
|
]}.
|
||||||
|
@ -93,7 +91,7 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Cluster with etcd
|
%% Cluster with etcd
|
||||||
|
|
||||||
{mapping, "cluster.etcd.addr", "ekka.cluster_discovery", [
|
{mapping, "cluster.etcd.server", "ekka.cluster_discovery", [
|
||||||
{datatype, string}
|
{datatype, string}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -106,6 +104,25 @@
|
||||||
{default, "1m"}
|
{default, "1m"}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Cluster with K8s
|
||||||
|
|
||||||
|
{mapping, "cluster.k8s.apiserver", "ekka.cluster_discovery", [
|
||||||
|
{datatype, string}
|
||||||
|
]}.
|
||||||
|
|
||||||
|
{mapping, "cluster.k8s.service_name", "ekka.cluster_discovery", [
|
||||||
|
{datatype, string}
|
||||||
|
]}.
|
||||||
|
|
||||||
|
{mapping, "cluster.k8s.address_type", "ekka.cluster_discovery", [
|
||||||
|
{datatype, {enum, [ip, dns]}}
|
||||||
|
]}.
|
||||||
|
|
||||||
|
{mapping, "cluster.k8s.app_name", "ekka.cluster_discovery", [
|
||||||
|
{datatype, string}
|
||||||
|
]}.
|
||||||
|
|
||||||
{translation, "ekka.cluster_discovery", fun(Conf) ->
|
{translation, "ekka.cluster_discovery", fun(Conf) ->
|
||||||
Strategy = cuttlefish:conf_get("cluster.discovery", Conf),
|
Strategy = cuttlefish:conf_get("cluster.discovery", Conf),
|
||||||
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
|
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
|
||||||
|
@ -127,9 +144,14 @@
|
||||||
[{name, cuttlefish:conf_get("cluster.dns.name", Conf)},
|
[{name, cuttlefish:conf_get("cluster.dns.name", Conf)},
|
||||||
{app, cuttlefish:conf_get("cluster.dns.app", Conf)}];
|
{app, cuttlefish:conf_get("cluster.dns.app", Conf)}];
|
||||||
(etcd) ->
|
(etcd) ->
|
||||||
[{addr, string:tokens(cuttlefish:conf_get("cluster.etcd.addr", Conf), ",")},
|
[{server, string:tokens(cuttlefish:conf_get("cluster.etcd.server", Conf), ",")},
|
||||||
{prefix, cuttlefish:conf_get("cluster.etcd.prefix", Conf, "emq")},
|
{prefix, cuttlefish:conf_get("cluster.etcd.prefix", Conf, "emq")},
|
||||||
{node_ttl, cuttlefish:conf_get("cluster.etcd.node_ttl", Conf, 60)}];
|
{node_ttl, cuttlefish:conf_get("cluster.etcd.node_ttl", Conf, 60)}];
|
||||||
|
(k8s) ->
|
||||||
|
[{apiserver, cuttlefish:conf_get("cluster.k8s.apiserver", Conf)},
|
||||||
|
{service_name, cuttlefish:conf_get("cluster.k8s.service_name", Conf)},
|
||||||
|
{address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)},
|
||||||
|
{app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}];
|
||||||
(manual) ->
|
(manual) ->
|
||||||
[ ]
|
[ ]
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue