consul命令行查看服务_consul服务搭建

微服务框架使用consul

###consul 是什么

consul 是提供有发现服务,配置,分段功能全特性控制面板的服务网络解决方案。它关键特性有服务发现,健康检查,kv保存,安全服务通信,多数据中心等。就不翻译文档了...

条件

consul 命令包括以下

``` sell

Usage: consul [--version] [--help] []

Available commands are:

agent Runs a Consul agent

catalog Interact with the catalog

connect Interact with Consul Connect

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.

intention Interact with Connect service intentions

join Tell Consul agent to join cluster

keygen Generates a new encryption key

keyring Manages gossip layer encryption keys

kv Interact with the key-value store

leave Gracefully leaves the Consul cluster and shuts down

lock Execute a command holding a lock

maint Controls node or service maintenance mode

members Lists the members of a Consul cluster

monitor Stream logs from a Consul agent

operator Provides cluster-level tools for Consul operators

reload Triggers the agent to reload configuration files

rtt Estimates network round trip time between nodes

snapshot Saves, restores and inspects snapshots of Consul server state

validate Validate config files/directories

version Prints the Consul version

watch Watch for changes in Consul

```

#### 运行 agent

agent : consul核心进程,管理成员信息,注册服务,运行检查服务,响应请求,等等。有两种模式,server 和client,

server 服务节点需要去执行Raft算法,需要更多的资源,而client则不用,把所有的,因此client更轻量,client构成集群的主体。

运行 agent

```shell

consul agent -data-dir=/tmp/consul

```

有几个比较重要的参数

* 节点名 (node name) : 要唯一,默认是本机主机名,可以通过 -node xxx 设置

* 数据中心(datacenter): agent所在的数据中心,consul支持多个数据中心,但是每个节点必须配置自己的数据中心,默认dc1

* 服务(-server): 加上这个参数,就会以ser

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值