plugins 命令

plugins 命令用于加载、卸载、查询插件应用。EMQ X 通过插件扩展认证、定制功能,插件配置位于 etc/plugins/ 目录下。

命令描述
plugins list列出全部插件 (Plugin)
plugins load <Plugin>加载插件 (Plugin)
plugins unload <Plugin>卸载插件 (Plugin)
plugins reload <Plugin>重载插件 (Plugin)

当配置文件发生更改,如果需要配置立即生效,你可以执行 emqx_ctl reload <Plugin\> 命令,即使插件在配置修改时并未处于运行状态,你也应当使用此命令而不是emqx_ctl load <Plugin>,因为 `emqx_ctl load <Plugin> 不会编译新的配置文件。

plugins list

列出全部插件:

  1. $ ./bin/emqx_ctl plugins list
  2. Plugin (emqx_auth_clientid, version=v4.0.0, description=EMQ X Authentication with ClientId/Password, active=false)
  3. Plugin (emqx_auth_http, version=v4.0.0, description=EMQ X Authentication/ACL with HTTP API, active=false)
  4. Plugin (emqx_auth_jwt, version=v4.0.0, description=EMQ X Authentication with JWT, active=false)
  5. Plugin (emqx_auth_ldap, version=v4.0.0, description=EMQ X Authentication/ACL with LDAP, active=false)
  6. Plugin (emqx_auth_mongo, version=v4.0.0, description=EMQ X Authentication/ACL with MongoDB, active=false)
  7. Plugin (emqx_auth_mysql, version=v4.0.0, description=EMQ X Authentication/ACL with MySQL, active=false)
  8. Plugin (emqx_auth_pgsql, version=v4.0.0, description=EMQ X Authentication/ACL with PostgreSQL, active=false)
  9. Plugin (emqx_auth_redis, version=v4.0.0, description=EMQ X Authentication/ACL with Redis, active=false)
  10. Plugin (emqx_auth_username, version=v4.0.0, description=EMQ X Authentication with Username and Password, active=false)
  11. Plugin (emqx_bridge_mqtt, version=v4.0.0, description=EMQ X Bridge to MQTT Broker, active=false)
  12. Plugin (emqx_coap, version=v4.0.0, description=EMQ X CoAP Gateway, active=false)
  13. Plugin (emqx_dashboard, version=v4.0.0, description=EMQ X Web Dashboard, active=true)
  14. Plugin (emqx_delayed_publish, version=v4.0.0, description=EMQ X Delayed Publish, active=false)
  15. Plugin (emqx_lua_hook, version=v4.0.0, description=EMQ X Lua Hooks, active=false)
  16. Plugin (emqx_lwm2m, version=v4.0.0, description=EMQ X LwM2M Gateway, active=false)
  17. Plugin (emqx_management, version=v4.0.0, description=EMQ X Management API and CLI, active=true)
  18. Plugin (emqx_plugin_template, version=v4.0.0, description=EMQ X Plugin Template, active=false)
  19. Plugin (emqx_psk_file, version=v4.0.0, description=EMQX PSK Plugin from File, active=false)
  20. Plugin (emqx_recon, version=v4.0.0, description=EMQ X Recon Plugin, active=true)
  21. Plugin (emqx_reloader, version=v4.0.0, description=EMQ X Reloader Plugin, active=false)
  22. Plugin (emqx_retainer, version=v4.0.0, description=EMQ X Retainer, active=true)
  23. Plugin (emqx_rule_engine, version=v4.0.0, description=EMQ X Rule Engine, active=true)
  24. Plugin (emqx_sn, version=v4.0.0, description=EMQ X MQTT SN Plugin, active=false)
  25. Plugin (emqx_statsd, version=v4.0.0, description=Statsd for EMQ X, active=false)
  26. Plugin (emqx_stomp, version=v4.0.0, description=EMQ X Stomp Protocol Plugin, active=false)
  27. Plugin (emqx_web_hook, version=v4.0.0, description=EMQ X Webhook Plugin, active=false)

插件属性:

Name描述
version插件版本
description插件描述
active是否已加载

plugins load <Plugin>

加载插件:

  1. $ ./bin/emqx_ctl plugins load emqx_lua_hook
  2. Plugin emqx_lua_hook loaded successfully.

plugins unload <Plugin>

卸载插件:

  1. $ ./bin/emqx_ctl plugins unload emqx_lua_hook
  2. Plugin emqx_lua_hook unloaded successfully.

plugins reload <Plugin>

重载插件:

  1. $ ./bin/emqx_ctl plugins reload emqx_lua_hook
  2. Plugin emqx_lua_hook reloaded successfully.