迪克猪的博客
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Mac OS 安装 etcd

使用 brew 安装

第一步: 确定 brew 是否有 etcd 包:

$ brew search etcd
==> Formulae
etcd ✔                                                netcdf                                                pnetcdf

第二步: 安装


$ brew install etcd
Updating Homebrew...
fatal: Could not resolve HEAD to a revision
Warning: You are using macOS 11.0.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/etcd-3.4.13.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring etcd-3.4.13.catalina.bottle.tar.gz
==> Caveats
To have launchd start etcd now and restart at login:
  brew services start etcd
Or, if you don't want/need a background service you can just run:
  etcd
==> Summary
🍺  /usr/local/Cellar/etcd/3.4.13: 8 files, 38.7MB

运行 etcd

安装完后,会有相关提示,告知我们怎么使用,推荐使用 brew services 来管理这些应用。


$ brew services list
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 932 (delta 8), reused 5 (delta 0), pack-reused 912
Receiving objects: 100% (932/932), 262.03 KiB | 294.00 KiB/s, done.
Resolving deltas: 100% (383/383), done.
Tapped 1 command (27 files, 324KB).
Name Status  User Plist
etcd stopped

$ brew services list
Name Status  User Plist
etcd stopped

brew services 常用的操作


# 启动某个应用,这里用 etcd 做演示
brew services start etcd

# 停止某个应用
brew services stop etcd

# 查看当前应用列表
brew services list

启动 etcd:


$ brew services start etcd
==> Successfully started `etcd` (label: homebrew.mxcl.etcd)

$ brew services list
Name Status  User      Plist
etcd started zhushuyan /Users/zhushuyan/Library/LaunchAgents/homebrew.mxcl.etcd.plist

好了, etcd 已经启动了,现在验证下,是否正确的启动:


$ etcdctl endpoint health
127.0.0.1:2379 is healthy: successfully committed proposal: took = 1.532483ms

至此,etcd 已经安装完毕。