|
|
@@ -0,0 +1,250 @@
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Authentication
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Anonymous: Allow all
|
|
|
+{auth, anonymous, []}.
|
|
|
+
|
|
|
+%% Authentication with username, password
|
|
|
+%% Passwd Hash: plain | md5 | sha | sha256
|
|
|
+{auth, username, [{passwd, "etc/passwd.conf"}, {passwd_hash, plain}]}.
|
|
|
+
|
|
|
+%% Authentication with clientId
|
|
|
+{auth, clientid, [{clients, "etc/client.config"}, {password, no}]}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% ACL
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+{acl, anonymous, []}.
|
|
|
+
|
|
|
+{acl, internal, [{config, "etc/acl.conf"}, {nomatch, allow}]}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Broker
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% System interval of publishing broker $SYS messages
|
|
|
+{broker_sys_interval, 60}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Retained message
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Expired after seconds, never expired if 0
|
|
|
+{retained_expired_after, 0}.
|
|
|
+
|
|
|
+%% Max number of retained messages
|
|
|
+{retained_max_message_num, 100000}.
|
|
|
+
|
|
|
+%% Max Payload Size of retained message
|
|
|
+{retained_max_playload_size, 65536}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% MQTT Protocol
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Max ClientId Length Allowed.
|
|
|
+{mqtt_max_clientid_len, 512}.
|
|
|
+
|
|
|
+%% Max Packet Size Allowed, 64K by default.
|
|
|
+{mqtt_max_packet_size, 65536}.
|
|
|
+
|
|
|
+%% Socket Idle Timeout.
|
|
|
+{mqtt_client_idle_timeout, 30}. % Seconds
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% MQTT Session
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Max number of QoS 1 and 2 messages that can be “inflight” at one time.
|
|
|
+%% 0 means no limit
|
|
|
+{session_max_inflight, 100}.
|
|
|
+
|
|
|
+%% Retry interval for redelivering QoS1/2 messages.
|
|
|
+{session_unack_retry_interval, 60}.
|
|
|
+
|
|
|
+%% Awaiting PUBREL Timeout
|
|
|
+{session_await_rel_timeout, 20}.
|
|
|
+
|
|
|
+%% Max Packets that Awaiting PUBREL, 0 means no limit
|
|
|
+{session_max_awaiting_rel, 0}.
|
|
|
+
|
|
|
+%% Statistics Collection Interval(seconds)
|
|
|
+{session_collect_interval, 0}.
|
|
|
+
|
|
|
+%% Expired after 2 day (unit: minute)
|
|
|
+{session_expired_after, 2880}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Queue
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Type: simple | priority
|
|
|
+{queue_type, simple}.
|
|
|
+
|
|
|
+%% Topic Priority: 0~255, Default is 0
|
|
|
+%% {queue_priority, [{"topic/1", 10}, {"topic/2", 8}]}.
|
|
|
+
|
|
|
+%% Max queue length. Enqueued messages when persistent client disconnected,
|
|
|
+%% or inflight window is full.
|
|
|
+{queue_max_length, infinity}.
|
|
|
+
|
|
|
+%% Low-water mark of queued messages
|
|
|
+{queue_low_watermark, 0.2}.
|
|
|
+
|
|
|
+%% High-water mark of queued messages
|
|
|
+{queue_high_watermark, 0.6}.
|
|
|
+
|
|
|
+%% Queue Qos0 messages?
|
|
|
+{queue_qos0, true}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Listeners
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Plain MQTT
|
|
|
+{listener, mqtt, 1883, [
|
|
|
+ %% Size of acceptor pool
|
|
|
+ {acceptors, 16},
|
|
|
+
|
|
|
+ %% Maximum number of concurrent clients
|
|
|
+ {max_clients, 512},
|
|
|
+
|
|
|
+ %% 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}
|
|
|
+ ]}
|
|
|
+]}.
|
|
|
+
|
|
|
+%% MQTT SSL
|
|
|
+{listener, mqtts, 8883, [
|
|
|
+ %% Size of acceptor pool
|
|
|
+ {acceptors, 4},
|
|
|
+
|
|
|
+ %% Maximum number of concurrent clients
|
|
|
+ {max_clients, 512},
|
|
|
+
|
|
|
+ %% Socket Access Control
|
|
|
+ {access, [{allow, all}]},
|
|
|
+
|
|
|
+ %% SSL certificate and key files
|
|
|
+ {ssl, [{certfile, "etc/ssl/ssl.crt"},
|
|
|
+ {keyfile, "etc/ssl/ssl.key"}]},
|
|
|
+
|
|
|
+ %% Socket Options
|
|
|
+ {sockopts, [
|
|
|
+ {backlog, 1024}
|
|
|
+ %{buffer, 4096},
|
|
|
+ ]}
|
|
|
+]}.
|
|
|
+
|
|
|
+%% HTTP and WebSocket Listener
|
|
|
+{listener, http, 8083, [
|
|
|
+ %% Size of acceptor pool
|
|
|
+ {acceptors, 4},
|
|
|
+
|
|
|
+ %% Maximum number of concurrent clients
|
|
|
+ {max_clients, 64},
|
|
|
+
|
|
|
+ %% Socket Access Control
|
|
|
+ {access, [{allow, all}]},
|
|
|
+
|
|
|
+ %% Socket Options
|
|
|
+ {sockopts, [
|
|
|
+ {backlog, 1024}
|
|
|
+ %{buffer, 4096},
|
|
|
+ ]}
|
|
|
+]}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% PubSub
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% PubSub and Router. Default should be scheduler numbers.
|
|
|
+{pubsub_pool_size, 8}.
|
|
|
+
|
|
|
+%% Route aging time(seconds)
|
|
|
+{pubsub_routing_age, 5}.
|
|
|
+
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Bridge
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+%% TODO: Bridge Queue Size
|
|
|
+{bridge_max_queue_len, 10000}.
|
|
|
+
|
|
|
+%% Ping Interval of bridge node
|
|
|
+{bridge_ping_down_interval, 1} %seconds
|
|
|
+
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+%% Plugins
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Plugins Dir
|
|
|
+{plugins_dir, "./plugins"}.
|
|
|
+
|
|
|
+%% File to store loaded plugin names.
|
|
|
+{plugins_loaded_file, "./data/loaded_plugins"}.
|
|
|
+
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+%% Modules
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Client presence management module. Publish presence messages when client connected or disconnected
|
|
|
+{module, presence, [{qos, 0}]}.
|
|
|
+
|
|
|
+%% Subscribe topics automatically when client connected
|
|
|
+{module, subscription, [{"$queue/clients/$c", 1}, backend]}.
|
|
|
+
|
|
|
+%% [Rewrite](https://github.com/emqtt/emqttd/wiki/Rewrite)
|
|
|
+{module, rewrite, [
|
|
|
+
|
|
|
+ %{topic, "x/#", [
|
|
|
+ % {rewrite, "^x/y/(.+)$", "z/y/$1"},
|
|
|
+ % {rewrite, "^x/(.+)$", "y/$1"}
|
|
|
+ %]},
|
|
|
+
|
|
|
+ %{topic, "y/+/z/#", [
|
|
|
+ % {rewrite, "^y/(.+)/z/(.+)$", "y/z/$2"}
|
|
|
+ %]}
|
|
|
+
|
|
|
+]}.
|
|
|
+
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+%% Erlang System Monitor
|
|
|
+%%-------------------------------------------------------------------
|
|
|
+
|
|
|
+%% Long GC, don't monitor in production mode for:
|
|
|
+%% https://github.com/erlang/otp/blob/feb45017da36be78d4c5784d758ede619fa7bfd3/erts/emulator/beam/erl_gc.c#L421
|
|
|
+
|
|
|
+{sysmon_long_gc, false}.
|
|
|
+
|
|
|
+%% Long Schedule(ms)
|
|
|
+{sysmon_long_schedule, 240}.
|
|
|
+
|
|
|
+%% 8M words. 32MB on 32-bit VM, 64MB on 64-bit VM.
|
|
|
+%% 8 * 1024 * 1024
|
|
|
+{sysmon_large_heap, 8388608}.
|
|
|
+
|
|
|
+%% Busy Port
|
|
|
+{sysmon_busy_port, false}.
|
|
|
+
|
|
|
+%% Busy Dist Port
|
|
|
+{sysmon_busy_dist_port, true}.
|
|
|
+
|