From d7fa4e31a0d7b48e4774969b0e96a8dd5fba3802 Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Wed, 7 Jan 2015 14:29:34 +0800 Subject: [PATCH 1/3] configuration, cluster --- README.md | 77 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index de4686df3..d36d3ce4f 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,15 @@ eMQTT requires Erlang R17+. ## Startup in Five Minutes ``` - $ git clone git://github.com/slimpp/emqtt.git +$ git clone git://github.com/slimpp/emqtt.git - $ cd emqtt +$ cd emqtt - $ make && make dist +$ make && make dist - $ cd rel/emqtt +$ cd rel/emqtt - $ ./bin/emqtt console +$ ./bin/emqtt console ``` ## Deploy and Start @@ -25,29 +25,80 @@ eMQTT requires Erlang R17+. ### start ``` - cp -R rel/emqtt $INSTALL_DIR +cp -R rel/emqtt $INSTALL_DIR - cd $INSTALL_DIR/emqtt +cd $INSTALL_DIR/emqtt - ./bin/emqtt start +./bin/emqtt start ``` ### stop ``` - ./bin/emqtt stop +./bin/emqtt stop ``` ## Configuration -...... +### etc/app.config -## Admin and Cluster +``` +{emqtt, [ + {auth, {anonymous, []}}, %internal, anonymous + {listen, [ + {mqtt, 1883, [ + {max_conns, 1024}, + {acceptor_pool, 4} + ]}, + {http, 8883, [ + {max_conns, 512}, + {acceptor_pool, 1} + ]} + ]} +]} + +``` + +### etc/vm.args + +``` + +-sname emqtt + +-setcookie emqtt + +``` + +When nodes clustered, vm.args should be configured as below: + +``` +-name emqtt@host1 +``` ...... +## Cluster + +Suppose we cluster two nodes on 'host1', 'host2', steps: + +on 'host1': + +``` +./bin/emqtt start +``` + +on 'host2': + +``` +./bin/emqtt start + +./bin/emqtt_ctl cluster emqtt@host1 +``` + +Run './bin/emqtt_ctl cluster' on 'host1' or 'host2' to check cluster nodes. + ## HTTP API eMQTT support http to publish message. @@ -55,13 +106,13 @@ eMQTT support http to publish message. Example: ``` - curl -v --basic -u user:passwd -d "topic=/a/b/c&message=hello from http..." -k http://localhost:8883/mqtt/publish +curl -v --basic -u user:passwd -d "topic=/a/b/c&message=hello from http..." -k http://localhost:8883/mqtt/publish ``` ### URL ``` - HTTP POST http://host:8883/mqtt/publish +HTTP POST http://host:8883/mqtt/publish ``` ### Parameters From 1910fc2cebd9414356a37967c8a6fa8801d6c72f Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Wed, 7 Jan 2015 14:31:25 +0800 Subject: [PATCH 2/3] rm .... --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d36d3ce4f..03b7e55f7 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,6 @@ When nodes clustered, vm.args should be configured as below: -name emqtt@host1 ``` -...... - ## Cluster Suppose we cluster two nodes on 'host1', 'host2', steps: From 0f14b98e7ecf91a156423939867371b23bfd625e Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Wed, 7 Jan 2015 14:32:41 +0800 Subject: [PATCH 3/3] Steps --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03b7e55f7..eff61366f 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ When nodes clustered, vm.args should be configured as below: ## Cluster -Suppose we cluster two nodes on 'host1', 'host2', steps: +Suppose we cluster two nodes on 'host1', 'host2', Steps: on 'host1':