cluster.conf配置

EMQX 客服发表于:2022年03月24日 17:59:22更新于:2022年03月25日 09:56:42

cluster.name

## Value: String
#
## Default:emqxcl
cluster.name = emqxcl

说明:集群名称

cluster.proto_dist

## Value: Enum
##  - inet_tcp: the default; handles TCP streams with IPv4 addressing.
##  - inet6_tcp: handles TCP with IPv6 addressing.
##  - inet_tls: using TLS for Erlang Distribution.
##
## vm.args: -proto_dist inet_tcp
cluster.proto_dist = inet_tcp

说明:

分布式 Erlang 集群协议类型。可选值为:

  • inet_tcp: 使用 IPv4

  • inet6_tcp 使用 IPv6

  • inet_tls: 使用 TLS,需要与 node.ssl_dist_optfile 配置一起使用。

cluster.discovery

## Value: Enum
## - manual: Manual join command
## - static: Static node list
## - mcast:  IP Multicast
## - dns:    DNS A Record
## - etcd:   etcd
## - k8s:    Kubernetes
##
## Default: manual
cluster.discovery = manual

说明:

集群节点发现方式。可选值为:

  • manual: 手动加入集群

  • static: 配置静态节点。配置几个固定的节点,新节点通过连接固定节点中的某一个来加入集群。

  • mcast: 使用 UDP 多播的方式发现节点。

  • dns: 使用 DNS A 记录的方式发现节点。

  • etcd: 使用 etcd 发现节点。

  • k8s: 使用 Kubernetes 发现节点。

cluster.autoheal

## Value: on | off
##
## Default: on
cluster.autoheal = on

说明:启用或关闭集群脑裂自动恢复机制。

cluster.autoclean

## Value: Duration
## -h: hour, e.g. '2h' for 2 hours
## -m: minute, e.g. '5m' for 5 minutes
## -s: second, e.g. '30s' for 30 seconds
##
## Default: 5m
cluster.autoclean = 5m

说明:指定多久之后从集群中删除离线节点。

cluster.static.seeds

## Value: String
## cluster.static.seeds = emqx1@127.0.0.1,emqx2@127.0.0.1

说明:当使用 static 方式集群时,指定固定的节点列表,多个节点间使用逗号 , 分隔。

cluster.mcast.addr

## Value: IP Address
## cluster.mcast.addr = 239.192.0.1

说明:当使用 mcast 方式集群时,指定多播地址。

cluster.mcast.ports

## Value: Port List
## cluster.mcast.ports = 4369,4370

说明:当使用 mcast 方式集群时,指定多播端口。如有多个端口使用逗号 , 分隔。

cluster.mcast.iface

## Value: Iface Address
##
## Default: 0.0.0.0
## cluster.mcast.iface = 0.0.0.0

说明:当使用 mcast 方式集群时,指定节点发现服务需要绑定到本地哪个 IP 地址。

cluster.mcast.ttl

## Value: 0-255
## cluster.mcast.ttl = 255

说明:当使用 mcast 方式集群时,指定多播的 Time-To-Live 值。

cluster.mcast.loop

## Value: on | off
## cluster.mcast.loop = on

说明:当使用 mcast 方式集群时,设置多播的报文是否投递到本地回环地址。

cluster.dns.name

## Value: String
## cluster.dns.name = localhost

说明:当使用 dns 方式集群时,指定 DNS A 记录的名字。emqx 会通过访问这个 DNS A 记录来获取 IP 地址列表,然后拼接 cluster.dns.app 里指定的 APP 名得到集群中所有节点的列表。

示例:设置 cluster.dns.app = emqx,并且配置了一个 DNS: mycluster.com,其指向 3 个 IP 地址:

192.168.0.100
192.168.0.101
192.168.0.102

则得到集群节点列表如下:

emqx@192.168.0.100
emqx@192.168.0.101
emqx@192.168.0.102

cluster.dns.app

## Value: String
## cluster.dns.app = emqx

说明:当使用 dns 方式集群时,用来与从 cluster.dns.name 获取的 IP 列表拼接得到节点名列表。

