diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e6e242e8..664f5bdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ emqttd ChangeLog ================== +0.7.1-alpha (2015-05-04) +------------------------- + +Add doc/design/* and merge doc/* to github Wiki + +Bugfix: issue #121 - emqttd cluster issuse + +Bugfix: issue #123 - emqttd:unload_all_plugins/0 cannot unload any plugin + +Bugfix: fix errors found by dialyzer + + 0.7.0-alpha (2015-05-02) ------------------------- diff --git a/README.md b/README.md index 212dc7988..1ad3709d4 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,18 @@ emqttd is a massively scalable and clusterable MQTT V3.1/V3.1.1 broker written i emqttd requires Erlang R17+ to build. + ## Goals -emqttd aims to provide a solid, enterprise grade open-source MQTT broker that could support ten millions of concurrent MQTT clients. +emqttd is aimed to provide a solid, enterprise grade, extensible open-source MQTT broker for IoT(M2M) applications that need to support ten millions of concurrent MQTT clients. -## Architecture +* Easy to install +* Massively scalable +* Easy to extend +* Solid stable -![emqttd architecture](http://emqtt.io/static/img/Architecture.png) -## Featues +## Features * Full MQTT V3.1/V3.1.1 protocol specification support * QoS0, QoS1, QoS2 Publish and Subscribe @@ -25,7 +28,7 @@ emqttd aims to provide a solid, enterprise grade open-source MQTT broker that co * HTTP Publish API Support * [$SYS/borkers/#](https://github.com/emqtt/emqtt/wiki/$SYS-Topics-of-Broker) Support * Client Authentication with clientId, ipaddress -* Client Authentication with username, password. +* Client Authentication with username, password. * Client ACL control with ipaddress, clientid, username. * Cluster brokers on several servers. * Bridge brokers locally or remotelly @@ -33,11 +36,19 @@ emqttd aims to provide a solid, enterprise grade open-source MQTT broker that co * Extensible architecture with plugin support * Passed eclipse paho interoperability tests + +## Design + +![emqttd architecture](http://emqtt.io/static/img/Architecture.png) + + ## QuickStart Download binary packeges for linux, mac and freebsd from [http://emqtt.io/downloads](http://emqtt.io/downloads). -``` +For example: + +```sh tar xvf emqttd-ubuntu64-0.7.0-alpha.tgz && cd emqttd # start console @@ -61,9 +72,11 @@ git clone https://github.com/emqtt/emqttd.git cd emqttd && make && make dist ``` + ## GetStarted -Read [GettingStarted](https://github.com/emqtt/emqttd/wiki/GettingStarted) for more installation and configuration guide. +Read [emqtt wiki](https://github.com/emqtt/emqttd/wiki) for detailed installation and configuration guide. + ## Benchmark @@ -71,17 +84,20 @@ Benchmark 0.6.1-alpha on a ubuntu/14.04 server with 8 cores, 32G memory from Qin 200K+ Connections, 200K+ Topics, 20K+ In/Out Messages/sec, 20Mbps+ In/Out with 8G Memory, 50%CPU/core + ## License The MIT License (MIT) + ## Contributors [@hejin1026](https://github.com/hejin1026) - [@desoulter](https://github.com/desoulter) - [@turtleDeng](https://github.com/turtleDeng) +[@Hades32](https://github.com/Hades32) +[@huangdan](https://github.com/huangdan) + ## Author diff --git a/apps/emqtt/src/emqtt.app.src b/apps/emqtt/src/emqtt.app.src index ac2d2417a..f156c6e98 100644 --- a/apps/emqtt/src/emqtt.app.src +++ b/apps/emqtt/src/emqtt.app.src @@ -1,7 +1,7 @@ {application, emqtt, [ {description, "Erlang MQTT Common Library"}, - {vsn, "0.7.0"}, + {vsn, "0.7.1"}, {modules, []}, {registered, []}, {applications, [ diff --git a/apps/emqttd/src/emqttd.app.src b/apps/emqttd/src/emqttd.app.src index 3e637230f..deedd416e 100644 --- a/apps/emqttd/src/emqttd.app.src +++ b/apps/emqttd/src/emqttd.app.src @@ -1,7 +1,7 @@ {application, emqttd, [ {description, "Erlang MQTT Broker"}, - {vsn, "0.7.0"}, + {vsn, "0.7.1"}, {modules, []}, {registered, []}, {applications, [kernel, diff --git a/apps/emqttd/src/emqttd.erl b/apps/emqttd/src/emqttd.erl index c14bef228..cbec8e384 100644 --- a/apps/emqttd/src/emqttd.erl +++ b/apps/emqttd/src/emqttd.erl @@ -162,7 +162,7 @@ loaded_plugins() -> -spec unload_all_plugins() -> [{App :: atom(), ok | {error, any()}}]. unload_all_plugins() -> PluginApps = application:get_env(emqttd, plugins, []), - [{App, unload_plugin(App)} || {App, _Env} <- PluginApps]. + [{App, unload_plugin(App)} || App <- PluginApps]. %%------------------------------------------------------------------------------ diff --git a/apps/emqttd/src/emqttd_app.erl b/apps/emqttd/src/emqttd_app.erl index 52a737f74..80bbd968e 100644 --- a/apps/emqttd/src/emqttd_app.erl +++ b/apps/emqttd/src/emqttd_app.erl @@ -31,7 +31,7 @@ -behaviour(application). %% Application callbacks --export([start/2, stop/1]). +-export([start/2, prep_stop/1, stop/1]). -define(PRINT_MSG(Msg), io:format(Msg)). @@ -47,24 +47,24 @@ State :: term(), Reason :: term(). start(_StartType, _StartArgs) -> - print_banner(), + print_banner(), emqttd_mnesia:start(), {ok, Sup} = emqttd_sup:start_link(), - start_servers(Sup), - {ok, Listeners} = application:get_env(listeners), + start_servers(Sup), + {ok, Listeners} = application:get_env(listeners), emqttd:load_all_plugins(), emqttd:open_listeners(Listeners), - register(emqttd, self()), + register(emqttd, self()), print_vsn(), - {ok, Sup}. + {ok, Sup}. print_banner() -> - ?PRINT("starting emqttd on node '~s'~n", [node()]). + ?PRINT("starting emqttd on node '~s'~n", [node()]). print_vsn() -> - {ok, Vsn} = application:get_key(vsn), - {ok, Desc} = application:get_key(description), - ?PRINT("~s ~s is running now~n", [Desc, Vsn]). + {ok, Vsn} = application:get_key(vsn), + {ok, Desc} = application:get_key(description), + ?PRINT("~s ~s is running now~n", [Desc, Vsn]). start_servers(Sup) -> Servers = [{"emqttd event", emqttd_event}, @@ -128,10 +128,16 @@ worker_spec(Name, Opts) -> {Name, start_link, [Opts]}, permanent, 10000, worker, [Name]}. +%% close all listeners first... +prep_stop(State) -> + %%TODO: esockd app should be running... + {ok, Listeners} = application:get_env(listeners), + emqttd:close_listeners(Listeners), + timer:sleep(2), + State. + -spec stop(State :: term()) -> term(). stop(_State) -> - {ok, Listeners} = application:get_env(listeners), - emqttd:close_listeners(Listeners), - emqttd:unload_all_plugins(), ok. + diff --git a/apps/emqttd/src/emqttd_bridge_sup.erl b/apps/emqttd/src/emqttd_bridge_sup.erl index 5adda423a..93787937d 100644 --- a/apps/emqttd/src/emqttd_bridge_sup.erl +++ b/apps/emqttd/src/emqttd_bridge_sup.erl @@ -74,7 +74,7 @@ start_bridge(Node, SubTopic, Options) when is_atom(Node) and is_binary(SubTopic) -spec stop_bridge(atom(), binary()) -> {ok, pid()} | ok. stop_bridge(Node, SubTopic) -> ChildId = bridge_id(Node, SubTopic), - case supervisor:terminate_child(ChildId) of + case supervisor:terminate_child(?MODULE, ChildId) of ok -> supervisor:delete_child(?MODULE, ChildId); {error, Reason} -> diff --git a/apps/emqttd/src/emqttd_ctl.erl b/apps/emqttd/src/emqttd_ctl.erl index 8a236d35a..3499c3855 100644 --- a/apps/emqttd/src/emqttd_ctl.erl +++ b/apps/emqttd/src/emqttd_ctl.erl @@ -57,10 +57,10 @@ status([]) -> {InternalStatus, _ProvidedStatus} = init:get_status(), ?PRINT("Node ~p is ~p~n", [node(), InternalStatus]), case lists:keysearch(emqttd, 1, application:which_applications()) of - false -> - ?PRINT_MSG("emqttd is not running~n"); - {value,_Version} -> - ?PRINT_MSG("emqttd is running~n") + false -> + ?PRINT_MSG("emqttd is not running~n"); + {value,_Version} -> + ?PRINT_MSG("emqttd is running~n") end. %%------------------------------------------------------------------------------ @@ -72,32 +72,41 @@ cluster([]) -> ?PRINT("cluster nodes: ~p~n", [Nodes]); cluster([SNode]) -> - Node = node_name(SNode), - case net_adm:ping(Node) of - pong -> - application:stop(emqttd), - application:stop(esockd), - emqttd_mnesia:cluster(Node), - application:start(esockd), - application:start(emqttd), - ?PRINT("cluster with ~p successfully.~n", [Node]); - pang -> + Node = node_name(SNode), + case net_adm:ping(Node) of + pong -> + case emqttd:is_running(Node) of + true -> + %%TODO: should not unload here. + emqttd:unload_all_plugins(), + application:stop(emqttd), + application:stop(esockd), + application:stop(gproc), + emqttd_mnesia:cluster(Node), + application:start(gproc), + application:start(esockd), + application:start(emqttd), + ?PRINT("cluster with ~p successfully.~n", [Node]); + false -> + ?PRINT("emqttd is not running on ~p~n", [Node]) + end; + pang -> ?PRINT("failed to connect to ~p~n", [Node]) - end. + end. %%------------------------------------------------------------------------------ %% @doc Add usern %% @end %%------------------------------------------------------------------------------ useradd([Username, Password]) -> - ?PRINT("~p~n", [emqttd_auth_username:add_user(bin(Username), bin(Password))]). + ?PRINT("~p~n", [emqttd_auth_username:add_user(bin(Username), bin(Password))]). %%------------------------------------------------------------------------------ %% @doc Delete user %% @end %%------------------------------------------------------------------------------ userdel([Username]) -> - ?PRINT("~p~n", [emqttd_auth_username:remove_user(bin(Username))]). + ?PRINT("~p~n", [emqttd_auth_username:remove_user(bin(Username))]). vm([]) -> [vm([Name]) || Name <- ["load", "memory", "process", "io"]]; diff --git a/apps/emqttd/src/emqttd_event.erl b/apps/emqttd/src/emqttd_event.erl index 4fa57ac56..3db7817aa 100644 --- a/apps/emqttd/src/emqttd_event.erl +++ b/apps/emqttd/src/emqttd_event.erl @@ -114,5 +114,5 @@ payload(connected, Params) -> iolist_to_binary(io_lib:format("from: ~s~nprotocol: ~p~nsession: ~s", [From, Proto, Sess])); payload(disconnected, Reason) -> - list_to_binary(io_lib:format(["reason: ~p", Reason])). + list_to_binary(io_lib:format("reason: ~p", [Reason])). diff --git a/doc/GetStarted.md b/doc/GetStarted.md deleted file mode 100644 index 0514a5f49..000000000 --- a/doc/GetStarted.md +++ /dev/null @@ -1,199 +0,0 @@ -# eMQTT Get Started - -## Overview - -eMQTT is a clusterable, massively scalable, fault-tolerant and extensible MQTT V3.1/V3.1.1 broker written in Erlang/OTP. - -eMQTT is aimed to provide a solid-stable broker that could be clusterd to support millions of connections and clients. - -## Requires - -eMQTT is cross-platform, could run on windows, linux, freebsd and mac os x. - -eMQTT requires Erlang R17+ to build from source. - -## Featues - -### Full MQTT V3.1.1 Support - -MQTT V3.1.1 and V3.1 protocol support - -QoS0, QoS1, QoS2 Publish and Subscribe - -Session Management and Offline Messages - -Retained Messages - -Passed eclipse paho interoperability tests - -### Clusterable, Massively Scalable - -Massive Connections Clients Support - -Cluster brokers on servers or cloud hosts - -Bridge brokers locally or remotelly - -## Download, Install - -### Download - -Dowload binary packages from [http://emqtt.io/downloads](http://emqtt.io/downloads]. - -Please build from source if no packages for your platform, or contact us. - -### Install - -Extract tgz package to your installed directory. for example: - -``` -tar xvf emqtt-ubuntu64-0.3.0-beta.tgz && cd emqtt -``` - -### Startup - -Startup console for debug: - -``` -cd emqtt && ./bin/emqtt console -``` - -You could see all RECV/SENT MQTT Packages on console. - -Start as daemon: - -``` -cd emqtt && ./bin/emqtt start -``` - -eMQTT occupies 1883 port for MQTT, 8083 for HTTP API. - -### Status - -``` -cd emqtt && ./bin/emqtt_ctl status -``` - -### Stop - -``` -cd emqtt && ./bin/emqtt stop -``` - -## Configuration - -### etc/app.config - -``` -{emqtt, [ - %Authetication. Internal, Anonymous Default. - {auth, {anonymous, []}}, - {access, []}, - {session, [ - {expires, 1}, %hours - {max_queue, 1000}, - {store_qos0, false} - ]}, - {retain, [ - {store_limit, 100000} - ]}, - {listen, [ - {mqtt, 1883, [ - {acceptors, 4}, - {max_conns, 1024} - ]}, - {http, 8083, [ - {acceptors, 1}, - {max_conns, 512} - ]} - ]} -]} -``` - -### etc/vm.args - -``` --name emqtt@127.0.0.1 - --setcookie emqtt -``` - -## Cluster - -Suppose we cluster two nodes on 'host1', 'host2', Steps: - -### configure and start node on host1 - -configure 'etc/vm.args': - -``` --name emqtt@host1 -``` - -then start: - -``` -./bin/emqtt start -``` - -### configure and start node on host2 - -configure 'etc/vm.args': - -``` --name emqtt@host2 -``` - -``` -./bin/emqtt start -``` - -### cluster two nodes - -Cluster from 'host2': - -``` -./bin/emqtt_ctl cluster emqtt@host1 -``` - -or cluster from 'host1': - -``` -./bin/emqtt_ctl cluster emqtt@host2 -``` - -then check clustered nodes on any host: - -``` -./bin/emqtt_ctl cluster -``` - -## HTTP API - -eMQTT support HTTP API to publish message from your APP to MQTT client. - -Example: - -``` -curl -v --basic -u user:passwd -d "qos=1&retain=0&topic=/a/b/c&message=hello from http..." -k http://localhost:8083/mqtt/publish -``` - -### URL - -``` -HTTP POST http://host:8083/mqtt/publish -``` - -### Parameters - -Name | Description ---------|--------------- -qos | QoS(0, 1, 2) -retain | Retain(0, 1) -topic | Topic -message | Message - -## Contact - -feng@emqtt.io - diff --git a/doc/acl.md b/doc/acl.md deleted file mode 100644 index cf0e88eb3..000000000 --- a/doc/acl.md +++ /dev/null @@ -1,30 +0,0 @@ - -# ACL - -## Protocol - -Authentication of users and devices - -Authorization of access to Server resources - -An implementation may restrict access to Server resources based on information provided by the Client such as User Name, Client Identifier, the hostname/IP address of the Client, or the outcome of authentication mechanisms. - -Identify a MQTT User: Peername, ClientId, Username - - -## Access Rule - -allow | deny Who subscribe | publish Topic | all - -allow {clientid, {regexp, "abcd"}} subscribe "anna" -deny {clientid, "xxxx"} publish "#" -allow {clientid, "abcd"} publish "#" -allow {peername, "127.0.0.1"} subscribe "$SYS/#" -allow {peername, "127.0.0.1"} subscribe all -allow {clientid, "clientid"} subscribe "#" -allow {clientid, {regexp, "abcd"}} publish "anna" -allow all subscribe all -deny all subscribe all -allow all -deny all - diff --git a/doc/broker.md b/doc/broker.md deleted file mode 100644 index 08337cfdd..000000000 --- a/doc/broker.md +++ /dev/null @@ -1,34 +0,0 @@ -# Broker Topics - -## Version - -$SYS/broker/version - -## Uptime - -$SYS/broker/uptime - -## Recevied and Sent - -$SYS/broker/bytes/received -$SYS/broker/bytes/sent - -$SYS/broker/packets/received -$SYS/broker/packets/sent - -$SYS/broker/messages/received -$SYS/broker/messages/sent -$SYS/broker/messages/retained -$SYS/broker/messages/stored -$SYS/broker/messages/dropped - -## Client Presence - -$SYS/broker/clients/connected -$SYS/broker/clients/disconnected - -$SYS/broker/clients/${clientId}/presences/online -$SYS/broker/clients/${clientId}presences/offline - - - diff --git a/doc/cluster.md b/doc/cluster.md deleted file mode 100644 index 076ba2689..000000000 --- a/doc/cluster.md +++ /dev/null @@ -1,25 +0,0 @@ - - zookeeper - | - eMQTT1 eMQTT2 eMQTT3 - - -Bridge - - - eMQTT1 --> eMQTT2 - - -Cluster - - eMQTT1 <--> eMQTT2 - - -Cluster and Bridge - - eMQTT1 eMQTT3 - ----> - eMQTT2 eMQTT4 - -Mnesia Cluster - diff --git a/doc/design.md b/doc/design.md deleted file mode 100644 index b23963c51..000000000 --- a/doc/design.md +++ /dev/null @@ -1,37 +0,0 @@ -# eMQTT Desgin Guide - -## KeepAlive - -## Retained - -## QOS1 - -## QOS2 - -## Durable Subscriptions - -Durable Sub: - -Client->Queue->Router->Queue->Client - -Normal Sub: - -Client->Router->Client - -Router to register queues - -## Topic Tree - -## Offline Message - -## ACL - -## Authentication with clientId - -## SSL/TLS Socket - -## $SYS/topics and Broker statistics... - -## Cluster - -## Bridge diff --git a/doc/Architecture.png b/doc/design/Architecture.png similarity index 100% rename from doc/Architecture.png rename to doc/design/Architecture.png diff --git a/doc/Architecture.graphml b/doc/design/Design_Cluster.graphml similarity index 100% rename from doc/Architecture.graphml rename to doc/design/Design_Cluster.graphml diff --git a/doc/design/Design_Cluster.png b/doc/design/Design_Cluster.png new file mode 100644 index 000000000..77c7dcc9e Binary files /dev/null and b/doc/design/Design_Cluster.png differ diff --git a/doc/design/Design_Standalone.graphml b/doc/design/Design_Standalone.graphml new file mode 100644 index 000000000..9382a66f6 --- /dev/null +++ b/doc/design/Design_Standalone.graphml @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + P + + + + + + + + + + + + + + + + + + P + + + + + + + + + + + + + + + + + + S + + + + + + + + + + + + + + + + + + S + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + y + + + + + + + + + + + + + + + + + + t + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/design/Design_Standalone.png b/doc/design/Design_Standalone.png new file mode 100644 index 000000000..992694523 Binary files /dev/null and b/doc/design/Design_Standalone.png differ diff --git a/doc/design/PubSub_CleanSess_0.png b/doc/design/PubSub_CleanSess_0.png new file mode 100644 index 000000000..831d25f8a Binary files /dev/null and b/doc/design/PubSub_CleanSess_0.png differ diff --git a/doc/design/PubSub_CleanSess_1.png b/doc/design/PubSub_CleanSess_1.png new file mode 100644 index 000000000..bd6227e3a Binary files /dev/null and b/doc/design/PubSub_CleanSess_1.png differ diff --git a/doc/hooks_chain.md b/doc/hooks_chain.md deleted file mode 100644 index c6e1e165d..000000000 --- a/doc/hooks_chain.md +++ /dev/null @@ -1 +0,0 @@ -packet, message handler chain??? diff --git a/doc/mqtt-v3.1.1-os.pdf b/doc/mqtt-v3.1.1-os.pdf new file mode 100644 index 000000000..03a935fdd Binary files /dev/null and b/doc/mqtt-v3.1.1-os.pdf differ diff --git a/doc/protocol.md b/doc/protocol.md deleted file mode 100644 index 77ba565b3..000000000 --- a/doc/protocol.md +++ /dev/null @@ -1,36 +0,0 @@ -# MQTT Protocol Guide - -## Server or Broker - -A program or device that acts as an intermediary between Clients which publish Application Messages and Clients which have made Subscriptions. - -A Server Accepts Network Connections from Clients. -Accepts Application Messages published by Clients. -Processes Subscribe and Unsubscribe requests from Clients. -Forwards Application Messages that match Client Subscriptions. - - -Client ----> Broker(Server) ----> Client - -Publisher ----> Broker -----> Subscriber - -## Subscription and Session - -### Subscription - -A Subscription comprises a Topic Filter and a maximum QoS. A Subscription is associated with a single Session. A Session can contain more than one Subscription. Each Subscription within a session has a different Topic Filter. - -### Session - -A stateful interaction between a Client and a Server. Some Sessions last only as long as the Network - -Connection, others can span multiple consecutive Network Connections between a Client and a Server. - -## Topic Name and Filter - -An expression contained in a Subscription, to indicate an interest in one or more topics. A Topic Filter can include wildcard characters. - - -## Packet Identifier - - diff --git a/doc/pubsub.md b/doc/pubsub.md deleted file mode 100644 index 69fa14a91..000000000 --- a/doc/pubsub.md +++ /dev/null @@ -1,40 +0,0 @@ -# PubSub - -## Qos - -PubQos | SubQos | In Message | Out Message --------|--------|------------|------------- - 0 | 0 | - | - - 0 | 1 | - | - - 0 | 2 | - | - - 1 | 0 | - | - - 1 | 1 | - | - - 1 | 2 | - | - - 2 | 0 | - | - - 2 | 1 | - | - - 2 | 2 | - | - - - -## Publish - - -## Performance - -Mac Air(11): - -Function | Time(microseconds) --------------|-------------------- -match | 6.25086 -triples | 13.86881 -words | 3.41177 -binary:split | 3.03776 - -iMac: - -Function | Time(microseconds) --------------|-------------------- -match | 3.2348 -triples | 6.93524 -words | 1.89616 -binary:split | 1.65243 - diff --git a/doc/quickstart.md b/doc/quickstart.md deleted file mode 100644 index ffab18d36..000000000 --- a/doc/quickstart.md +++ /dev/null @@ -1,133 +0,0 @@ -## Quick Start - -## Startup in Five Minutes - -``` -$ git clone git://github.com/emqtt/emqttd.git - -$ cd emqttd - -$ make && make dist - -$ cd rel/emqttd - -$ ./bin/emqttd console -``` - -## Deploy and Start - -### start - -``` -cp -R rel/emqttd $INSTALL_DIR - -cd $INSTALL_DIR/emqttd - -./bin/emqttd start - -``` - -### stop - -``` -./bin/emqttd stop - -``` - -## Configuration - -### etc/app.config - -``` - {emqttd, [ - {auth, {anonymous, []}}, %internal, anonymous - {listen, [ - {mqtt, 1883, [ - {acceptors, 4}, - {max_clients, 1024} - ]}, - {mqtts, 8883, [ - {acceptors, 4}, - {max_clients, 1024}, - %{cacertfile, "etc/ssl/cacert.pem"}, - {ssl, [{certfile, "etc/ssl.crt"}, - {keyfile, "etc/ssl.key"}]} - ]}, - {http, 8083, [ - {acceptors, 1}, - {max_clients, 512} - ]} - ]} - ]} - -``` - -### etc/vm.args - -``` - --name emqttd@127.0.0.1 - --setcookie emqtt - -``` - -When nodes clustered, vm.args should be configured as below: - -``` --name emqttd@host1 -``` - -## Cluster - -Suppose we cluster two nodes on 'host1', 'host2', Steps: - -on 'host1': - -``` -./bin/emqttd start -``` - -on 'host2': - -``` -./bin/emqttd start - -./bin/emqttd_ctl cluster emqttd@host1 -``` - -Run './bin/emqttd_ctl cluster' on 'host1' or 'host2' to check cluster nodes. - -## HTTP API - -emqttd support http to publish message. - -Example: - -``` -curl -v --basic -u user:passwd -d "qos=1&retain=0&topic=a/b/c&message=hello from http..." -k http://localhost:8083/mqtt/publish -``` - -### URL - -``` -HTTP POST http://host:8083/mqtt/publish -``` - -### Parameters - -Name | Description ---------|--------------- -qos | QoS(0, 1, 2) -retain | Retain(0, 1) -topic | Topic -message | Message - - -## Contributors - -@hejin1026 <260495915 at qq.com> - -@desoulter - -@turtleDeng diff --git a/doc/retain.md b/doc/retain.md deleted file mode 100644 index 535c2e9a8..000000000 --- a/doc/retain.md +++ /dev/null @@ -1,6 +0,0 @@ -# Retained Message - -## API - -store( - diff --git a/doc/route.md b/doc/route.md deleted file mode 100644 index c48a50886..000000000 --- a/doc/route.md +++ /dev/null @@ -1,19 +0,0 @@ - - -ClientA -> SessionA -> Route -> PubSub -> SessionB -> ClientB - - -ClientA -> Session -> PubSub -> Route -> SessionB -> ClientB - | | - Trie Subscriber - - -ClientPidA -> ClientPidB - - -ClientPidA -> SessionPidB -> ClientB - - -ClientPidA -> SessionPidA -> SessionPidB -> ClientPidB - - diff --git a/doc/session.md b/doc/session.md deleted file mode 100644 index fc9211a9b..000000000 --- a/doc/session.md +++ /dev/null @@ -1,50 +0,0 @@ -# Session Design - -## session manager - -```erlang - -%% lookup sesssion -emqtt_sm:lookup_session(ClientId) - -%% Start new or resume existing session -emqtt_sm:start_session(ClientId) - -%% destroy session, discard all data -emqtt_sm:destory_session(ClientId) - -%% close session, save all data -emqtt_sm:close_session(ClientId) -``` - -## session supervisor - -usage? - -## session - -``` -%%system process -process_flag(trap_exit, true), - -session:start() -session:subscribe( -session:publish( -session:resume( -session:suspend( -%%destory all data -session:destory( -%%save all data -session:close() - -``` - -## sm and session - -sm manage and monitor session - -## client and session - - client(normal process)<--link to -->session(system process) - - diff --git a/doc/state_design.md b/doc/state_design.md deleted file mode 100644 index 74a484e37..000000000 --- a/doc/state_design.md +++ /dev/null @@ -1,4 +0,0 @@ - - -client state --> parse_state - --> proto_state --> session_state diff --git a/doc/systopics.md b/doc/systopics.md deleted file mode 100644 index f8bdd1b72..000000000 --- a/doc/systopics.md +++ /dev/null @@ -1,4 +0,0 @@ -# eMQTT $SYS Topics - -Wiki: [$SYS Topics of Broker](https://github.com/emqtt/emqtt/wiki/$SYS-Topics-of-Broker) - diff --git a/doc/topic.md b/doc/topic.md deleted file mode 100644 index 90c694c08..000000000 --- a/doc/topic.md +++ /dev/null @@ -1,22 +0,0 @@ -Topic Types: - -static: - - /brokers/alerts/ - /brokers/clients/connected - /brokers/clients/disconnected - -dynamic: - - created when subscribe... - -bridge: - - cretated when bridge... - - -## Create Topics - -emqttd_pubsub:create(Type, Name) -emqttd_pubsub:create(#topic{name = Name, node= node(), type = Type}). - diff --git a/doc/user-guide.md b/doc/user-guide.md deleted file mode 100644 index 914876532..000000000 --- a/doc/user-guide.md +++ /dev/null @@ -1,14 +0,0 @@ -# eMQTT User Guide - -## Introduction - -## Installation - -### Install Requirements - -## Configuration - -## Cluster - -## Bridge - diff --git a/plugins/emqttd_auth_mysql/.placehodler b/plugins/emqttd_auth_mysql/.placehodler deleted file mode 100644 index e69de29bb..000000000 diff --git a/rel/files/acl.config b/rel/files/acl.config index e17d28cef..c1985f1d4 100644 --- a/rel/files/acl.config +++ b/rel/files/acl.config @@ -1,6 +1,6 @@ %%%----------------------------------------------------------------------------- %% -%% [ACL Design](https://github.com/emqtt/emqttd/wiki/ACL-Design) +%% [ACL](https://github.com/emqtt/emqttd/wiki/ACL) %% %% -type who() :: all | binary() | %% {ipaddr, esockd_access:cidr()} |