getstarted.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .. _getstarted:
  2. ===========
  3. Get Started
  4. ===========
  5. --------
  6. Overview
  7. --------
  8. emqttd is a massively scalable and clusterable MQTT V3.1/V3.1.1 broker written in Erlang/OTP.
  9. emqttd is aimed to provide a solid, enterprise grade, extensible open-source MQTT broker for IoT, M2M and Mobile applications that need to support ten millions of concurrent MQTT clients.
  10. * Easy to install
  11. * Massively scalable
  12. * Easy to extend
  13. * Solid stable
  14. --------
  15. Features
  16. --------
  17. -----------
  18. Quick Start
  19. -----------
  20. Download and Install
  21. --------------------
  22. Download binary packeges for Linux, Mac, FreeBSD and Windows from http://emqtt.io/downloads.
  23. .. code:: console
  24. unzip emqttd-macosx-0.16.0-beta-20160216.zip && cd emqttd
  25. # Start emqttd
  26. ./bin/emqttd start
  27. # Check Status
  28. ./bin/emqttd_ctl status
  29. # Stop emqttd
  30. ./bin/emqttd stop
  31. Build from Source
  32. -----------------
  33. .. code:: console
  34. git clone https://github.com/emqtt/emqttd.git
  35. cd emqttd && make && make dist
  36. --------------------
  37. Web Dashboard
  38. --------------------
  39. .. image:: ./_static/images/dashboard.png
  40. --------------------
  41. Features List
  42. --------------------
  43. * Full MQTT V3.1/V3.1.1 protocol specification support
  44. * QoS0, QoS1, QoS2 Publish and Subscribe
  45. * Session Management and Offline Messages
  46. * Retained Messages Support
  47. * Last Will Message Support
  48. * TCP/SSL Connection Support
  49. * MQTT Over Websocket(SSL) Support
  50. * HTTP Publish API Support
  51. * [$SYS/brokers/#](https://github.com/emqtt/emqtt/wiki/$SYS-Topics-of-Broker) Support
  52. * Client Authentication with clientId, ipaddress
  53. * Client Authentication with username, password.
  54. * Client ACL control with ipaddress, clientid, username.
  55. * Cluster brokers on several servers.
  56. * [Bridge](https://github.com/emqtt/emqttd/wiki/Bridge) brokers locally or remotely
  57. * 500K+ concurrent clients connections per server
  58. * Extensible architecture with Hooks, Modules and Plugins
  59. * Passed eclipse paho interoperability tests
  60. --------------------
  61. Modules and Plugins
  62. --------------------
  63. Modules
  64. --------
  65. * [emqttd_auth_clientid](https://github.com/emqtt/emqttd/wiki/Authentication) - Authentication with ClientIds
  66. * [emqttd_auth_username](https://github.com/emqtt/emqttd/wiki/Authentication) - Authentication with Username and Password
  67. * [emqttd_auth_ldap](https://github.com/emqtt/emqttd/wiki/Authentication) - Authentication with LDAP
  68. * [emqttd_mod_presence](https://github.com/emqtt/emqttd/wiki/Presence) - Publish presence message to $SYS topics when client connected or disconnected
  69. * emqttd_mod_autosub - Subscribe topics when client connected
  70. * [emqttd_mod_rewrite](https://github.com/emqtt/emqttd/wiki/Rewrite) - Topics rewrite like HTTP rewrite module
  71. Plugins
  72. --------
  73. * [emqttd_plugin_template](https://github.com/emqtt/emqttd_plugin_template) - Plugin template and demo
  74. * [emqttd_dashboard](https://github.com/emqtt/emqttd_dashboard) - Web Dashboard
  75. * [emqttd_plugin_mysql](https://github.com/emqtt/emqttd_plugin_mysql) - Authentication with MySQL
  76. * [emqttd_plugin_pgsql](https://github.com/emqtt/emqttd_plugin_pgsql) - Authentication with PostgreSQL
  77. * [emqttd_plugin_kafka](https://github.com/emqtt/emqtt_kafka) - Publish MQTT Messages to Kafka
  78. * [emqttd_plugin_redis](https://github.com/emqtt/emqttd_plugin_redis) - Redis Plugin
  79. * [emqttd_plugin_mongo](https://github.com/emqtt/emqttd_plugin_mongo) - MongoDB Plugin
  80. * [emqttd_stomp](https://github.com/emqtt/emqttd_stomp) - Stomp Protocol Plugin
  81. * [emqttd_sockjs](https://github.com/emqtt/emqttd_sockjs) - SockJS(Stomp) Plugin
  82. * [emqttd_recon](https://github.com/emqtt/emqttd_recon) - Recon Plugin
  83. ----------------------------------
  84. One million Connections
  85. ----------------------------------
  86. Linux Kernel Parameters
  87. -----------------------
  88. .. code::
  89. sysctl -w fs.file-max=2097152
  90. sysctl -w fs.nr_open=2097152
  91. TCP Stack Parameters
  92. -----------------------
  93. .. code::
  94. sysctl -w net.core.somaxconn=65536
  95. Erlang VM
  96. -----------------
  97. emqttd/etc/vm.args::
  98. ## max process numbers
  99. +P 2097152
  100. ## Sets the maximum number of simultaneously existing ports for this system
  101. +Q 1048576
  102. ## Increase number of concurrent ports/sockets
  103. -env ERL_MAX_PORTS 1048576
  104. -env ERTS_MAX_PORTS 1048576
  105. emqttd.config
  106. -----------------
  107. emqttd/etc/emqttd.config::
  108. {mqtt, 1883, [
  109. %% Size of acceptor pool
  110. {acceptors, 64},
  111. %% Maximum number of concurrent clients
  112. {max_clients, 1000000},
  113. %% Socket Access Control
  114. {access, [{allow, all}]},
  115. %% Connection Options
  116. {connopts, [
  117. %% Rate Limit. Format is 'burst, rate', Unit is KB/Sec
  118. %% {rate_limit, "100,10"} %% 100K burst, 10K rate
  119. ]},
  120. ...
  121. Test Client
  122. -----------
  123. .. code::
  124. sysctl -w net.ipv4.ip_local_port_range="500 65535"
  125. echo 1000000 > /proc/sys/fs/nr_open
  126. ----------------------
  127. emqtt Client Libraries
  128. ----------------------
  129. GitHub: https://github.com/emqtt
  130. +--------------------+----------------------+
  131. | `emqttc`_ | Erlang MQTT Client |
  132. +--------------------+----------------------+
  133. | `emqtt_benchmark`_ | MQTT benchmark Tool |
  134. +--------------------+----------------------+
  135. | `CocoaMQTT`_ | Swift MQTT Client |
  136. +--------------------+----------------------+
  137. | `QMQTT`_ | QT MQTT Client |
  138. +--------------------+----------------------+
  139. .. _emqttc: https://github.com/emqtt/emqttc
  140. .. _emqtt_benchmark: https://github.com/emqtt/emqtt_benchmark
  141. .. _CocoaMQTT: https://github.com/emqtt/CocoaMQTT
  142. .. _QMQTT: https://github.com/emqtt/qmqtt