Raspberry Pi with a Side of HarperDB


The developing technologies around edge computing are growing  quickly.  Problems have been bubbling up from resource scarcity to scaling.  HarperDB can now be added as a tool in a developer’s tool box to help manage the issues in the Internet of Things landscape.  Due to the popularity of the Raspberry Pi development boards, developers can begin to iterate proof of concepts for all types of projects.  This article is intended to jump-start developers looking to get up and running with HarperDB on a Raspberry Pi.

Install HarperDB on a Raspberry Pi in Minutes

HarperDB has ARM builds, and we are very excited about the possibilities of running HarperDB on Rasberry Pis and other micro computing devices.  It is a  very simple process to get up and running. HarperDB is compiled in ARM v6/7  to run on Raspberry Pi like architectures.  

Begin by installing a Linux flavored operating system such as Ubuntu or Noobs onto your Pi. From there. it’s as simple as downloading HarperDB onto your Pi. Once you have installed HarperDB, you can access the simple REST API to apply all your create, read, update and delete operations through SQL or No-SQL.  HarperDB’s Development team utilizes a wonderful tool called Postman that manages and makes it easy to build REST API calls.  

Download HarperDB ARM Build

Extra Storage with USB Flash Drive

If you want to implement a larger storage area on a Pi for HarperDB, that is very easy as well.  The details for this process can be found here.  From the referenced tutorial, add a USB flash drive to the Pi, partition, create an ext4 or xfs file system and then mount the device to your favorite directory.  Do not forget to add the mount settings to your fstab to persist the USB mount after restarts and/or shutdown. You can find fstab in /etc/fstab, simply append the mount parameter from the above referenced tutorial to the end of the fstab file and save.  The final detail during the installation process is to configure the USB mounted directory as the HDB_ROOT value; HarperDB destination directory.  The Pi is now ready to take on more data than the minimum required micro SD card could ever manage.  

Benefits of an IoT Database on Raspberry Pi

There are many benefits to running a database optimized for the Internet of Things.  HarperDB has a small footprint to fit nicely on micro computers.  IoT devices require that resources are used efficiently. HarperDB currently runs the already efficient Node.js server.  Additionally, the HarperDB server is stateless requiring much less memory and processing overhead when the server is not keeping the state of sessions and connection information.  A Future HarperDB release will allow developers to require HarperDB as a module, allowing the full SQL and No-SQL functionality without a running server. Battery life can be extended significantly if the device can go to low power mode until it receives an event that requires the rest of its resources.  

HarperDB’s clustering functionality provides a distributed meshed database across devices allowing for access to all the data from a single cluster node.  Coupled with industry standard drivers, JDBC and ODBC, users can run analysis on any one cluster node and/or from a centralized master node, shortening the data value chain. This inherently excludes the need for middleware that extracts data from the master database, transforms it, then loads an alternative data store that is SQL friendly.  Not only are users paying for extra hardware for middleware and an extra data store that provides business intelligence capabilities, they may also be paying license fees for each product, doubling the capital expenditure requirements.  SQL data stores are easy to integrate into business intelligence tools such as Tableau, but moving data to a SQL friendly database can take significant time as was  discussed in our previous blog about database as a microservice .  

HarperDB’s JDBC driver provides the SQL requirements to connect directly to Tableau giving users access to business intelligence out of the box.  You can connect your new HarperDB Pi project to a free version of Tableau today.  (Maybe point to docs on using Tableau and JDBC)

HarperDB as an IoT Project for CPG

When we look at the benefits and simplicity of installing HarperDB on a Raspberry Pi ,especially for IoT projects, the use cases and possibilities are endless. One example can be found in consumer product goods (CPG)  such as a storage warehouse with many shelved units fitted with IoT devices.  These devices can communicate among themselves sending different data points, such as geo location, shelf coordinates, temperature, humidity or even vibration information for very sensitive goods. The devices can publish their data when new events are sampled or triggered by entering a truck or arriving at the store for distribution, possibly even updating the stores inventory on arrival.  HarperDB users can follow the product life cycle from manufacturing to customer purchases all in real-time.  This truly is simplifying with out sacrifice as well as shortening the data value chain; which has always been one of HarperDB’s main goals and objectives.