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
- macOS Mojave or higher
- Homebrew package manager installed
Step 1: Install etcd
- Open Terminal on your macOS.
- Install etcd using Homebrew with the following command:
brew install etcd
- Wait for Homebrew to download and install all the required dependencies.
Step 2: Start etcd
- Start etcd with the following command:
etcd
- 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
- To test etcd, open a new Terminal window and use the following command to set a key-value pair:
etcdctl put mykey myvalue
- Use the following command to retrieve the value of the key you just set:
etcdctl get mykey
- 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.