|
@@ -9,15 +9,15 @@ eMQTT requires Erlang R17+.
|
|
|
## Startup in Five Minutes
|
|
## 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
|
|
## Deploy and Start
|
|
@@ -25,28 +25,77 @@ eMQTT requires Erlang R17+.
|
|
|
### start
|
|
### 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
|
|
### stop
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
- ./bin/emqtt stop
|
|
|
|
|
|
|
+./bin/emqtt stop
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Configuration
|
|
## 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
|
|
## HTTP API
|
|
|
|
|
|
|
@@ -55,13 +104,13 @@ eMQTT support http to publish message.
|
|
|
Example:
|
|
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
|
|
### URL
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
- HTTP POST http://host:8883/mqtt/publish
|
|
|
|
|
|
|
+HTTP POST http://host:8883/mqtt/publish
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
|
### Parameters
|