emqxarchive / emqx-docker

This repository is no longer maintained, please go to https://github.com/emqx/emqx-rel/tree/master/deploy/docker
Apache License 2.0
235 stars 162 forks source link

./bin/emqx_ctl users CLI not found and start error #142

Open moluzhui opened 4 years ago

moluzhui commented 4 years ago

Make sure you read and understand http://emqtt.io/docs/v2/index.html. Use one of the two templates below and delete the rest.


BUG REPORT

Expected behavior

CLI add username and password

Actual behavior

not found users command

/opt/emqx $ ./bin/emqx_ctl users add test test
Usage: emqx_ctl
--------------------------------------------------------------------------------
mgmt list                                       # List Applications
mgmt insert <AppId> <Name>                      # Add Application of REST API
mgmt update <AppId> <status>                    # Update Application of REST API
mgmt lookup <AppId>                             # Get Application of REST API
mgmt delete <AppId>                             # Delete Application of REST API
--------------------------------------------------------------------------------
status                                          # Show broker status
--------------------------------------------------------------------------------
broker                                          # Show broker version, uptime and description
broker stats                                    # Show broker statistics of clients, topics, subscribers
broker metrics                                  # Show broker metrics
--------------------------------------------------------------------------------
cluster join <Node>                             # Join the cluster
cluster leave                                   # Leave the cluster
cluster force-leave <Node>                      # Force the node leave from cluster
cluster status                                  # Cluster status
--------------------------------------------------------------------------------
acl reload                                      # reload etc/acl.conf
--------------------------------------------------------------------------------
clients list                                    # List all clients
clients show <ClientId>                         # Show a client
clients kick <ClientId>                         # Kick out a client
--------------------------------------------------------------------------------
sessions list                                   # List all sessions
sessions show <ClientId>                        # Show a session
sessions clean-persistent <ClientId>            # Clean a persistent session
--------------------------------------------------------------------------------
routes list                                     # List all routes
routes show <Topic>                             # Show a route
--------------------------------------------------------------------------------
subscriptions list                              # List all subscriptions
subscriptions show <ClientId>                   # Show subscriptions of a client
subscriptions add <ClientId> <Topic> <QoS>      # Add a static subscription manually
subscriptions del <ClientId> <Topic>            # Delete a static subscription manually
--------------------------------------------------------------------------------
plugins list                                    # Show loaded plugins
plugins load <Plugin>                           # Load plugin
plugins unload <Plugin>                         # Unload plugin
plugins reload <Plugin>                         # Reload plugin
--------------------------------------------------------------------------------
vm all                                          # Show info of Erlang VM
vm load                                         # Show load of Erlang VM
vm memory                                       # Show memory of Erlang VM
vm process                                      # Show process of Erlang VM
vm io                                           # Show IO of Erlang VM
vm ports                                        # Show Ports of Erlang VM
--------------------------------------------------------------------------------
mnesia                                          # Mnesia system info
--------------------------------------------------------------------------------
log set-level <Level>                           # Set the overall log level
log primary-level                               # Show the primary log level now
log primary-level <Level>                       # Set the primary log level
log handlers list                               # Show log handlers
log handlers set-level <HandlerId> <Level>      # Set log level of a log handler
--------------------------------------------------------------------------------
trace list                                      # List all traces started
trace start client <ClientId> <File> [<Level>]  # Traces for a client
trace stop  client <ClientId>                   # Stop tracing for a client
trace start topic  <Topic>    <File> [<Level>]  # Traces for a topic
trace stop  topic  <Topic>                      # Stop tracing for a topic
--------------------------------------------------------------------------------
listeners                                       # List listeners
listeners stop    <Proto> <Port>                # Stop a listener
--------------------------------------------------------------------------------
recon memory                                    # recon_alloc:memory/2
recon allocated                                 # recon_alloc:memory(allocated_types, current|max)
recon bin_leak                                  # recon:bin_leak(100)
recon node_stats                                # recon:node_stats(10, 1000)
recon remote_load Mod                           # recon:remote_load(Mod)
--------------------------------------------------------------------------------
retainer info                                   # Show the count of retained messages
retainer topics                                 # Show all topics of retained messages
retainer clean                                  # Clean all retained messages
retainer clean <Topic>                          # Clean retained messages by the specified topic filter
--------------------------------------------------------------------------------
bridges list                                    # List bridges
bridges start <Name>                            # Start a bridge
bridges stop <Name>                             # Stop a bridge
bridges forwards <Name>                         # Show a bridge forward topic
bridges add-forward <Name> <Topic>              # Add bridge forward topic
bridges del-forward <Name> <Topic>              # Delete bridge forward topic
bridges subscriptions <Name>                    # Show a bridge subscriptions topic
bridges add-subscription <Name> <Topic> <Qos>   # Add bridge subscriptions topic
bridges del-subscription <Name> <Topic>         # Delete bridge subscriptions topic

