diff --git a/Makefile b/Makefile index b57c22aef..dddd1dba6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ dep_gen_logger = git https://github.com/emqtt/gen_logger dep_esockd = git https://github.com/emqtt/esockd emq20 dep_mochiweb = git https://github.com/emqtt/mochiweb dep_clique = git https://github.com/basho/clique -dep_pbkdf2 = git https://github.com/basho/erlang-pbkdf2 2.0.0 +dep_pbkdf2 = git https://github.com/basho/erlang-pbkdf2 2.0.0 dep_time_compat = git https://github.com/lasp-lang/time_compat dep_rand_compat = git https://github.com/lasp-lang/rand_compat diff --git a/etc/emqttd.conf b/etc/emqttd.conf index e2cce52e7..71c6d0a96 100644 --- a/etc/emqttd.conf +++ b/etc/emqttd.conf @@ -5,7 +5,7 @@ ##==================================================================== ##-------------------------------------------------------------------- -## Erlang VM Args +## Erlang VM ##-------------------------------------------------------------------- ## Erlang Node Name @@ -41,6 +41,12 @@ vm.fullsweep_after = 1000 vm.crash_dump = log/emqttd_crash.dump +##-------------------------------------------------------------------- +## Log +##-------------------------------------------------------------------- + + + ##-------------------------------------------------------------------- ## MQTT Protocol ##-------------------------------------------------------------------- @@ -58,55 +64,40 @@ mqtt.client_idle_timeout = 30 ## MQTT Listeners ##-------------------------------------------------------------------- -## {listener, mqtt, 1883, [ -## %% Size of acceptor pool -## {acceptors, 16}, -## %% Maximum number of concurrent clients -## {max_clients, 512}, -## %% Mount point prefix -## %% {mount_point, "prefix/"}, -## %% Socket Access Control -## {access, [{allow, all}]}, -## %% Connection Options -## {connopts, [ -## %% Rate Limit. Format is 'burst, rate', Unit is KB/Sec -## %% {rate_limit, "100,10"} %% 100K burst, 10K rate -## ]}, -## %% Socket Options -## {sockopts, [ -## %Set buffer if hight thoughtput -## %{recbuf, 4096}, -## %{sndbuf, 4096}, -## %{buffer, 4096}, -## %{nodelay, true}, -## {backlog, 1024} -## ]} -## ]}. +## TCP Listener: 1883, 127.0.0.1:1883, ::1:1883 +mqtt.listener.tcp = 1883 +mqtt.listener.tcp.acceptors = 16 +mqtt.listener.tcp.max_clients = 512 +## Rate Limit. Format is 'burst,rate', Unit is KB/Sec +## mqtt.listener.tcp.rate_limit = 100,10 +## Mount Point +## mqtt.listener.tcp.mount_point = prefix/ +## TCP Socket Options. Set buffer if hight thoughtput +mqtt.listener.tcp.opts.recbuf = 4096 +mqtt.listener.tcp.opts.sndbuf = 4096 +mqtt.listener.tcp.opts.buffer = 4096 +mqtt.listener.tcp.opts.nodelay = true +mqtt.listener.tcp.opts.backlog = 1024 -listener.mqtt.plain = 1883 -## IPv6 -## listener.mqtt = 127.0.0.1:1883 -## IPv6 -## listener.mqtt = ::1:1883 -listener.mqtt.plain.acceptors = 16 -listener.mqtt.plain.max_clients = 512 -listener.mqtt.plain.rate_limit = 100,10 -listener.mqtt.plain.mount_point = prefix/ +## SSL Listener +mqtt.listener.ssl = 883 +mqtt.listener.ssl.acceptors = 4 +mqtt.listener.ssl.max_clients = 512 +## Rate Limit. Format is 'burst,rate', Unit is KB/Sec +## mqtt.listener.ssl.rate_limit = 100,10 +## Mount Point +## mqtt.listener.ssl.mount_point = prefix/ +mqtt.listener.ssl.opts.handshake_timeout = 10 ## Seconds +mqtt.listener.ssl.opts.certfile = etc/ssl/cert.pem +mqtt.listener.ssl.opts.keyfile = etc/ssl/key.pem +mqtt.listener.ssl.opts.cacertfile = etc/ssl/cacert.pem +## mqtt.listener.ssl.opts.verify = verify_peer +## mqtt.listener.ssl.opts.failed_if_no_peer_cert = true -listener.mqtts = 8883 -listener.mqtts.acceptors = 4 -listener.mqtts.max_clients = 512 -listener.mqtts.ssl. - - %% SSL certificate and key files - {ssl, [{handshake_timeout, 10000}, - %% Mutual SSL Authentication option - %% {verify, verify_peer}, - %% {cacertfile, "etc/ssl/ca.pem"}, - {certfile, "etc/ssl/ssl.crt"}, - {keyfile, "etc/ssl/ssl.key"}]}, - -listener.http = 8083 +## HTTP Listener +mqtt.listener.http = 8083 +mqtt.listener.http.acceptors = 4 +mqtt.listener.http.max_clients = 64 ##-------------------------------------------------------------------- ## MQTT Session @@ -132,41 +123,92 @@ mqtt.session.collect_interval = 0 mqtt.session.expired_after = 2880 ##-------------------------------------------------------------------- -## MQTT Queue Parameters +## MQTT Queue ##-------------------------------------------------------------------- ## Type: simple | priority -mqtt.queue_type = simple +mqtt.queue.type = simple ## Topic Priority: 0~255, Default is 0 -## mqtt.queue_priority = topic/1=10,topic/2=8 +## mqtt.queue.priority = topic/1=10,topic/2=8 ## Max queue length. Enqueued messages when persistent client disconnected, ## or inflight window is full. -mqtt.queue_max_length = infinity +mqtt.queue.max_length = infinity ## Low-water mark of queued messages -mqtt.queue_low_watermark = 0.2 +mqtt.queue.low_watermark = 0.2 ## High-water mark of queued messages -mqtt.queue_high_watermark = 0.6 +mqtt.queue.high_watermark = 0.6 ## Queue Qos0 messages? -mqtt.queue_qos0 = true +mqtt.queue.qos0 = true ##-------------------------------------------------------------------- -## Broker +## MQTT Broker and PubSub ##-------------------------------------------------------------------- ## System Interval of publishing broker $SYS Messages -broker.sys_interval = 60 +mqtt.broker.sys_interval = 60 +## PubSub Pool Size. Default should be scheduler numbers. +mqtt.pubsub.pool_size = 8 + +mqtt.pubsub.by_clientid = true + +## Subscribe Asynchronously +mqtt.pubsub.async = true + +##-------------------------------------------------------------------- +## MQTT Bridge +##-------------------------------------------------------------------- + +## TODO: Bridge Queue Size +mqtt.bridge.max_queue_len = 10000 + +## Ping Interval of bridge node +mqtt.bridge.ping_down_interval = 1 ## Second ##------------------------------------------------------------------- -## Log +## MQTT Plugins ##------------------------------------------------------------------- +## Dir of plugins' config +mqtt.plugins.etc_dir = etc/plugins/ +## File to store loaded plugin names. +mqtt.plugins.loaded_file = data/loaded_plugins + +##------------------------------------------------------------------- +## MQTT Modules +##------------------------------------------------------------------- + +## Enable retainer module +mqtt.module.retainer = on +## disc: disc_copies, ram: ram_copies +mqtt.module.retainer.storage_type = disc +## Max number of retained messages +mqtt.module.retainer.max_message_num = 100000 +## Max Payload Size of retained message +mqtt.module.retainer.max_playload_size = 65536 +## Expired after seconds, never expired if 0 +mqtt.module.retainer.expired_after = 0 + +## Enable presence module +## Client presence management module. Publish presence messages when +## client connected or disconnected. +mqtt.module.presence = on +mqtt.module.presence.qos = 0 + +## Enable subscription module +## Subscribe topics automatically when client connected +mqtt.module.subscription = on +mqtt.module.subscription.topics = $client/%c,1;topic2,1 + +## [Rewrite](https://github.com/emqtt/emqttd/wiki/Rewrite) +mqtt.module.rewrite = off +mqtt.module.rewrite.config = etc/modules/rewrite.conf ##------------------------------------------------------------------- ## System Monitor