From d7fa4e31a0d7b48e4774969b0e96a8dd5fba3802 Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Wed, 7 Jan 2015 14:29:34 +0800 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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': From 5ed1217b0ad220e20e211bdfa291ad997b5dbfec Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:40:05 +0800 Subject: [PATCH 04/10] fix wildcard topics match --- CHANGELOG.md | 7 +++++++ TODO | 6 ++++++ apps/emqtt/src/emqtt_pubsub.erl | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2607c88e..212b04606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ eMQTT ChangeLog ================== +0.2.1 (2015-01-08) +------------------- + +pull request 26: Use binaries for topic paths and fix wildcard topics + +emqtt_pubsub.erl: fix wildcard topic match bug caused by binary topic in 0.2.0 + 0.2.0 (2014-12-07) ------------------- diff --git a/TODO b/TODO index 8c5142381..836737038 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,9 @@ + +0.2.2 +===== + +merge pull request#26 + 0.2.0 ===== diff --git a/apps/emqtt/src/emqtt_pubsub.erl b/apps/emqtt/src/emqtt_pubsub.erl index 22d47a90e..f4cf7c451 100644 --- a/apps/emqtt/src/emqtt_pubsub.erl +++ b/apps/emqtt/src/emqtt_pubsub.erl @@ -249,10 +249,10 @@ trie_match(NodeId, [W|Words], ResAcc) -> [#topic_trie{node_id=ChildId}] -> trie_match(ChildId, Words, Acc); [] -> Acc end - end, 'trie_match_#'(NodeId, ResAcc), [W, "+"]). + end, 'trie_match_#'(NodeId, ResAcc), [W, <<"+">>]). 'trie_match_#'(NodeId, ResAcc) -> - case mnesia:read(topic_trie, #topic_trie_edge{node_id=NodeId, word="#"}) of + case mnesia:read(topic_trie, #topic_trie_edge{node_id=NodeId, word = <<"#">>}) of [#topic_trie{node_id=ChildId}] -> mnesia:read(topic_trie_node, ChildId) ++ ResAcc; [] -> From fc7cce87e86638ea38d1dd0d3edee1fcde2a9894 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:41:32 +0800 Subject: [PATCH 05/10] deps -> get-deps --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 17970a877..6adbf3bf0 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -all: deps compile +all: get-deps compile -compile: deps +compile: get-deps ./rebar compile -deps: +get-deps: ./rebar get-deps clean: From 38b451e1d2b34ea4444843a2565d06104a8595a1 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:44:21 +0800 Subject: [PATCH 06/10] fix mochiweb git --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 7c558a08e..50069b6c4 100644 --- a/rebar.config +++ b/rebar.config @@ -12,5 +12,5 @@ {deps, [ {lager, ".*", {git, "git://github.com/basho/lager.git", {branch, "master"}}}, {esockd, ".*", {git, "git://github.com/slimpp/esockd.git", {branch, "master"}}}, - {mochiweb, ".*", {git, "git@github.com:slimpp/mochiweb.git", {branch, "master"}}} + {mochiweb, ".*", {git, "git://github.com/slimpp/mochiweb.git", {branch, "master"}}} ]}. From 2b7e1bcb1bbdac0bcb147f86aa71b34bfa0cef12 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:51:11 +0800 Subject: [PATCH 07/10] thanks @desoulter --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eff61366f..d29d20dde 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ message | Text Message ## Design -[Design Wiki](https://github.com/slimpp/emqtt/wiki) +[Design Wiki](https://github.com/emqtt/emqtt/wiki) ## License @@ -130,5 +130,9 @@ The MIT License (MIT) ## Author -feng at slimchat.io +feng at emqtt.io + +## Thanks + +@desoulter (assoulter123 at gmail.com) From 70088a0b9e64f732985e5018f3b36a3199825a7d Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:51:17 +0800 Subject: [PATCH 08/10] 0.2.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 212b04606..fb1bb77ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ pull request 26: Use binaries for topic paths and fix wildcard topics emqtt_pubsub.erl: fix wildcard topic match bug caused by binary topic in 0.2.0 +Makefile: deps -> get-deps + +rebar.config: fix mochiweb git url + 0.2.0 (2014-12-07) ------------------- From 61a780f445110b56a3bb676940f01fb49a0b0289 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 15:00:43 +0800 Subject: [PATCH 09/10] Semantic Versioning --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb1bb77ee..7c7ab5c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ eMQTT ChangeLog ================== -0.2.1 (2015-01-08) -------------------- +v0.2.1-beta (2015-01-08) +------------------------ pull request 26: Use binaries for topic paths and fix wildcard topics @@ -12,6 +12,8 @@ Makefile: deps -> get-deps rebar.config: fix mochiweb git url +tag emqtt release accoding to [Semantic Versioning](http://semver.org/) + 0.2.0 (2014-12-07) ------------------- From ccdd0d69b195fed54fe67465a20f49deb0038923 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 15:08:05 +0800 Subject: [PATCH 10/10] clientId length changed --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7ab5c79..9011e9dc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ rebar.config: fix mochiweb git url tag emqtt release accoding to [Semantic Versioning](http://semver.org/) +max clientId length is 1024 now. + 0.2.0 (2014-12-07) -------------------