1、Consul简介
Consul是一套开源的分布式服务发现和配置管理系统,有HashiCorp
公司使用Go
语言开发,提供了微服务系统中服务治理、配置中心、控制总线等功能
。每个功能可以单独使用,也可以一起使用以构建全方位的服务网格,Consul
提供了一套完整的服务网格解决方案。
优点:基于raft
协议,简洁;支持健康检查,同时支持HTTP
和DNS协议
,支持跨数据中心的WAN
集群,提供了图形化界面;支持跨平台,支持Linux、Mac、Windows。
Consul
的功能:
- 实现服务注册发现,提供了了HTTP和DNS两种发现方式
- 健康检测,支持多种方式,Http,Tcp,Docker,Shell脚本定制
- KV存储(key、value的存储方式)
- 支持多数据中心
- 可视化Web界面
下载地址:https://www.consul.io/downloads
Consul中文使用教程:https://www.springcloud.cc/spring-cloud-consul.html
2、安装并运行Consul
在macOS
环境下,使用homebrew
方式在Mac
上安装Consul
。记录详细流程操作。
2-1、安装应用
使用命令$ brew install consul
安装:
test-MBP:~ test$ brew install consul
Updating Homebrew…
==> Downloading https://ghcr.io/v2/homebrew/core/consul/manifests/1.9.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/consul/blobs/sha256:043b458e21e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Pouring consul–1.9.5.big_sur.bottle.tar.gz
==> Caveats
To have launchd start consul now and restart at login:
brew services start consul
Or, if you don’t want/need a background service you can just run:
consul agent -dev -bind 127.0.0.1
==> Summary