Running CockroachDB on ARM based Architecture

Running CockroachDB on ARM based Architecture

Here at Cockroach Labs we understand the importance of being able to develop and test our software locally, and starting from version 22.2 we've released ARM64 binaries for our database, allowing developers to install on their MacBooks, Raspberry Pi's and other ARM based machines.

In this blog post I will outline the importance of this capability and give an overview of the advantages and disadvantages of ARM architecture, as well as provide technical instructions on how to install and run a local copy of CockroachDB on to an ARM based Raspberry Pi.

Why is it important?

ARM Architecture has quickly gained more traction over the last couple of years especially in the world of local development, Apple Macbook's for example now only ship with ARM based processors, this has come with a vast of great benefits but also some challenges as support for ARM installations lack behind, leaving developers utilising workarounds to fulfil their development needs.

It's also worth noting that ARM provides a great baseline for running applications in the edge, based on their low power consumption and ability to fit in to smaller mobile devices.

My personal opinion is that the benefits of using ARM greatly outweigh the challenges we face whilst waiting for support of running certain software, ARM architecture provides benefits such as:

  1. Low Cost - Typically more affordable and are often ideal for lower cost devices.
  2. Low Power Requirements - Considerably less power requirements and therefore consume less power compared to other processors on the market, this also results in greater battery life for portable or mobile devices.
  3. Lower Heat Generation - finally, ARM processors generate far less heat under heavy workload, allowing devices to be more sleek in design, quieter to run and overall much more comfortable for the user to use.

The common disadvantages to working with ARM share common ground:

  1. Compatibility with x86 operating systems such as Windows
  2. Producing applications to run with ARM requires a greater skill of programming, this is because of the importance and complexity of execution that is needed within the ARM architecture.
  3. Because of disadvantage number two, that means your favourite binaries may not be capable of running on your shiny new MacBook!

I've used my personal Raspberry Pi4 to demonstrate how easy it is to get started with ARM and Version 22. (Note, ARM64 binaries for Linux are currently experimental) Please see below the specifications for my device and technical instructions on how to do this yourself.

Hardware/Software Specs

Model: Raspberry Pi 4 Model B
Architecture: ARM64
CPU: 1.5GHz 64-bit quad-core CPU
Memory: 4GB
OS: Ubuntu 22.04 LTS
Storage: 128 GB SD Card

Instructions

First of all, we need to select an appropriate version of the binary and the architecture we're running, you can view the releases page here. At the time of writing v22.2.3 is the latest version, so that's what we will use, and specifically the ARM 64-bit Download

wget https://binaries.cockroachdb.com/cockroach-v22.2.5.linux-arm64.tgz

Then extract the tar file and copy the contents to the correct places so that you can correctly use the CLI

tar -vzxf cockroach-v22.2.5.linux-arm64.tgz
sudo cp cp cockroach-v22.2.5.linux-arm64/cockroach /usr/local/bin
sudo mkdir -p /usr/local/lib/cockroach
sudo cp -i cockroach-v22.2.5.linux-arm64/lib/libgeos.so /usr/local/lib/cockroach/
sudo cp -i cockroach-v22.2.5.linux-arm64/lib/libgeos_c.so /usr/local/lib/cockroach/

We can verify that the cockroach binary is installed in the correct location by running a which command

which cockroach

Screenshot-2023-02-23-at-15.45.25

We can also verify the installed version by running

cockroach version

Screenshot-2023-02-23-at-16.03.24

As demonstrated here it's very simple to get started with CockroachDB on your ARM devices and it really is great that we're able to run such software locally with little effort, if you'd like to experiment more with this installation you can simply run the "cockroach demo" command which starts a temporary, in-memory CockroachDB cluster of one or more nodes, with or without a preloaded dataset, and opens an interactive SQL shell to the cluster.

To find out more visit our documentation here.