Car insurance recommendations?

hi im 16 and trying very hard to get emancipated i havent told my mom yet though because it seems like a great idea not to get kicked out first, but anyways i have locked in a steady job at a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to Install an MQTT Broker on Ubuntu

EMQX supports running on Linux, Windows, macOS, Raspbian and other operating systems, and also supports deployment with Docker, Kubernetes and Terraform. This article will take EMQX 5.0.4 as an example to introduce how to build a single-node MQTT broker on Ubuntu, and demonstrate the common problems encountered during the building process.

The operating system used for this demonstration is Ubuntu 20.04 64-bit.

APT is the package manager that comes with Ubuntu. It is recommended to prefer to install EMQX with APT. At the same time, EMQX also provides the official APT source and one click configuration script to help users quickly install EMQX.

Copy the above command to the Ubuntu terminal and execute it. The following figure indicates successful configuration.

2. Install the latest version of EMQX.

3. After successful installation, use the following command to start EMQX.

4. EMQX management command

EMQX provides command line tools to help users start, close and enter the console. As shown in the figure below, execute sudo emqx on the terminal to view all management commands.

When the server has no public network access or needs to quickly deploy and verify the EMQX function, tag.gz package can be used for installation, which is independent of any third party and easy to manage.

Paste the download command to the ubuntu terminal and perform the download operation.

Execute the following command on the server terminal, extracting the compressed package to the emqx directory under the current directory.

Next, use the following command to start EMQX

Use the command netstat -tunlp to check the operation of the EMQX port. By default, EMQX will start the following ports. Check the port occupancy in case of exceptions.

EMQX provides a Dashboard for users to manage and monitor EMQX and configure required functions through Web pages. The Dashboard can be accessed via a browser at http://localhost:18083/ (Replace the localhost with the actual IP address) after EMQX has been successfully started.

The default user name of Dashboard is admin, and the password is public. After the first successful login, you will be prompted to change the password.

Next, click the WebSocket Client in the left menu bar, which can test MQTT over Websocket to verify whether the MQTT broker has been successfully deployed.

As shown in the figure below, the tool has automatically filled in the host according to the access address. We can click the Connect button directly.

The figure below indicates successful connection.

Subscribe to a testtopic as shown in the figure below.

As shown in the figure below, we have published two messages to testtopic which have been received successfully, indicating that the MQTT broker has been successfully deployed and is running normally.

So far, we have completed the building and connection test of the MQTT broker, but the server can be used for testing only. To deploy the MQTT broker available in the production environment, we also need to perform the most important authentication configuration.

By default, EMQX will allow any client connection until the user creates an authenticator which will authenticate a client according to the authentication information provided by the client. A client can connect successfully only when it passes the authentication. Next, we will demonstrate how to use the built-in database of EMQX for authentication of username and password.

EMQX has supported the authentication configuration in Dashboard since version 5.0, allowing users to create secure MQTT services more conveniently and quickly. Click Authentication under the Access Control menu to enter the Authentication Configuration page, and then click the Create button on the far right.

Select the Password-Based option, and then click Next.

Select Built-in Database for the database and click Next.

Next, select the UserID Type, Password Hash and Salt Position, then click Create.

The figure below shows the successful creation of the authentication. Next, click Users to add a user.

After entering the User Management page, click the Add button on the far right, set the Username and Password in the pop-up box, and then click Save.

The figure below shows the successful creation.

Next, we use the Websocket tool provided by Dashboard to test whether the authentication has been successfully configured. Enter the username and password you just created in the Connect configuration, and then click Connect. A pop-up window on the right indicates that it is connected.

Next, use the user name test1 that has not been created. Click Connect, and you will see the following Connection Failed information.

Add a comment

Related posts:

Create an Index Using IEX API Stock Market Data

Tech industry is booming. Investing in GAFA companies (Google, Apple, Amazon, Facebook) are seen as investing in ‘growth stocks’, where returns have been stellar and putting on smiles on investors’…

About mobile phone in the world

Our happy world is growing with innovation, change in correspondence has turned the world into a global city, a city around the world where we can stay connected day and night, share our feelings…

C12 Has Turned Out To Be A Ponzi Scheme

A little over one and a half months ago, I wrote an article about C12, a company that claimed to be an investment opportunity where you could earn a 44% net return every 12 working days. Initially…