The new Raspberry Pi 3 is a four core 64 bit machine with 1Gb memory. I have a few of them. I’m evaluating cockroachdb. Obviously the thing to do is make a cockroach cluster of Pi 3.
I checked the Cockroach on Raspberry Pi instructions here: https://www.cockroachlabs.com/blog/run-cockroachdb-on-a-raspberry-pi/
But that is getting a bit old and targeted at older 32 bit Pi with less memory. There are some hacks in there that I hope are not required for a 64 bit build on the Pi 3.
So, muddling along I installed a 64 bit Debian on my Pi 3 and managed to build a cockroach for it that seems to work.
The procedure is below. It would be great if any roach guys have comments on it. If it looks sensible the next step is a cluster of three Pi 3 built like that.
Install a 64 bit cockroachdb on your Raspberry Pi 3.
Install pi64, a 64 bit version of Debian for the Pi 3, to your Pi 3 using the instructions here: https://github.com/bamarni/pi64
When you have that done, on your Pi 3 do the following:
Be sure Debian is up to date
$ sudo apt-get update $ sudo apt-get upgrade
$ sudo apt-get install git
$ sudo apt-get install vim
$ sudo apt-get install wget
$ sudo apt-get install curl
$ sudo apt-get install make
$ sudo apt-get install cmake
$ sudo apt-get install gcc
$ sudo apt-get install g++
Install the tinfo developer libraries:
$ sudo apt-get install libtinfo-dev
Install node.js`. Not necessary but I want to test cockroach from node.js later.
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash $ source /home/pi/.profile $ nvm install 9.3.0 $ node -v
Install go for arm64
$ wget https://storage.googleapis.com/golang/go1.9.2.linux-arm64.tar.gz $ sudo tar -C /usr/local -xzf go1.9.2.linux-arm64.tar.gz
Add go to your PATH:
$ sudo vim ~/.profile # and add the line "export PATH=$PATH:/usr/local/go/bin" $ source ~/.profile $ echo $PATH $ go version
$ sudo apt-get install autoconf`
Install the yarn package manager
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - $ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list $ sudo apt-get install apt-transport-https $ sudo apt-get update $ sudo apt-get install yarn
Make a nice big swap file, building cockroach will need it.
$ sudo dd if=/dev/zero of=/swap bs=1024 count=1M $ sudo chmod 600 /swap $ sudo mkswap /swap $ sudo swapon /swap
Build and install cockroachdb
$ cd $GOPATH # Or $ mkdir ~/go; cd ~/go if you have no GOPATH $ go get -d github.com/cockroachdb/cockroach $ cd src/github.com/cockroachdb/cockroach $ make build -j1
That takes about an hour and half…
$ ls -lh # should see cockroach executable there
Install it on your PATH and check it runs:
$ sudo cp cockroach /usr/local/bin/ $ cockroach version $ cockroach start --insecure --host=0.0.0.0
You should now be able to browse to the cockroach dashboard on localhost:8080
If all is well it’s time to check the documentation at https://www.cockroachlabs.com/docs/stable/