# Auto Clustering
# Node Discovery and Autocluster
Erlang
EMQX's clustering is based on the Ekka library. [Ekka] (https://github.com/emqx/ekka) is a cluster management library developed for Erlang/OTP applications, supporting Erlang Node Auto-Discovery, Autocluster, and Network partition autoheal and autoclean.
EMQX supports multiple autocluster strategies:
Strategy | Description |
---|---|
manual | Create a cluster through manual command |
static | Discovery based on a static node list |
mcast | Discovery with UDP multicast mode |
dns | Discovery based on DNS records |
etcd | Discovery via etcd |
k8s | Discovery via Kubernetes service |
# static
Configure a fixed node list to automatically discover and create clusters:
cluster {
discovery_strategy = static
static {
seeds = ["emqx@s1.emqx.io", "emqx@s2.emqx.io"]
}
}
2
3
4
5
6
# mcast
Automatically discover and create clusters based on UDP multicast:
cluster {
discovery_strategy = mcast
mcast {
addr = "239.192.0.1"
ports = [4369, 4370]
iface = "0.0.0.0"
ttl = 255
loop = true
}
}
2
3
4
5
6
7
8
9
10
# DNS A records
Automatically discover and create clusters based on DNS A records:
cluster {
discovery_strategy = dns
dns {
name = "localhost"
record_type = a
}
}
2
3
4
5
6
7
# DNS SRV records
Automatically discover and create clusters based on DNS SRV records:
cluster {
discovery_strategy = dns
dns {
name = "localhost"
record_type = srv
}
}
2
3
4
5
6
7
# etcd
Automatically discover and create clusters based on etcd (opens new window):
cluster {
discovery_strategy = etcd
etcd {
server = "http://127.0.0.1:2379"
prefix = emqcl
node_ttl = 1m
}
}
2
3
4
5
6
7
8
# kubernetes
Automatically discover and create clusters based on Kubernetes (opens new window):
cluster {
discovery_strategy = k8s
k8s {
apiserver = "http://10.110.111.204:8080"
service_name = emqx
address_type = ip
app_name = emqx
suffix = "pod.local"
namespace = default
}
}
2
3
4
5
6
7
8
9
10
11
TIP
The Fannel networking plugin is not recommended for Kubernetes; the Calico networking plugin is recommended.