|
@@ -144,22 +144,26 @@ Suppose client1 PUBLISH a message to the topic 't/a', the message Route and Deli
|
|
|
Cluster Setup
|
|
Cluster Setup
|
|
|
-------------
|
|
-------------
|
|
|
|
|
|
|
|
-Suppose we deploy two nodes cluster on host1, host2:
|
|
|
|
|
|
|
+Suppose we deploy two nodes cluster on s1.emqtt.io, s2.emqtt.io:
|
|
|
|
|
|
|
|
-+----------------+-----------+---------------------+
|
|
|
|
|
-| Node | Host | IP and Port |
|
|
|
|
|
-+----------------+-----------+---------------------+
|
|
|
|
|
-| emqttd@host1 | host1 | 192.168.1.10:1883 |
|
|
|
|
|
-+----------------+-----------+---------------------+
|
|
|
|
|
-| emqttd@host2 | host2 | 192.168.1.20:1883 |
|
|
|
|
|
-+----------------+-----------+---------------------+
|
|
|
|
|
|
|
++--------------------------+-----------------+---------------------+
|
|
|
|
|
+| Node | Host(FQDN) | IP and Port |
|
|
|
|
|
++--------------------------+-----------------+---------------------+
|
|
|
|
|
+| emqttd@s1.emqtt.io or | s1.emqtt.io | 192.168.0.10:1883 |
|
|
|
|
|
+| emqttd@192.168.0.10 | | |
|
|
|
|
|
++--------------------------+-----------------+---------------------+
|
|
|
|
|
+| emqttd@s2.emqtt.io or | s2.emqtt.io | 192.168.0.20:1883 |
|
|
|
|
|
+| emqttd@192.168.0.20 | | |
|
|
|
|
|
++--------------------------+-----------------+---------------------+
|
|
|
|
|
|
|
|
-emqttd@host1 setting
|
|
|
|
|
---------------------
|
|
|
|
|
|
|
+.. WARNING:: The node name is Name@Host, where Host is IP address or the fully qualified host name.
|
|
|
|
|
+
|
|
|
|
|
+emqttd@s1.emqtt.io setting
|
|
|
|
|
+--------------------------
|
|
|
|
|
|
|
|
emqttd/etc/vm.args::
|
|
emqttd/etc/vm.args::
|
|
|
|
|
|
|
|
- -name emqttd@host1
|
|
|
|
|
|
|
+ -name emqttd@s1.emqtt.io
|
|
|
|
|
|
|
|
or
|
|
or
|
|
|
|
|
|
|
@@ -167,12 +171,12 @@ emqttd/etc/vm.args::
|
|
|
|
|
|
|
|
.. WARNING:: The name cannot be changed after node joined the cluster.
|
|
.. WARNING:: The name cannot be changed after node joined the cluster.
|
|
|
|
|
|
|
|
-emqttd@host2 setting
|
|
|
|
|
---------------------
|
|
|
|
|
|
|
+emqttd@s2.emqtt.io setting
|
|
|
|
|
+--------------------------
|
|
|
|
|
|
|
|
emqttd/etc/vm.args::
|
|
emqttd/etc/vm.args::
|
|
|
|
|
|
|
|
- -name emqttd@host2
|
|
|
|
|
|
|
+ -name emqttd@s2.emqtt.io
|
|
|
|
|
|
|
|
or
|
|
or
|
|
|
|
|
|
|
@@ -181,25 +185,25 @@ emqttd/etc/vm.args::
|
|
|
Join the cluster
|
|
Join the cluster
|
|
|
----------------
|
|
----------------
|
|
|
|
|
|
|
|
-Start the two broker nodes, and 'cluster join ' on emqttd@host2::
|
|
|
|
|
|
|
+Start the two broker nodes, and 'cluster join ' on emqttd@s2.emqtt.io::
|
|
|
|
|
|
|
|
- $ ./bin/emqttd_ctl cluster join emqttd@host1
|
|
|
|
|
|
|
+ $ ./bin/emqttd_ctl cluster join emqttd@s1.emqtt.io
|
|
|
|
|
|
|
|
Join the cluster successfully.
|
|
Join the cluster successfully.
|
|
|
- Cluster status: [{running_nodes,['emqttd@host1','emqttd@host2']}]
|
|
|
|
|
|
|
+ Cluster status: [{running_nodes,['emqttd@s1.emqtt.io','emqttd@s2.emqtt.io']}]
|
|
|
|
|
|
|
|
-Or 'cluster join' on emqttd@host1::
|
|
|
|
|
|
|
+Or 'cluster join' on emqttd@s1.emqtt.io::
|
|
|
|
|
|
|
|
- $ ./bin/emqttd_ctl cluster join emqttd@host2
|
|
|
|
|
|
|
+ $ ./bin/emqttd_ctl cluster join emqttd@s2.emqtt.io
|
|
|
|
|
|
|
|
Join the cluster successfully.
|
|
Join the cluster successfully.
|
|
|
- Cluster status: [{running_nodes,['emqttd@host1','emqttd@host2']}]
|
|
|
|
|
|
|
+ Cluster status: [{running_nodes,['emqttd@s1.emqtt.io','emqttd@s2.emqtt.io']}]
|
|
|
|
|
|
|
|
Query the cluster status::
|
|
Query the cluster status::
|
|
|
|
|
|
|
|
$ ./bin/emqttd_ctl cluster status
|
|
$ ./bin/emqttd_ctl cluster status
|
|
|
|
|
|
|
|
- Cluster status: [{running_nodes,['emqttd@host1','emqttd@host2']}]
|
|
|
|
|
|
|
+ Cluster status: [{running_nodes,['emqttd@s1.emqtt.io','emqttd@s2.emqtt.io']}]
|
|
|
|
|
|
|
|
Leave the cluster
|
|
Leave the cluster
|
|
|
-----------------
|
|
-----------------
|
|
@@ -210,14 +214,13 @@ Two ways to leave the cluster:
|
|
|
|
|
|
|
|
2. remove: remove other nodes from the cluster
|
|
2. remove: remove other nodes from the cluster
|
|
|
|
|
|
|
|
-emqttd@host2 node tries to leave the cluster::
|
|
|
|
|
|
|
+emqttd@s2.emqtt.io node tries to leave the cluster::
|
|
|
|
|
|
|
|
$ ./bin/emqttd_ctl cluster leave
|
|
$ ./bin/emqttd_ctl cluster leave
|
|
|
|
|
|
|
|
-Or remove emqttd@host2 node from the cluster on emqttd@host1::
|
|
|
|
|
-
|
|
|
|
|
- $ ./bin/emqttd_ctl cluster remove emqttd@host2
|
|
|
|
|
|
|
+Or remove emqttd@s2.emqtt.io node from the cluster on emqttd@s1.emqtt.io::
|
|
|
|
|
|
|
|
|
|
+ $ ./bin/emqttd_ctl cluster remove emqttd@s2.emqtt.io
|
|
|
|
|
|
|
|
--------------------
|
|
--------------------
|
|
|
Session across Nodes
|
|
Session across Nodes
|