How to clustering with 3 node? and how to start it?

here my configuration…

node {
name = “emqx3@10.21.85.204
cookie = “emqxsecretcookie”
data_dir = “data”
}

log {
file_handlers.default {
level = warning
file = “log/emqx.log”
}
}

emqx.cluster {
name = emqxcl
discovery_strategy = auto
auto_join = on
seed_mode = static
emqx_cluster_static_seed=“["emqx1@10.21.85.208","emqx2@10.21.85.202","emqx3@10.21.85.204"]”
}

listeners.tcp.default {
bind = “0.0.0.0:1883”
max_connections = 1024000
}

listeners.ssl.default {
bind = “0.0.0.0:8883”
max_connections = 512000
ssl_options {
keyfile = “etc/certs/key.pem”
certfile = “etc/certs/cert.pem”
cacertfile = “etc/certs/cacert.pem”
}
}

listeners.ws.default {
bind = “0.0.0.0:8083”
max_connections = 1024000
websocket.mqtt_path = “/mqtt”
}

listeners.wss.default {
bind = “0.0.0.0:8084”
max_connections = 512000
websocket.mqtt_path = “/mqtt”
ssl_options {
keyfile = “etc/certs/key.pem”
certfile = “etc/certs/cert.pem”
cacertfile = “etc/certs/cacert.pem”
}
}

dashboard {
listeners.http {
bind = 18083
}
default_username = “admin”
default_password = “public”
}

authorization {
deny_action = ignore
no_match = allow
sources = [
{
type = file
enable = true
# This file is immutable to EMQX.
# Once new rules are created from dashboard UI or HTTP API,
# the file ‘data/authz/acl.conf’ is used instead of this one
path = “etc/acl.conf”
}
]
}

Hello,

This configuration doesn’t look valid. For example, discovery_strategy can’t be auto, it should be one of these values:

Please check the relevant example explaining how to configure static discovery:

node {
name = “emqx2@10.21.85.204
cookie = “emqxsecretcookie”
data_dir = “data”
}

log {
file_handlers.default {
level = warning
file = “log/emqx.log”
}
}

Like this?

emqx.cluster {
name = emqxcl
discovery_strategy = auto
auto_join = on
seed_mode = auto
}

No, this still doesn’t make sense.
The second link from my previous post has example code. Please copy it as is, and just replace node names.

this is from my cluster of 3 nodes (part of config):


node {
  name = "host1@name.com"
  cookie = "secretcookie"
  data_dir = "data"
}

log {
  file_handlers.default {
    level = warning
    file = "log/emqx.log"
  }
}

cluster {
  name = emqx
  discovery_strategy = static
  static {
        seeds = ["host1@name.com", "host2@name.com", "host3@name.com"]
    }

}


ant this is work

Hi,
I also have a cluster with 3 nodes which works very well.
My question is whether I should repeat this on all 3 nodes :

cluster {
name = emqx
discovery_strategy = static
static {
seeds = [“host1@name.com”, “host2@name.com”, “host3@name.com”]
}

Thanks !

Hello,

Yes, with the static discovery strategy you need to use the same list of nodes. However, you don’t need to add all nodes that are in the cluster to this list. These static seeds are only used for the initial bootstrap of a singleton node. Once the node connects to one of the seed nodes, it then proceeds to connecting to the rest of the nodes that reside in the same cluster automatically.

Thanks for the quick reply.
My thought was whether the same node should be included in the list of nodes.
I mean :

node { name = host1@name.com }

seeds = [ host2@name.com, host3@name.com }

node { name = host2@name.com }

seeds = [ host1@name.com, host3@name.com }

node { name = host3@name.com }

seeds = [ host1@name.com, host2@name.com }

Hello,

It’s safe to include the same node in the list. The cluster discovery logic handles the case when the node discovery callback returns the node itself in the list.

Dmif, thank you very much.
This informations is clear and very useful.
Thanks

Is it possible to do clustering using single IP address but different ports?

Is it possible to do clustering using single IP address but different ports?

While it’s not technically impossible (sometimes we use it for testing), we don’t support this in the production build. Reasons:

  • EMQX listens on multiple ports (MQTT, MQTT with TLS, REST API, broker-to-broker backplane ports), you’ll have to remap each of them.
  • It is hard to configure backplane in this setup.
  • Starting multiple EMQX nodes on the same host doesn’t make sense from high availability or performance perspective.