There is no command line for the user

EMQ emqx_auth_username.conf error

New content is as follows:

##--------------------------------------------------------------------
## Username Authentication Plugin
##--------------------------------------------------------------------

## Password hash.
##
## Value: plain | md5 | sha | sha256
auth.user.password_hash = sha256
auth.user.1.username = admin
auth.user.1.password = public

./bin/emqx restart error is as follows

/opt/emqx $ ./bin/emqx restart
2020-03-16T03:43:40.061466+00:00 [error] You've tried to set auth.user.1.username, but there is no setting with that name.
2020-03-16T03:43:40.061639+00:00 [error] Did you mean one of these?
2020-03-16T03:43:40.115978+00:00 [error] auth.mysql.username
2020-03-16T03:43:40.116044+00:00 [error] mqtt.sn.username
2020-03-16T03:43:40.116089+00:00 [error] cube.username
2020-03-16T03:43:40.116295+00:00 [error] You've tried to set auth.user.1.password, but there is no setting with that name.
2020-03-16T03:43:40.116359+00:00 [error] Did you mean one of these?
2020-03-16T03:43:40.173687+00:00 [error] auth.mysql.password
2020-03-16T03:43:40.173753+00:00 [error] auth.user.password_hash
2020-03-16T03:43:40.173799+00:00 [error] mqtt.sn.password
2020-03-16T03:43:40.214559+00:00 [error] Error generating configuration in phase transform_datatypes
2020-03-16T03:43:40.214636+00:00 [error] Conf file attempted to set unknown variable: auth.user.1.password
2020-03-16T03:43:40.214689+00:00 [error] Conf file attempted to set unknown variable: auth.user.1.username

EMQ version

Which branch are you on? If you know the Git revision then add it here as well.

emqx/emqx-edge:v3.2.4, which is a docker images

Docker version

Which docker-engine version?

docker -v
Docker version 18.09.3, build 774a1f4

System

What system do you use? Ubuntu 16.04.6 LTS

HJianBo commented 4 years ago

Hi, @moluzhui In the first, between v3.1-rc.2 with v3.2.6, We remove this feature that allowed to configure Authentication username and clientid from .conf files

So, if you want to use it, you should upgrade to the latest 3.x version or 4.x

Second, before using ./bin/emqx_ctl users add test test cmds, Plz ensure the emqx_auth_username plugins started sucessfully :)

moluzhui commented 4 years ago

Thanks for your answer. @HJianBo . If I want to emqx/emqx-edge:v3.2.4 set the username and password at startup, what should I do? and in which file should I view the username and password I set?

HJianBo commented 4 years ago

After the emqx started successfully, you can manage usernames with CLI or REST APIs

CLI
./bin/emqx_ctl users add usera passwd
./bin/emqx_ctl users del usera
REST APIs

See: https://github.com/emqx/emqx-auth-username/tree/develop-3.2#rest-api