redesign config

This commit is contained in:
Feng Lee 2015-05-01 02:03:46 +08:00
parent fe13a5c435
commit 880bbfd5fe
1 changed files with 90 additions and 47 deletions

View File

@ -39,80 +39,123 @@
{logger, {lager, info}} {logger, {lager, info}}
]}, ]},
{emqttd, [ {emqttd, [
{access_control, [ %% Authentication and Authorization
%% Authetication. , Anonymous Default {access, [
%% Authetication. Anonymous Default
{auth, [ {auth, [
%% authentication with username, password %% Authentication with username, password
%{username, []}, %{username, []},
%% authentication with clientid %% Authentication with clientid
%{clientid, [{password, no}, {file, "etc/clients.config"}]}, %{clientid, [{password, no}, {file, "etc/clients.config"}]},
%% allow all %% Allow all
{anonymous, []} {anonymous, []}
]}, ]},
%% ACL config %% ACL config
{acl, [ {acl, [
%% User internal ACL module %% Internal ACL module
{internal, [{file, "etc/acl.config"}, {nomatch, allow}]} {internal, [{file, "etc/acl.config"}, {nomatch, allow}]}
]} ]}
]}, ]},
%% MQTT Packet %% MQTT Protocol Options
{mqtt_packet, [ {mqtt, [
{max_clientid_len, 1024}, %% Packet
{max_packet_size, 4096} {packet, [
%% Max ClientId Length Allowed
{max_clientid_len, 1024},
%% Max Packet Size Allowed, 4K default
{max_packet_size, 4096}
]},
%% Client
{client, [
%TODO: Network ingoing limit
%{ingoing_rate_limit, '64KB/s'}
%TODO: Reconnet control
]},
%% Session
{session, [
%% Expired after 24 hours
{expires, 24},
%% Max offline message queue
{max_queue, 100},
%% Store Qos0?
{store_qos0, false}
]}
]}, ]},
%% MQTT Client %% Broker Options
{mqtt_client, [ {broker, [
%TODO: Network ingoing limit
%{ingoing_rate_limit, '64KB/s'}
]},
%% MQTT Session
{mqtt_session, [
{expires, 24}, %hour
{max_queue, 1000},
{store_qos0, false}
]},
%% MQTT Broker
{mqtt_broker, [
%% System interval of publishing broker $SYS messages %% System interval of publishing broker $SYS messages
{sys_interval, 60} {sys_interval, 60},
%% Retained messages
{retained, [
%% Max number of retained messages
{max_message_num, 100000},
%% Max Payload Size of retained message
{max_playload_size, 4096}
]},
%% PubSub
{pubsub, [
%% default should be scheduler numbers
%% {pool_size, 4}
]},
%% Bridge
{bridge, [
%%TODO: bridge queue size
{max_queue_len, 1000},
%% Ping Interval of bridge node
{ping_down_interval, 1} %seconds
]}
]}, ]},
%% Retain messages %% Listeners
{retained, [
{max_message_num, 100000},
{max_playload_size, 4096}
]},
%% PubSub
{mqtt_pubsub, [
%% default should be scheduler numbers
%% {pool_size, 4}
]},
%% Bridge
{mqtt_bridge, [
{max_queue_len, 1000}, %NO effect now
{ping_down_interval, 1} %seconds
]},
%% Listen Ports
{listeners, [ {listeners, [
{mqtt, 1883, [ {mqtt, 1883, [
{backlog, 512}, %% Size of acceptor pool
%{buffer, 4096},
{acceptors, 16}, {acceptors, 16},
%% Maximum number of concurrent clients
{max_clients, 1024}, {max_clients, 1024},
{access, [{allow, all}]} %% Socket Access Control
{access, [{allow, all}]},
%% Socket Options
{sockopts, [
{backlog, 1024}
%Set buffer if hight thoughtput
%{recbuf, 4096},
%{sndbuf, 4096}
%{buffer, 4096},
]}
]}, ]},
{mqtts, 8883, [ {mqtts, 8883, [
{backlog, 128}, %% Size of acceptor pool
{acceptors, 4}, {acceptors, 4},
%% Maximum number of concurrent clients
{max_clients, 1024}, {max_clients, 1024},
%% Socket Access Control
{access, [{allow, all}]}, {access, [{allow, all}]},
%{cacertfile, "etc/ssl/cacert.pem"}, %% SSL certificate and key files
{ssl, [{certfile, "etc/ssl.crt"}, {ssl, [{certfile, "etc/ssl.crt"},
{keyfile, "etc/ssl.key"}]} {keyfile, "etc/ssl.key"}]},
%% Socket Options
{sockopts, [
{backlog, 1024}
%{buffer, 4096},
]}
]}, ]},
%% HTTP and WebSocket Listener
{http, 8083, [ {http, 8083, [
%% Size of acceptor pool
{acceptors, 4}, {acceptors, 4},
%% Maximum number of concurrent clients
{max_clients, 512}, {max_clients, 512},
{access, [{allow, "127.0.0.1"}]} %% Socket Access Control
{access, [
{allow, "127.0.0.1"},
{deny, all}
]},
%% Socket Options
{sockopts, [
{backlog, 1024}
%{buffer, 4096},
]}
]} ]}
]} ]}
]} ]}