Permalink
Browse files

new config

  • Loading branch information...
1 parent cec3f78 commit 340613743384054f514d4b0dfc9069953d321c2e @emqplus emqplus committed Oct 8, 2016
Showing with 1,049 additions and 9 deletions.
  1. +1 −0 .gitignore
  2. +19 −8 Makefile
  3. +252 −0 etc/emqttd.2.0.conf
  4. +192 −0 etc/emqttd.conf
  5. +210 −0 etc/emqttd.conf.3
  6. +374 −0 priv/emqttd.schema
  7. +1 −1 rebar.config
View
@@ -27,3 +27,4 @@ ct.coverdata
.idea/
emqttd.iml
_rel/
+data/
View
@@ -1,15 +1,23 @@
PROJECT = emqttd
PROJECT_DESCRIPTION = Erlang MQTT Broker
-PROJECT_VERSION = 2.0
+PROJECT_VERSION = 3.0
-DEPS = gproc lager gen_logger gen_conf esockd mochiweb
+DEPS = gproc lager gen_logger esockd mochiweb getopt pbkdf2 \
+ clique time_compat rand_compat
-dep_gproc = git https://github.com/uwiger/gproc
-dep_lager = git https://github.com/basho/lager
-dep_gen_conf = git https://github.com/emqtt/gen_conf
-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_gproc = git https://github.com/uwiger/gproc
+dep_getopt = git https://github.com/jcomellas/getopt v0.8.2
+dep_lager = git https://github.com/basho/lager master
+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_time_compat = git https://github.com/lasp-lang/time_compat
+dep_rand_compat = git https://github.com/lasp-lang/rand_compat
+
+BUILD_DEPS = cuttlefish
+dep_cuttlefish = git https://github.com/basho/cuttlefish master
ERLC_OPTS += +'{parse_transform, lager_transform}'
@@ -29,3 +37,6 @@ include erlang.mk
app:: rebar.config
+app.config::
+ cuttlefish -l info -e etc/ -c etc/emqttd.conf -i priv/emqttd.schema -d data
+
View
@@ -0,0 +1,252 @@
+
+%%--------------------------------------------------------------------
+%% MQTT Protocol
+%%--------------------------------------------------------------------
+
+%% Max ClientId Length Allowed.
+{mqtt_max_clientid_len, 512}.
+
+%% Max Packet Size Allowed, 64K by default.
+{mqtt_max_packet_size, 65536}.
+
+%% Client Idle Timeout.
+{mqtt_client_idle_timeout, 30}. % Second
+
+%%--------------------------------------------------------------------
+%% Authentication
+%%--------------------------------------------------------------------
+
+%% Anonymous: Allow all
+{auth, anonymous, []}.
+
+%% Authentication with username, password
+{auth, username, [{passwd, "etc/modules/passwd.conf"}]}.
+
+%% Authentication with clientId
+{auth, clientid, [{config, "etc/modules/client.conf"}, {password, no}]}.
+
+%%--------------------------------------------------------------------
+%% ACL
+%%--------------------------------------------------------------------
+
+{acl, anonymous, []}.
+
+{acl, internal, [{config, "etc/modules/acl.conf"}, {nomatch, allow}]}.
+
+%% Cache ACL result for PUBLISH
+{cache_acl, true}.
+
+
+%%--------------------------------------------------------------------
+%% 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}.
+
+%%--------------------------------------------------------------------
+%% Listener
+%%--------------------------------------------------------------------
+
+%% Plain MQTT
+{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}
+ ]}
+]}.
+
+%% MQTT/SSL
+{listener, mqtts, 8883, [
+ %% Size of acceptor pool
+ {acceptors, 4},
+
+ %% Maximum number of concurrent clients
+ {max_clients, 512},
+
+ %% Mount point prefix
+ %% {mount_point, "secure/"},
+
+ %% Socket Access Control
+ {access, [{allow, all}]},
+
+ %% 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"}]},
+
+ %% 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 Pool Size. Default should be scheduler numbers.
+{pubsub_pool_size, 8}.
+
+{pubsub_by_clientid, true}.
+
+%% Subscribe Asynchronously
+{pubsub_async, true}.
+
+%%--------------------------------------------------------------------
+%% Bridge
+%%--------------------------------------------------------------------
+
+%% TODO: Bridge Queue Size
+{bridge_max_queue_len, 10000}.
+
+%% Ping Interval of bridge node
+{bridge_ping_down_interval, 1}. % second
+
+%%-------------------------------------------------------------------
+%% Plugins
+%%-------------------------------------------------------------------
+
+%% Dir of plugins' config
+{plugins_etc_dir, "etc/plugins/"}.
+
+%% File to store loaded plugin names.
+{plugins_loaded_file, "data/loaded_plugins"}.
+
+%%--------------------------------------------------------------------
+%% Modules
+%%--------------------------------------------------------------------
+
+%% Retainer Module
+{module, retainer, [
+
+ %% disc: disc_copies, ram: ram_copies
+ {storage_type, disc},
+
+ %% Max number of retained messages
+ {max_message_num, 100000},
+
+ %% Max Payload Size of retained message
+ {max_playload_size, 65536},
+
+ %% Expired after seconds, never expired if 0
+ {expired_after, 0}
+
+]}.
+
+%% Client presence management module. Publish presence messages when
+%% client connected or disconnected.
+{module, presence, [{qos, 0}]}.
+
+%% Subscribe topics automatically when client connected
+{module, subscription, [{"$client/%c", 1}]}.
+
+%% [Rewrite](https://github.com/emqtt/emqttd/wiki/Rewrite)
+%% {module, rewrite, [{config, "etc/modules/rewrite.conf"}]}.
+
+%%-------------------------------------------------------------------
+%% 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}.
+
Oops, something went wrong.

0 comments on commit 3406137

Please sign in to comment.