Eclipse Hono as described in its official site, is an IoT connectivity platform that provides a unified API for connecting large number of IoT devices to a backend irrespective of the various communication protocols used by the devices. Hono offers out of the box support for devices communicating via protocols such as AMQP, COAP, HTTP and MQTT. Eclipse Hono comprises of several microservices, which are packaged as Docker containers and deployed in a container-orchestration system like Kubernetes.
The device registry is one among those components, where Hono keeps track of all its tenants, devices and device credentials. It is crucial to Hono as the protocol adapters uses the device registry to verify if a tenant and device are registered and enabled. In addition to that, the protocol adapters use the device registry to authenticate devices before accepting any telemetry, event or command response messages. The device registry also implements HTTP based device management APIs to manage the storage of tenants, devices and credentials information.
Until version 1.3.0, Hono offered only one device registry implementation, which used the underlying local file system to persist the data. This file based device registry served well its purpose as a demo device registry. However, it is not intended to use in production environments, as the components cannot easily be scaled out horizontally. Hence, the users had to implement their own device registry to use Hono in production setups. With the release of Hono 1.3.0, this has been take care of and you do not need to implement your own device registry to use Hono in production environments.
New MongoDB based device registry
Now Hono offers one more device registry implementation, which uses a MongoDB database to persist the data. Unlike the file based counterpart, this MongoDB based device registry is intended to be used in production and as well as in demo setups. It stores tenants, devices and credentials information in separate collections in the underlying MongoDB database. MongoDB supports scaling out horizontally using techniques such as sharding and data distribution. There by this registry can leverage the MongoDB’s scalability to scale out itself without any difficulties.
In addition, you can easily secure the HTTP endpoints in the MongoDB device registry using basic authentication mechanism. It means that the clients need to authenticate with the MongoDB based device registry by supplying a user name and password in order to manage tenants, devices and credentials. You can turn on or off the authentication mechanism by setting the configuration property
false. For more information on how to configure the MongoDB based device registry, please take a look at MongoDB based Device Registry configuration.
Install Eclipse Hono with MongoDB device registry using helm chart
The Eclipse IoT packages repository hosts helm charts, which you can use to install Hono in a Kubernetes cluster. By default, Hono’s helm chart deploys the file based device registry. I will show you how to install Hono with the MongoDB based device registry using Hono’s helm chart. I assume that you already have a running Kubernetes cluster.
The first step is to add the eclipse IoT packages chart repository using the below command. This command adds the repository using the name
Now use the below command to deploy Hono with the MongoDB based device registry to the namespace
As you can see above, I have set the value for the property
mongodb. This configures the chart to deploy the MongoDB based registry instead of the default file based registry.
In the above command, I have set the property
true. The default value is
false and if it is set to
true, then the chart deploys a new MongoDB database instance as a separate micro service and uses that database instance to store the device registry data. If you prefer to use an already existing MongoDB database instance and not to create a new instance, then set
false. In that case, make use of the below MongoDB connection configuration properties to point to the already existing MongoDB database.
With the above steps, by now you should have already installed Hono with the MongoDB based device registry in the given Kubernetes cluster. You can also verify the installation. For more information on how to verify the installation, please refer to the README page of Hono’s helm chart.