How to Install etcd on macOS

Introduction

etcd is a distributed key-value store that provides a reliable way to store and manage data across a cluster. In this tutorial, we will walk through the steps for installing etcd on macOS.

Prerequisites

Step 1: Install etcd

  1. Open Terminal on your macOS.
  2. Install etcd using Homebrew with the following command:
brew install etcd
  1. Wait for Homebrew to download and install all the required dependencies.

Step 2: Start etcd

  1. Start etcd with the following command:
etcd
  1. If the installation is successful, the etcd server will start running, and you should see the following output in your Terminal:
2019-06-27 11:38:08.835089 I | etcdmain: etcd Version: 3.3.13
2019-06-27 11:38:08.835168 I | etcdmain: Git SHA: 2def7e73c
2019-06-27 11:38:08.835177 I | etcdmain: Go Version: go1.11.5
2019-06-27 11:38:08.835185 I | etcdmain: Go OS/Arch: darwin/amd64
2019-06-27 11:38:08.835194 I | etcdmain: setting maximum number of CPUs to 12, total number of available CPUs 12
2019-06-27 11:38:08.835236 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2019-06-27 11:38:08.835567 I | embed: serving insecurely on localhost:2379, this is strongly discouraged. See https://etcd.io/docs/v3.3.13/op-guide/security/ for alternatives.
2019-06-27 11:38:08.835587 I | embed: serving insecurely on localhost:2380, this is strongly discouraged. See https://etcd.io/docs/v3.3.13/op-guide/security/ for alternatives.
2019-06-27 11:38:08.835606 I | etcdserver: name = default
2019-06-27 11:38:08.835615 I | etcdserver: data dir = default.etcd
2019-06-27 11:38:08.835625 I | etcdserver: member dir = default.etcd/member
2019-06-27 11:38:08.835633 I | etcdserver: heartbeat = 100ms
2019-06-27 11:38:08.835641 I | etcdserver: election = 1000ms
2019-06-27 11:38:08.835649 I | etcdserver: snapshot count = 100000
2019-06-27 11:38:08.835657 I | etcdserver: advertise client URLs = http://localhost:2379
2019-06-27 11:38:08.835666 I | etcdserver: initial advertise peer URLs = http://localhost:2380
2019-06-27 11:38:08.835675 I | etcdserver: initial cluster = default=http://localhost:2380
2019-06-27 11:38:08.835683 I | etcdserver: starting member e1cb5704d059e0da in cluster 7e27652175c2deb7
2019-06-27 11:38:08.835693 I | raft: e1cb5704d059e0da became follower at term 0
2019-06-27 11:38:08.835745 I | raft: newRaft e1cb5704d059e0da [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2019-06-27 11:38:08.835769 W | etcdserver: no enable-v2=true advertised in cluster config; enabling full GRPC-over-HTTP2 API-handler for grpc/custre.
2019-06-27 11:38:08.835789 I | etcdserver: ready to serve client requests
2019-06-27 11:38:08.835846 I | embed: ready to serve requests

Step 3: Test etcd

  1. To test etcd, open a new Terminal window and use the following command to set a key-value pair:
etcdctl put mykey myvalue
  1. Use the following command to retrieve the value of the key you just set:
etcdctl get mykey
  1. If the installation was successful, you should see the value you just set in your Terminal window:
myvalue

Congratulations! You have successfully installed and tested etcd on macOS.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!