Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Using A Raspberry Pi For Distributed Object Storage With Minio

TwitterFacebookRedditLinkedInHacker News

So I was researching object storage and I came across the open source distributed object storage software, Minio. This lightweight software was written with Golang and accomplishes similar things to that of Amazon S3. After all they are both object storage solutions. The difference here is that Minio can be deployed on your own hardware.

Being that Minio was written with Golang, it is cross platform for different computing architectures, ARM included. This means that the server software can be installed on Raspberry Pi micro computing devices. Object storage is great for data backups so it gave me the idea to turn my Raspberry Pi into an object storage backup solution.

If you’ve been keeping up, you’ll probably remember that I wrote a similar tutorial for Raspberry Pi backups, but the previous solution used rsync instead. This is a little different because object storage, Minio in particular, offers erasure code and bitrot protection. If configured correctly, your data will be safer in object storage than it is on the file system with rsync.

Configuring Minio Server on the Raspberry Pi

From the Minio website, download the server for the ARM architecture since this is what the Raspberry Pi uses. Transfer this Golang binary to your Raspberry Pi and proceed towards configuring the server.

Minio Server on the Raspberry Pi

If you wish to use erasure code, you need to have four storage locations at a minimum. Otherwise you’ll be using one. In a realistic scenario, you’ll want four different storage locations where each location is a different drive, not just a different folder on the Raspberry Pi. To do this, execute the following:

./minio server /path/to/drive1 /path/to/drive2 /path/to/drive3 /path/to/drive4

When the server starts, you’ll be provided with an access key and a secret key to be used with requests. Remember these for when we configure the client. Until then, visit the endpoint in your browser to see the Minio Browser.

Pushing Backups from the Local Machine

Backups, or files in general will be pushed from a different machine to the server. For this you’ll need to download the Minio client application.

With the client application downloaded, it needs to be configured so that way the server is stored for future access and use.

Minio Client Configuration for Raspberry Pi

When the host has been added to the list of configured hosts, it can be used in a more simplistic manner. To configure our host, execute the following:

./mc config host add rpi http://<host-ip>:9000 <access_key> <secret_key>

The Raspberry Pi instance can now be accessed through the rpi alias. At this point we can start pushing data to the Raspberry Pi Minio instance.

Minio Mirror to Raspberry Pi

There are many ways to push data to the Minio server. We’re going to be mirroring our data from our local machine to the remote machine, but before we do that, we need to create a bucket to store our backups.

./mc mb rpi/backups

With a bucket called backups created, we can mirror our data to it.

./mc mirror /path/to/local/data rpi/backups

After the data has been mirrored, you can find it via the command line or by visiting the Minio Browser. Should you need to download the data, you can trust that it has been replicated between the four or more storage drives, if you’ve decided to configure it that way.

Conclusion

You just saw how to setup and use the distributed object storage software, Minio, on a Raspberry Pi computer. Object storage can be used as a more reliable storage solution to the previous rsync example that I wrote about. What’s even better is that Minio can be used in combination with Amazon S3 since they use the same APIs and a compatible set of SDKs.

Nic Raboy

Nic Raboy

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in C#, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Unity. Nic writes about his development experiences related to making web and mobile development easier to understand.