Command Line Interface

This page introduces all kinds of startup and administrative commands supported by EMQX and gives detailed introductions to ctl administrative commands.

Startup Commands

EMQX supports some basic startup and administrative commands, which can be executed using the emqx <command> command.

Here are some commonly used startup and administrative commands:

CommandDescription
startStart EMQX in daemon mode, without requiring an interactive shell during runtime.
consoleStart EMQX in Erlang or Elixir interactive shell. Used for debugging EMQX in a development environment, requiring interaction with EMQX.
foregroundStart EMQX in foreground mode, without using an interactive shell. Used to start EMQX in a development environment without running it in the background.
stopStop the running EMQX node.
ctlManage and monitors EMQX. Executing emqx ctl help can get more detailed information.

The following are advanced commands for development and debugging, and ordinary users usually don’t need to care about them:

CommandDescription
remote_consoleConnect to the interactive shell of a remote EMQX node.
attachAttach to a running EMQX node to perform interactive operations.
ertspathRetrieve the path of the EMQX Erlang library.
root_dirRetrieve the path of the EMQX root directory.
pidRetrieve the process ID of the running EMQX node.
pingCheck if the EMQX node is running.
check_configValidate if the EMQX configuration file is correct.
console_cleanClear the output of the interactive shell console.
escriptExecute an Escript script on the EMQX node.

The ctl Commands

The EMQX ctl command provides multiple subcommands for managing and monitoring EMQX. The ctl command needs to be run after the EMQX service is started.

EMQX also provides emqx_ctl command, which is an alias of emqx ctl. The ctl command remotely connects to the specified EMQX node by starting a hidden Erlang node, executes an Erlang remote call, and then prints the returned result. Therefore, it is advised to avoid excessive usage of the ctl command.

Below is a list of all the subcommands of the ctl command along with their brief descriptions. This section aims to introduce the functionality of the commands, while detailed parameter information can be viewed using the help command.

status

This command is a quick inspection to see if the broker is up and running.

  1. $ emqx ctl status
  2. Node 'emqx@127.0.0.1' 5.0.3 is started

broker

This command is to inspect the local broker running status, statistics and metrics.

  1. $ emqx ctl broker
  2. sysdescr : EMQX Enterprise
  3. version : 5.0.3
  4. datetime : 2023-05-12T10:21:50.095047713+08:00
  5. uptime : 52 seconds

observer

This command provides Erlang virtual machine insights including a realtime view like linux’s top command. Subcommands are as follows:

CommandDescription
observer statusLaunch the observer in the current console, used to monitor and debug the status and activities of the EMQX node.
observer bin_leakForce all processes to perform garbage collection and prints the top 100 processes that release the maximum amount of binary data, potentially revealing potential memory leak issues.
observer load ModEnsure that the specified module is loaded on all nodes in the EMQX cluster. This command can be used to load modules when it is necessary to ensure that they are available throughout the entire cluster.

observer status

  1. emqx ctl observer status

observer bin_leak

  1. $ emqx ctl observer bin_leak
  2. {<0.2140.0>,-48,
  3. [{current_function,{logger_std_h,file_ctrl_loop,1}},
  4. {initial_call,{erlang,apply,2}}]}
  5. {<0.2093.0>,-29,
  6. [{current_function,{application_master,main_loop,2}},
  7. {initial_call,{proc_lib,init_p,5}}]}
  8. {<0.2116.0>,-23,
  9. [user_drv,
  10. {current_function,{user_drv,server_loop,6}},
  11. {initial_call,{user_drv,server,2}}]}
  12. ...

observer load Mod

  1. $ emqx ctl observer load Mod
  2. Loaded 'Mod' module on []: ok

conf cluster_sync

This command is mostly for troubleshooting when there is something wrong with cluster-calls used to sync configuration changes between the nodes in the cluster.

TIP

In EMQX 5.0.x, this command was named cluster_call. This old command is still available in EMQX 5.1 but it is not displayed in the help information.

