getstarted.rst 5.2 KB

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