getstarted.rst 5.1 KB

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