This commit is contained in:
Feng Lee 2016-02-26 21:52:18 +08:00
parent 1158ccbbcd
commit 385ab3ec77
3 changed files with 46 additions and 58 deletions

View File

@ -5,31 +5,29 @@
Configuration Configuration
============= =============
emqttd消息服务器通过etc/目录下配置文件进行设置,主要配置文件包括: Configuration files are under 'etc/' folder, including:
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| 配置文件 | 说明 | | File | Description |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/vm.args | Erlang 虚拟机的参数设置 | | etc/vm.args | Erlang VM Arguments |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/emqttd.config | emqttd消息服务器参数设置 | | etc/emqttd.config | emqttd broker Config |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/acl.config | ACL(访问控制规则)设置 | | etc/acl.config | ACL Config |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/clients.config| 基于ClientId认证设置 | | etc/clients.config| ClientId Authentication |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/rewrite.config| Rewrite扩展模块规则配置 | | etc/rewrite.config| Rewrite Rules |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
| etc/ssl/* | SSL证书设置 | | etc/ssl/* | SSL certificate and key files |
+-------------------+-----------------------------------+ +-------------------+-----------------------------------+
----------- -----------
etc/vm.args etc/vm.args
----------- -----------
Configure parameters of Erlang VM: Configure and Optimize Erlang VM::
.. code::
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
## Name of the node ## Name of the node
@ -84,35 +82,33 @@ Configure parameters of Erlang VM:
## Tweak GC to run more often ## Tweak GC to run more often
-env ERL_FULLSWEEP_AFTER 1000 -env ERL_FULLSWEEP_AFTER 1000
etc/vm.args中两个最重要的参数: The two most important parameters in etc/vm.args:
+-------+----------------------------------------------------------------------------------------------+ +-------+---------------------------------------------------------------------------+
| +P | Erlang虚拟机允许的最大进程数一个MQTT连接会消耗2个Erlang进程所以参数值 > 最大连接数 * 2 | | +P | Max number of Erlang proccesses. A MQTT client consumes two proccesses. |
+-------+----------------------------------------------------------------------------------------------+ | | The value should be larger than max_clients * 2 |
| +Q | Erlang虚拟机允许的最大Port数量一个MQTT连接消耗1个Port所以参数值 > 最大连接数 | +-------+---------------------------------------------------------------------------+
+-------+----------------------------------------------------------------------------------------------+ | +Q | Max number of Erlang Ports. A MQTT client consumes one port. |
| | The value should be larger than max_clients. |
+-------+---------------------------------------------------------------------------+
etc/vm.args设置Erlang节点名、节点间通信Cookie:: The name and cookie of Erlang Node should be configured when clustering::
-name emqttd@127.0.0.1 -name emqttd@host_or_ip
## Cookie for distributed erlang ## Cookie for distributed erlang
-setcookie emqttdsecretcookie -setcookie emqttdsecretcookie
.. NOTE::
Erlang/OTP平台应用多由分布的Erlang节点(进程)组成每个Erlang节点(进程)需指配一个节点名,用于节点间通信互访。
所有互相通信的Erlang节点(进程)间通过一个共用的Cookie进行安全认证。
----------------- -----------------
etc/emqttd.config etc/emqttd.config
----------------- -----------------
etc/emqttd.config是消息服务器的核心配置文件。Erlang程序由多个应用(application)组成,每个应用(application)有自身的环境参数, The main configuration file for emqttd broker.
启动时候通过etc/emqttd.config文件加载。 File Syntax
-----------
etc/emqttd.config文件采用的是Erlang数据格式kernel, sasl, emqttd是Erlang应用(application)名称,'[]'内是应用的环境参数列表。 The config consists of a list of Erlang Applications and their environments.
.. code:: erlang .. code:: erlang
@ -131,24 +127,22 @@ etc/emqttd.config文件采用的是Erlang数据格式kernel, sasl, emqttd是E
]} ]}
]. ].
emqttd.config格式简要说明: The file adopts Erlang Term Syntax:
1. [ ] : 列表,逗号分隔元素 1. [ ]: List, seperated by comma
2. { }: Tuple, Usually {Env, Value}
3. % : comment
2. { } : 元组,配置元组一般两个元素{Env, Value} Log Level and File
------------------
3. % : 注释 Logger of emqttd broker is implemented by 'lager' application::
Log Level and Destination
-------------------------
emqttd消息服务器日志由lager应用(application)提供日志相关设置在lager应用段落::
{lager, [ {lager, [
... ...
]}, ]},
产品环境下默认只开启error日志日志输出到logs/emqttd_error.log文件。'handlers'段落启用其他级别日志:: Configure log handlers::
{handlers, [ {handlers, [
{lager_console_backend, info}, {lager_console_backend, info},
@ -172,47 +166,45 @@ emqttd消息服务器日志由lager应用(application)提供,日志相关设
]} ]}
]} ]}
.. WARNING:: 过多日志打印严重影响服务器性能产品环境下建议开启error级别日志。 emqttd Application
Broker Parameters
------------------ ------------------
emqttd消息服务器参数设置在emqttd应用段落包括用户认证与访问控制设置MQTT协议、会话、队列设置扩展模块设置TCP服务监听器设置:: The MQTT broker is implemented by erlang 'emqttd' application::
{emqttd, [ {emqttd, [
%% 用户认证与访问控制设置 %% Authentication and Authorization
{access, [ {access, [
... ...
]}, ]},
%% MQTT连接、协议、会话、队列设置 %% MQTT Protocol Options
{mqtt, [ {mqtt, [
... ...
]}, ]},
%% 消息服务器设置 %% Broker Options
{broker, [ {broker, [
... ...
]}, ]},
%% 扩展模块设置 %% Modules
{modules, [ {modules, [
... ...
]}, ]},
%% 插件目录设置 %% Plugins
{plugins, [ {plugins, [
... ...
]}, ]},
%% TCP监听器设置 %% Listeners
{listeners, [ {listeners, [
... ...
]}, ]},
%% Erlang虚拟机监控设置 %% Erlang System Monitor
{sysmon, [ {sysmon, [
]} ]}
]} ]}
access用户认证设置 Authentication
------------------ --------------
emqttd消息服务器认证由一系列认证模块(module)或插件(plugin)提供系统默认支持用户名、ClientID、LDAP、匿名(anonymouse)认证模块:: emqttd消息服务器认证由一系列认证模块(module)或插件(plugin)提供系统默认支持用户名、ClientID、LDAP、匿名(anonymouse)认证模块::

View File

@ -18,6 +18,7 @@ Highlights of the emqttd broker:
* Full MQTT V3.1/3.1.1 Protocol Specifications Support * Full MQTT V3.1/3.1.1 Protocol Specifications Support
* Easy to Install - Quick Install on Linux, FreeBSD, Mac and Windows * Easy to Install - Quick Install on Linux, FreeBSD, Mac and Windows
* Massively scalable - Scaling to 1 million connections on a single server * Massively scalable - Scaling to 1 million connections on a single server
* Cluster and Bridge Support
* Easy to extend - Hooks and plugins to customize or extend the broker * Easy to extend - Hooks and plugins to customize or extend the broker
* Pluggable Authentication - LDAP, MySQL, PostgreSQL, Redis Authentication Plugins * Pluggable Authentication - LDAP, MySQL, PostgreSQL, Redis Authentication Plugins
@ -76,7 +77,7 @@ Installing on Mac, For example:
Installing from Source Installing from Source
---------------------- ----------------------
.. NOTE:: emqttd requires Erlang R17+ to build. .. NOTE:: emqttd broker requires Erlang R17+ to build.
.. code:: console .. code:: console
@ -92,9 +93,7 @@ Web Dashboard
A Web Dashboard will be loaded automatically when the emqttd broker is started successfully. A Web Dashboard will be loaded automatically when the emqttd broker is started successfully.
The Dashboard helps to check running status of the broker, monitor statistics and metrics of MQTT packets, The Dashboard helps to check running status of the broker, monitor statistics and metrics of MQTT packets, query clients, sessions, topics and subscriptions.
query clients, sessions, topics and subscriptions.
+------------------+---------------------------+ +------------------+---------------------------+
| Default Address | http://localhost:18083 | | Default Address | http://localhost:18083 |
@ -110,9 +109,7 @@ query clients, sessions, topics and subscriptions.
Modules and Plugins Modules and Plugins
------------------- -------------------
The emqttd broker could be extended by Modules and Plugins. The Authentication and ACL mechanism is usually implemented by a Module or Plugin.
The authentication and ACL mechanism is usually implemented by a module or plugin.
Modules Modules
------- -------

View File

@ -47,7 +47,6 @@ Contents:
config config
cluster cluster
bridge bridge
guide
commands commands
plugins plugins