EMQX HTTP API can be used to modify many configurations. When an API is called, for example, through operations in the Dashboard, the node receiving the request first writes the modified content locally to data/configs/cluster.hocon. Then, the same operation is recorded in the database and asynchronously forwarded to other nodes in the cluster.

If for some reason, this replication can not apply in a peer node, this command can be used to inspect and even fix the replication so it can move forward.

EMQX generates an ID (tnxid) for each configuration modification within the cluster scope. This ID strictly increases within the cluster scope, and every modification, such as changing a configuration from the Dashboard, is recorded in the database. The following example shows viewing the content of the second modification (tnxid=2), which is an operation to enable a TLS listener.

  1. $ emqx ctl conf cluster_sync tnxid 2
  2. {atomic,#{created_at => {{2022,6,21},{21,57,50}},
  3. initiator => 'emqx@127.0.0.1',
  4. mfa =>
  5. {emqx,update_config,
  6. [[listeners,ssl,default],
  7. {action,stop,#{<<"enabled">> => false}},
  8. #{override_to => cluster,rawconf_with_defaults => true}]},
  9. tnx_id => 2}}

TIP

The skip and fast_forward commands may result in diverged configs between the nodes in the cluster.

admins

The admins command can be used to create, update or delete administrative users. It has the following subcommands:

CommandDescription
admins add <Username> <Password> <Description>Add a Dashboard user.
admins passwd <Username> <Password>Reset the password for a specific Dashboard user.
admins del <Username>Delete a specific Dashboard user.

admins add <Username> <Password> <Description>

  1. $ emqx ctl admins add emqx_u EMQemq@1172
  2. ok

admins passwd <Username> <Password>

  1. $ emqx ctl admins passwd emqx_u EMQemq@11721
  2. ok

admins del <Username>

  1. $ emqx ctl admins del emqx_u
  2. ok

retainer

The retainer command can be used to inspect or manage retained messages. It also comes with a emqx ctl retainer reindex command which can be used to create or update indices for retained messages.

CommandDescription
retainer infoDisplay the number of retained messages.
retainer topicsDisplay all topics with retained messages.
retainer cleanClear all retained messages.
retainer clean <Topic>Clear retained messages according to the specific topic filter.
retainer reindex statusDisplay the status of reindexing process.
retainer reindex start [force]Generate a new index for retained message topics based on the configuration settings. Pass true as the <force> parameter to ignore any previously started reindexing process.

retainer info

  1. $ emqx ctl retainer info
  2. Number of retained messages: 3

retainer topics

  1. $ emqx ctl retainer topics
  2. $SYS/brokers
  3. $SYS/brokers/emqx@127.0.0.1/sysdescr
  4. $SYS/brokers/emqx@127.0.0.1/version

retainer clean

  1. emqx ctl retainer clean

retainer clean <Topic>

  1. emqx ctl retainer clean t/1

retainer reindex status

  1. $ emqx ctl retainer reindex status
  2. Reindexing is not running

retainer reindex start [force]

  1. $ emqx ctl retainer reindex start true
  2. Starting reindexing
  3. Reindexed 0 messages
  4. Reindexing finished

cluster

This command is used to view and manage the cluster status of nodes.

Note that the join command in EMQX for joining a cluster is a “request” sent to the node specified in the parameters, rather than an “invitation”. In other words, the command emqx ctl cluster join <OneOfTheClusteredNodes> is used to send a request to join the cluster of the node specified by <OneOfTheClusteredNodes>, rather than having that node join its own cluster.

CommandDescriptionUse cases and Considerations
emqx ctl clusterCommand for cluster control of EMQX.
cluster join <Node>Join a cluster.- Use this command to join a node to the EMQX cluster where the specified node is located.
- Ensure that the specified node is active and accessible.
cluster leaveLeave the cluster.- Use this command to remove the node from the current EMQX cluster.
cluster force-leave <Node>Forcefully remove a node from the cluster.- Use this command to forcefully remove the specified node from the EMQX cluster.
- Note that this operation may cause cluster state inconsistency, so use it with caution.
cluster status [—json]View the cluster status.- Use this command to view the status of the EMQX cluster.
- The optional —json parameter displays the cluster status in JSON format.
- Useful for monitoring and debugging the health of the cluster.

cluster join <Node>

  1. $ emqx ctl cluster join emqx2@127.0.0.1
  2. Failed to join the cluster: {node_down,'emqx2@127.0.0.1'}

cluster leave

  1. $ emqx ctl cluster leave
  2. Failed to leave the cluster: node_not_in_cluster

cluster force-leave <Node>

  1. $ emqx ctl cluster force-leave emqx2@127.0.0.1
  2. Failed to remove the node from cluster: node_not_in_cluster

cluster status [—json]

  1. $ emqx ctl cluster status
  2. Cluster status: #{running_nodes => ['emqx@127.0.0.1'],stopped_nodes => []}
  1. $ emqx ctl cluster status --json
  2. {
  3. "stopped_nodes" : [
  4. ],
  5. "running_nodes" : [
  6. "emqx@127.0.0.1"
  7. ]
  8. }

clients

This command is to view and manage connected clients.

CommandDescription
clients listView all clients currently connected to EMQX. This command can be used to monitor active clients and the number of connections.
clients show <ClientId>View detailed connection information for a specific client.
clients kick <ClientId>Forcefully disconnect a specified client.

emqx ctl clients list

  1. $ emqx ctl clients list
  2. Client(emqx_c, username=undefined, peername=127.0.0.1:59441, clean_start=true, keepalive=60, session_expiry_interval=0, subscriptions=1, inflight=0, awaiting_rel=0, delivered_msgs=4530, enqueued_msgs=0, dropped_msgs=0, connected=true, created_at=1684736435155, connected_at=1684736435155)
  3. Client(emqx_a, username=undefined, peername=127.0.0.1:59444, clean_start=true, keepalive=60, session_expiry_interval=0, subscriptions=1, inflight=0, awaiting_rel=0, delivered_msgs=4588, enqueued_msgs=0, dropped_msgs=0, connected=true, created_at=1684736441613, connected_at=1684736441613)

emqx ctl clients show <ClientId>

  1. $ emqx ctl clients show emqx_c
  2. Client(emqx_c, username=undefined, peername=127.0.0.1:59441, clean_start=true, keepalive=60, session_expiry_interval=0, subscriptions=1, inflight=0, awaiting_rel=0, delivered_msgs=4680, enqueued_msgs=0, dropped_msgs=0, connected=true, created_at=1684736435155, connected_at=1684736435155)

emqx ctl clients kick <ClientId>

  1. $ emqx ctl clients kick emqx_c
  2. ok

TIP

If a large number of clients are connected to the system, the list command may be time-consuming and resource-intensive.

topics

This command is to view all subscribed topics in current system.

CommandDescription
topics listList all topics. This command can be used to monitor the number and distribution of topics.
topics show <Topic>Show detailed information about a specific topic.

topics list

  1. $ emqx ctl topics list
  2. t/1 -> emqx@127.0.0.1

topics show <Topic>

  1. $ emqx ctl topics show t/1
  2. t/1 -> emqx@127.0.0.1

TIP

If there are a large number of topic subscriptions in the cluster, the list command may be time-consuming and resource-intensive.

subscriptions

This command is to view, add or delete clients’ subscriptions.

CommandDescription
subscriptions listList all subscriptions.
subscriptions show <ClientId>Show subscriptions for a specific client.
subscriptions add <ClientId> <Topic> <QoS>Mannually add a subscription.
subscriptions del <ClientId> <Topic>Manually remove a subscription.

subscriptions list

  1. $ emqx ctl subscriptions list
  2. emqx_a -> topic:t/1 qos:0 nl:0 rh:0 rap:0
  3. emqx_c -> topic:t/1 qos:0 nl:0 rh:0 rap:0

subscriptions show <ClientId>

  1. $ emqx ctl subscriptions show emqx_a
  2. emqx_a -> topic:t/1 qos:0 nl:0 rh:0 rap:0

subscriptions add <ClientId> <Topic> <QoS>

  1. $ emqx ctl subscriptions add emqx_a t/1 1
  2. ok

subscriptions del <ClientId> <Topic>

  1. $ emqx ctl subscriptions del emqx_a t/1
  2. ok

TIP

When there are a large number of subscriptions in the system, the list command may be time-consuming and resource-intensive.

plugins

This command is used to view and manage plugin installation.

CommandDescription
plugins listList all installed plugins.
plugins describe <Name-Vsn>Display detailed information about an installed plugin.
plugins install <Name-Vsn>Install a plugin package that is located in the plugin installation directory.
plugins uninstall <Name-Vsn>Uninstall a specified plugin.
plugins start <Name-Vsn>Start a specified plugin.
plugins stop <Name-Vsn>Stop a specified plugin.
plugins restart <Name-Vsn>Restart a specified plugin.
plugins disable <Name-Vsn>Disable automatic startup of a plugin.
plugins enable <Name-Vsn> [Position]Enable automatic startup of a plugin and specify the startup position.

plugins list

  1. emqx ctl plugins list

plugins describe <Name-Vsn>

  1. emqx ctl plugins describe emqx_auth_mnesia-3.0.1

plugins install <Name-Vsn>

  1. emqx ctl plugins install emqx_auth_mnesia-3.0.1

plugins uninstall <Name-Vsn>

  1. emqx ctl plugins uninstall emqx_auth_mnesia-3.0.1

plugins start <Name-Vsn>

  1. emqx ctl plugins start emqx_auth_mnesia-3.0.1

plugins stop <Name-Vsn>

  1. emqx ctl plugins stop emqx_auth_mnesia-3.0.1

plugins restart <Name-Vsn>

  1. emqx ctl plugins restart emqx_auth_mnesia-3.0.1

plugins disable <Name-Vsn>

  1. emqx ctl plugins disable emqx_auth_mnesia-3.0.1

plugins enable <Name-Vsn> [Position]

  1. emqx ctl plugins enable emqx_auth_mnesia-3.0.1 front

You can use front, rear, or before Other-Vsn to specify a relative position for adjusting the startup order. If no Position is provided, the configured plugins will remain in their original positions, and the new plugin will be appended at the end.

vm

Inspect statistic data collected from the Erlang virtual machine.

  1. $ emqx ctl vm
  2. cpu/load1 : 13.16
  3. cpu/load5 : 11.95
  4. cpu/load15 : 9.75
  5. memory/total : 127648904
  6. memory/processes : 30427456
  7. memory/processes_used : 30426744
  8. memory/system : 97221448
  9. memory/atom : 2277809
  10. memory/atom_used : 2259843
  11. memory/binary : 668072
  12. memory/code : 48748792
  13. memory/ets : 10725432
  14. process/limit : 2097152
  15. process/count : 626
  16. io/max_fds : 8192
  17. io/active_fds : 0
  18. ports/count : 27
  19. ports/limit : 1048576

mnesia

This command is used to view the running status and metrics of the built-in database (Mnesia).

  1. $ emqx ctl mnesia
  2. ===> System info in version "4.20.4.1", debug level = none <===
  3. opt_disc. Directory "/Users/emqx/Downloads/emqx-503/data/mnesia/emqx@127.0.0.1" is used.
  4. use fallback at restart = false
  5. running db nodes = ['emqx@127.0.0.1']
  6. stopped db nodes = []
  7. master node tables = []
  8. backend types = null_copies - mria_mnesia_null_storage
  9. rocksdb_copies - mnesia_rocksdb
  10. remote = []
  11. ram_copies = [bpapi,emqx_channel_registry,
  12. emqx_ee_schema_registry_serde_tab,
  13. emqx_exclusive_subscription,
  14. emqx_gateway_coap_channel_registry,emqx_retainer_index,
  15. emqx_retainer_index_meta,emqx_retainer_message,
  16. emqx_route,emqx_routing_node,emqx_shared_subscription,
  17. emqx_trie,mria_schema]
  18. disc_copies = [cluster_rpc_commit,cluster_rpc_mfa,emqx_acl,
  19. emqx_activated_alarm,emqx_admin,emqx_admin_jwt,emqx_app,
  20. emqx_authn_mnesia,emqx_banned,emqx_dashboard_monitor,
  21. emqx_deactivated_alarm,emqx_delayed,
  22. emqx_enhanced_authn_scram_mnesia,emqx_psk,
  23. emqx_telemetry,emqx_trace,schema]
  24. disc_only_copies = []
  25. [{'emqx@127.0.0.1',disc_copies}] = [schema,emqx_psk,emqx_delayed,emqx_app,
  26. emqx_admin_jwt,emqx_dashboard_monitor,
  27. emqx_admin,cluster_rpc_mfa,
  28. cluster_rpc_commit,emqx_acl,
  29. emqx_enhanced_authn_scram_mnesia,
  30. emqx_authn_mnesia,emqx_banned,
  31. emqx_activated_alarm,
  32. emqx_deactivated_alarm,emqx_telemetry,
  33. emqx_trace]
  34. [{'emqx@127.0.0.1',ram_copies}] = [mria_schema,emqx_trie,
  35. emqx_shared_subscription,emqx_routing_node,
  36. emqx_route,emqx_exclusive_subscription,
  37. bpapi,emqx_channel_registry,
  38. emqx_retainer_index_meta,
  39. emqx_retainer_message,emqx_retainer_index,
  40. emqx_ee_schema_registry_serde_tab,
  41. emqx_gateway_coap_channel_registry]
  42. 414 transactions committed, 32 aborted, 6 restarted, 250 logged to disc
  43. 0 held locks, 0 in queue; 0 local transactions, 0 remote
  44. 0 transactions waits for other nodes: []

log

This command can be used to manage log handlers states, such as setting logging level etc.

CommandDescription
log set-level <Level>Set the overall log level.
log primary-levelShow the current primary log level. primary-level represents the primary log level of EMQX, which is used to specify the default log level for the entire system. Setting primary-level will affect all log outputs unless specific log handlers have their own independent log levels.
log primary-level <Level>Set the primary log level.
log handlers listShow the log handlers. handlers refer to the collection of log handlers used for handling logs. Each log handler can set its own log level independently and define how to handle and store log messages.
log handlers start <HandlerId>Start a specific handler.
log handlers stop <HandlerId>Stop a specific handler。
log handlers set-level <HandlerId> <Level>Set the log level for a specific handler.

log set-level <Level>

  1. $ emqx ctl log set-level debug
  2. debug

log primary-level

  1. $ emqx ctl log primary-level
  2. debug

log primary-level <Level>

  1. $ emqx ctl log primary-level info
  2. info

log handlers list

  1. $ emqx ctl log handlers list
  2. LogHandler(id=ssl_handler, level=debug, destination=console, status=started)
  3. LogHandler(id=console, level=debug, destination=console, status=started)

log handlers start <HandlerId>

  1. $ emqx ctl log handlers start console
  2. log handler console started

log handlers stop <HandlerId>

  1. $ emqx ctl log handlers stop console
  2. log handler console stopped

log handlers set-level <HandlerId> <Level>

  1. $ emqx ctl log handlers set-level console debug
  2. debug

trace and traces

This command is used to trace (and log) events of a given client or topic etc.

CommandDescription
trace listList all traces started on the local node.
trace start client <ClientId> <File> [<Level>]Start tracing for a specific client.
trace stop client <ClientId>Stop tracing for a specific client.
trace start topic <Topic> <File> [<Level>]Start tracing for a specific topic.
trace stop topic <Topic>Stop tracing for a specific topic.
trace start ip_address <IP> <File> [<Level>]Start tracing for a specific client IP address.
trace stop ip_address <IP>Stop tracing for a specific client IP address.

trace list

  1. $ emqx ctl trace list
  2. Trace(ip_address=127.0.0.1, level=debug, destination="trace.log")

trace start client <ClientId> <File> [<Level>]

  1. $ emqx ctl trace start client emqx_c trace.log debug
  2. trace emqx_c CLI-emqx_c successfully

trace stop client <ClientId>

  1. $ emqx ctl trace stop client emqx_c
  2. stop tracing clientid emqx_c successfully

trace start topic <Topic> <File> [<Level>]

  1. $ emqx ctl trace start topic t/1 trace.log info
  2. trace t/1 CLI-t/1 successfully

trace stop topic <Topic>

  1. $ emqx ctl trace stop topic t/1
  2. stop tracing topic t/1 successfully

trace start ip_address <IP> <File> [<Level>]

  1. $ emqx ctl trace start ip_address 127.0.0.1 trace.log debug
  2. trace 127.0.0.1 CLI-127.0.0.1 successfully

trace stop ip_address <IP>

  1. $ emqx ctl trace stop ip_address 127.0.0.1
  2. stop tracing ip_address 127.0.0.1 successfully

TIP

It’s recommended to use absolute paths for trace log files when start from command line. emqx ctl trace start client foobar /abs/path/to/trace.log debug

TIP

You can also manage traces from the dashboard UI. See tracer.

emqx ctl traces

This command is like the trace command, but applies on all nodes in the cluster.

traces

This command is similar to the trace command, but it starts or stops a tracer across all nodes in the cluster. Refer to the previous trace command for details.

listeners

This command is used to manage listeners.

CommandDescription
listenersList information of all listeners.
listeners stop <Identifier>Stop a listener. Identifier is in the format {type}:{name}, e.g., tcp:default.
listeners start <Identifier>Start a listener.
listeners restart <Identifier>Restart a listener.

listeners

  1. $ emqx ctl listeners
  2. ssl:default
  3. listen_on : 0.0.0.0:8883
  4. acceptors : 16
  5. proxy_protocol : false
  6. running : true
  7. current_conn : 0
  8. max_conns : 5000000
  9. tcp:default
  10. listen_on : 0.0.0.0:1883
  11. acceptors : 16
  12. proxy_protocol : false
  13. running : true
  14. current_conn : 12
  15. max_conns : 5000000
  16. ws:default
  17. listen_on : 0.0.0.0:8083
  18. acceptors : 16
  19. proxy_protocol : false
  20. running : true
  21. current_conn : 0
  22. max_conns : 5000000
  23. wss:default
  24. listen_on : 0.0.0.0:8084
  25. acceptors : 16
  26. proxy_protocol : false
  27. running : true
  28. current_conn : 0
  29. max_conns : 5000000

listeners stop <Identifier>

  1. $ emqx ctl listeners stop tcp:default
  2. Stop tcp:default listener successfully.

listeners start <Identifier>

  1. $ emqx ctl listeners start tcp:default
  2. Started tcp:default listener successfully.

listeners restart <Identifier>

  1. $ emqx ctl listeners restart tcp:default
  2. Restarted tcp:default listener successfully.

TIP

Stopping or restarting a listener causes all the connected clients to disconnect.

authz cache-clean

emqx ctl authz cache-clean

This command is useful when you want to force evict cached authz (ACL) data.

pem_cache

emqx ctl pem_cache

This command is to force EMQX reload updated pem (x509 keys and certificates) files after for example a certificate renewal.

olp

emqx ctl olp

OLP stands for overload protection. The olp command is to check overload status, and also the enable/disabled system overload protection.

For more details, see overload_protection configuration doc.

TIP

olp is not enabled by default, enabling from CLI does not persist it to the configs.

gateway-registry

emqx ctl gateway-registry

List the registered gateways in the system.

Currently there are by default 5 registered gateways:

  • coap
  • exproto
  • lwm2m
  • mqttsn
  • stomp

EMQX is designed to be plugable, so that more gateways can be installed as pluginsand register to EMQX at runtime. Once registered, a gateway can be managed with management APIs and CLIs (see gateway command below).

gatewa

This command can be used to inspect or manage gateway loading/running status.

CommandDescriptio
gateway listList information of all gateways.
gateway lookup <Name>Look up detailed information of a specific gateway.
gateway load <Name> <JsonConf>Load a gateway and configure its parameters.
gateway unload <Name>Unload a gateway.
gateway stop <Name>Stop a gateway.
gateway start <Name>Start a gateway.

gateway list

  1. $ emqx ctl gateway list
  2. Gateway(name=coap, status=running, clients=0, started_at=2023-05-22T14:23:50.353+08:00)
  3. Gateway(name=exproto, status=unloaded)
  4. Gateway(name=lwm2m, status=unloaded)
  5. Gateway(name=mqttsn, status=unloaded)
  6. Gateway(name=stomp, status=unloaded)

gateway lookup <Name>

  1. $ emqx ctl gateway lookup coap
  2. name: coap
  3. status: running
  4. created_at: 2023-05-22T14:23:50.352+08:00
  5. started_at: 2023-05-22T14:23:50.353+08:00
  6. config: #{connection_required => false,enable => true,enable_stats => true,
  7. heartbeat => 30000,idle_timeout => 30000,
  8. listeners =>
  9. #{udp =>
  10. #{default =>
  11. #{access_rules => [],bind => 5683,enable => true,
  12. enable_authn => true,max_conn_rate => 1000,
  13. max_connections => 1024000,
  14. udp_options =>
  15. #{active_n => 100,reuseaddr => true}}}},
  16. mountpoint => <<>>,notify_type => qos,publish_qos => coap,
  17. subscribe_qos => coap}

gateway load <Name> <JsonConf>

  1. emqx ctl gateway load coap '{"type":"coap", ...}'

gateway unload <Name>

  1. $ emqx ctl gateway unload coap
  2. ok

gateway stop <Name>

  1. $ emqx ctl gateway stop coap
  2. ok

gateway start <Name>

  1. $ emqx ctl gateway start coap
  2. ok

gateway-metrics

Inspect gateway metrics.

rules

This command is used to list rules crated in the Rule Engine.

CommandDescription
rules listList all rules, including information such as rule ID, name and etc.
rules show <RuleID>Display the detailed information of a specific rule.

Note that below is an example of the execution of each rule:

rules list

  1. $ emqx ctl rules list
  2. Rule{id=my-rule, name=, enabled=true, descr=this is my rule}

rules show <RuleID>

  1. $ emqx ctl rules show my-rule
  2. Id:
  3. my-rule
  4. Name:
  5. Description:
  6. this is my rule
  7. Enabled:
  8. true
  9. SQL:
  10. SELECT
  11. *
  12. FROM
  13. "f/#"
  14. Created at:
  15. 2023-05-22T14:14:27.567+08:00
  16. Updated at:
  17. 2023-05-22T14:14:27.567+08:00
  18. Actions:
  19. - Name: republish
  20. Type: function
  21. Args: #{payload => <<>>,qos => 0,retain => false,topic => <<"t/1">>,
  22. user_properties => <<"${user_properties}">>}

CLI is only for inspection, Rule and action managements are managed from dashboard.

{%emqxee%}

license

CommandDescription
license infoDisplay License information.
license update LicenseUpdat License information.

license info

  1. $ emqx ctl license info
  2. customer : Evaluation
  3. email : contact@emqx.io
  4. deployment : default
  5. max_connections : 100
  6. start_at : 2023-01-09
  7. expiry_at : 2028-01-08
  8. type : trial
  9. customer_type : 10
  10. expiry : false

license update License

  1. emqx ctl license update <YOUR_LICENSE_STRING>

You need to replace YOUR_LICENSE_STRING with the actual License string.

{%endemqxee%}