您的位置:首页 > 运维架构 > Linux

Consul入门01 - 安装Consul

2016-06-27 10:07 597 查看

Part 1:转载自:https://segmentfault.com/a/1190000005005227

Consul必须首先安装在每个节点上当该节点需要称为Consul集群中的成员。为了使得安装更容易,Consul为所有支持的平台提供了二进制安装包。本页面不描述如何从源码来编译Consul。


安装Consul

为了安装Consul,需要在下载页面中找到和你系统匹配的包。Consul被打包成zip格式的压缩包。

解压Consul zip包,复制consul二进制文件到系统PATH中包含的路径下,以确保它可以被执行。在Unix系统中,~/bin和/usr/local/bin是通常的安装路径,选择哪个依赖于你安装Consul给单个用户使用还是所有用户都可以使用。对于Windows系统,你可以安装到任意目录,不过不要忘记将安装目录加入到%PATH%中去。


OS X

如果你使用homebrew作为你的包管理器,你可以通过它来安装Consul:
$ brew cask install consul


如果没有cask plugin,那你可以通过下面命令安装:
$ brew install caskroom/cask/brew-cask


验证安装

安装Consul后,通过打开新的终端回话并且输入consul是否可用来验证安装是否工作。通过执行consul你应该可以看到下面类似的输出:
$ consul
usage: consul [--version] [--help] <command> [<args>]

Available commands are:
agent          Runs a Consul agent
event          Fire a new event
exec           Executes a command on Consul nodes
force-leave    Forces a member of the cluster to enter the "left" state
info           Provides debugging information for operators
join           Tell Consul agent to join cluster
keygen         Generates a new encryption key
leave          Gracefully leaves the Consul cluster and shuts down
members        Lists the members of a Consul cluster
monitor        Stream logs from a Consul agent
reload         Triggers the agent to reload configuration files
version        Prints the Consul version
watch          Watch for changes in Consul


如果终端报告consul没有被找到的错误,那可能是你的PATH没有被正确的设置导致的。请会到前面的步骤去检查你的PATH环境变量是否包含了安装Consul目录。

Part 2:根据Part1和上一篇博文Windows安装Linux虚拟机(CentOS7)

一、下载Consul:可以去官网下载 也可以下载我使用的linux64位包
二、根据part1所说,我们需要将consul_0.6.4_linux_amd64.zip包中的内容安装到哦/usr/local/bin下,确保被执行。


三、验证安装,在任意目录下输入命令:consul,如下图,即安装成功。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Consul consul linux