Serf 必须首先安装在将成为 Serf 集群成员的每个节点上。
为了简化安装,Serf 以二进制包的形式分发给所有支持的平台和架构。
安装
下载 Serf 后,解压缩包。
将 serf 二进制文件复制到 PATH 上的某个位置,以便可以执行它。
在 Unix 系统上,~/bin 和 /usr/local/bin 是常见的安装目录,具体取决于您是要将安装限制为单个用户还是将其公开给整个系统。
在 Windows 系统上,您可以将它放在任何您想要的位置。
也可以通过标准的 go 命令行实用程序构建和安装 serf 二进制文件(go get -u github.com/hashicorp/serf/cmd/serf,它将 serf 安装为 $GOPATH/bin/serf),但是我们建议 运行正式版本。
OS X
如果您使用 homebrew 作为包管理器,那么您可以像安装 serf 一样简单: brew install serf
验证安装
安装 Serf 后,通过打开一个新的终端会话,检查 serf 安装是否有效。
通过执行 serf 你应该看到类似于下面的帮助输出:
$ serf
usage: serf [--version] [--help] <command> [<args>]
Available commands are:
agent Runs a Serf agent
event Send a custom event through the Serf cluster
force-leave Forces a member of the cluster to enter the "left" state
info Provides debugging information for operators
join Tell Serf agent to join cluster
keygen Generates a new encryption key
keys Manipulate the internal encryption keyring used by Serf
leave Gracefully leaves the Serf cluster and shuts down
members Lists the members of a Serf cluster
monitor Stream logs from a Serf agent
query Send a query to the Serf cluster
reachability Test network reachability
tags Modify tags of a running Serf agent
version Prints the Serf version
如果你得到一个找不到 serf 的错误,那么你的 PATH 环境变量设置不正确。 请返回并确保您的 PATH 变量包含安装 Serf 的目录。