emq(V2)官网配置文件emq.conf详解(1)----------集群配置

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/top_explore/article/details/97781207

1 集群名称 

cluster.name = emqcl

2 集群自动发现策略

## 集群自动发现策略
##
## 枚举值: 
## - manual: 手工命令创建集群
## - static: 静态节点列表自动集群
## - mcast:  IUDP 组播方式自动集群
## - dns:    DNS A 记录自动集群
## - etcd:   通过 etcd 自动集群
## - k8s:    Kubernetes 服务自动集群
## 
## 默认: manual
cluster.discovery = manual

2.1 manual 手动创建集群

默认配置为手动创建集群,节点通过 ./bin/emqttd_ctl join <Node> 命令加入:

2.2 基于 static 节点列表自动集群

配置固定的节点列表,自动发现并创建集群:

cluster.discovery = static

##--------------------------------------------------------------------
## Cluster with static node list

cluster.static.seeds = [email protected],[email protected]

2.3 基于 mcast 组播自动集群

基于 UDP 组播自动发现并创建集群:

cluster.discovery = mcast

##--------------------------------------------------------------------
## Cluster with multicast

cluster.mcast.addr = 239.192.0.1

cluster.mcast.ports = 4369,4370

cluster.mcast.iface = 0.0.0.0

cluster.mcast.ttl = 255

cluster.mcast.loop = on

2.4 基于 DNS A 记录自动集群

基于 DNS A 记录自动发现并创建集群:

cluster.discovery = dns

##--------------------------------------------------------------------
## Cluster with DNS

cluster.dns.name = localhost

cluster.dns.app  = ekka

2.5 基于 etcd 自动集群

基于 `etcd`_ 自动发现并创建集群:

cluster.discovery = etcd

##--------------------------------------------------------------------
## Cluster with Etcd

cluster.etcd.server = http://127.0.0.1:2379

cluster.etcd.prefix = emqcl

cluster.etcd.node_ttl = 1m

2.6 基于 Kubernetes 自动集群

`Kubernetes`_ 下自动发现并创建集群:

cluster.discovery = k8s

##--------------------------------------------------------------------
## Cluster with k8s

cluster.k8s.apiserver = http://10.110.111.204:8080

cluster.k8s.service_name = ekka

## Address Type: ip | dns
cluster.k8s.address_type = ip

## The Erlang application name
cluster.k8s.app_name = ekka

3 启用集群自愈

## 启用集群自愈
##
## Value: on | off
##
## Default: on
cluster.autoheal = on

4 节点自动清除

自动清除宕机节点:

## 节点自动清除
## 当该值 > 0时,执行.
##
## Value: Duration 持续时间
## -h: hour, 例如 '2h' 为 2小时
## -m: minute, 例如 '5m' 为 5分钟
## -s: second, 例如 '30s' 为 30秒
##
## Default: 5m
cluster.autoclean = 5m

5 EMQ 节点与 Cookie

Erlang/OTP 平台应用多由分布的 Erlang 节点(进程)组成,每个 Erlang 节点(进程)需指配一个节点名,用于节点间通信互访。 所有互相通信的 Erlang 节点(进程)间通过一个共用的 Cookie 进行安全认证。Erlang 节点名称、分布式节点间通信 Cookie:

## 节点名称.
## Default: [email protected]
node.name = [email protected]

## 分布式节点间通信 Cookie
node.cookie = emqsecretcookie

6 Erlang 虚拟机参数

EMQ 节点基于 Erlang/OTP 平台的 TCPv4, TCPv6 或 TLS 协议连接:

猜你喜欢

转载自blog.csdn.net/top_explore/article/details/97781207
今日推荐