cluster.dns.type

## Value: Value: a | srv
## cluster.dns.type = a

说明:DNS记录类型,a代表IPv4地址记录,srv代表服务定位器(广义为服务定位记录)

cluster.etcd.server

## Value: String
## cluster.etcd.server = http://127.0.0.1:2379

说明:当使用 etcd 方式集群时,指定 etcd 服务的地址。如有多个服务使用逗号 , 分隔。

cluster.etcd.prefix

## Value: String
## cluster.etcd.prefix = emqxcl

说明:当使用 etcd 方式集群时,指定 etcd 路径的前缀。每个节点在 etcd 中都会创建一个路径:

v2/keys/<prefix>/<cluster.name>/<node.name>

cluster.etcd.node_ttl

## Default: 1m, 1 minute
## cluster.etcd.node_ttl = 1m

说明:当使用 etcd 方式集群时,指定 etcd 中节点路径的过期时间。

cluster.etcd.ssl.keyfile

## Value: File
## cluster.etcd.ssl.keyfile = etc/certs/client-key.pem

说明:当使用 SSL 连接 etcd 时,指定客户端的私有 Key 文件。

cluster.etcd.ssl.certfile

## Value: File
## cluster.etcd.ssl.certfile = etc/certs/client.pem

说明:当使用 SSL 连接 etcd 时,指定 SSL 客户端的证书文件。

cluster.etcd.ssl.cacertfile

## Value: File
## cluster.etcd.ssl.cacertfile = etc/certs/ca.pem

说明:当使用 SSL 连接 etcd 时,指定 SSL 的 CA 证书文件。

cluster.k8s.apiserver

## Value: String
## cluster.k8s.apiserver = http://10.110.111.204:8080

说明:当使用 k8s 方式集群时,指定 Kubernetes API Server。如有多个 Server 使用逗号 , 分隔。

cluster.k8s.service_name

## Value: String
## cluster.k8s.service_name = emqx

说明:当使用 k8s 方式集群时,指定 Kubernetes 中 EMQX 的服务名。

cluster.k8s.address_type

## Value: ip | dns | hostname
## cluster.k8s.address_type = ip

说明:当使用 k8s 方式集群时,address_type 用来从 Kubernetes 接口的应答里获取什么形式的 Host 列表。

示例:指定 cluster.k8s.address_typeip,则将从 Kubernetes 接口中获取 emqx 服务的 IP 地址列表:

172.16.122.31
172.16.122.32
172.16.122.33

然后与 cluster.k8s.app_name 配置指定的 app name 拼接,得到 emqx 节点列表:

emqx@172.16.122.31
emqx@172.16.122.32
emqx@172.16.122.33

cluster.k8s.app_name

## Value: String
## cluster.k8s.app_name = emqx

说明:当使用 k8s 方式集群时,app_name 用来跟获取的 Host 列表拼接,得到节点列表。

cluster.k8s.suffix

## Value: String
## cluster.k8s.suffix = pod.cluster.local

说明:当使用 k8s 方式并且 cluster.k8s.address_type 指定为 dns 类型时,可设置 emqx 节点名的后缀。与 cluster.k8s.namespace 一起使用用以拼接得到节点名列表。

cluster.k8s.namespace

## Value: String
## cluster.k8s.namespace = default

说明:当使用 k8s 方式并且 cluster.k8s.address_type 指定为 dns 类型时,可设置 emqx 节点名的命名空间。与 cluster.k8s.suffix 一起使用用以拼接得到节点名列表。

示例:设置 cluster.k8s.address_typedns,则将从 Kubernetes 接口中获取 emqx 服务的 dns 列表:

172-16-122-31
172-16-122-32
172-16-122-33

然后拼接上 cluster.k8s.app_name = emqxcluster.k8s.suffix = pod.cluster.localcluster.k8s.namespace = default 得到 dns 形式的 emqx 节点名列表:

emqx@172-16-122-31.default.pod.cluster.local
emqx@172-16-122-32.default.pod.cluster.local
emqx@172-16-122-33.default.pod.cluster.local

    您需要登录后才可以回复