Adventures in software and beyond

Trying etcd on Android, Mac, and Raspberry Pi

When you have a huge assortment of machines working together, you want them to be working independently as much as possible for the sake of performance, but you still have to coordinate them. The smartest folks who have thought long and hard about how to do that wind up using a distributed state machine approach, so that there’s effectively a single virtual machine running on top of the whole cluster. It would be easy if it weren’t for handling failures. So you see Google and others using Paxos to implement the state machine.

I spent a couple years learning all about Paxos in the hopes that I’d figure out how to explain it to people easily. Along the way, I did improve in my own understanding and even in my ability to talk about Paxos, but I noticed several failed attempts others had had at making Paxos accessible.

It turns out that Ongaro and Ousterhout of University of California, Berkeley, have created a more understandable implementation of a highly available distributed state machine. It’s called “Raft”, and the paper is a good read. Moreover, there’s a Go-language implementation of Raft. Fun!

The distributed key-value store, etcd, is also written in Go and uses Raft. I had been wanting to run Go software on my Android phone, and etcd seemed like an interesting way to try that out.

The first order of business was learning how to best get the etcd binary for arm onto the cell phone. The options were:

Note that no peers are specified and that I’m deleting the data directory to start the cluster from scratch. This is only safe because I know there’s no state to preserve from a previous instance of the cluster. Before starting etcd on Raspian, I had to flush the firewall rules with iptables - F.