Linux-使用Consul

环境

操作系统:Centos

Consul:1.13.3

安装

官网提供了各种操作系统安装方式,可以直接按照说明进行操作,如果是centos可以按如下进行操作。

 sudo yum install -y yum-utils
 sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
 sudo yum -y install consul
启动

以服务的方式运行

data-dir:指定agent储存状态的数据目录,这是所有agent都必须的,对server尤其重要,因为他们必须持久化集群的状态。

-bootstrap-expect:Consul将会等到Sever节点数达到指定数值时,才会启动集群(自动选举Leader),仅Server有此参数, 注意这个值集群中所有节点要一致, 或着仅指定一个节点。

consul agent -server -data-dir=/www/server/consul/data-dir -bootstrap-expect=1
//显示所有的节点
consul catalog nodes
//显示所有的服务
consul catalog services

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注