• 3 consul api Sky


    consul api
    
    常用API
    agent
    /v1/agent/checks : 返回本地agent注册的所有检查(包括配置文件和HTTP接口)
    /v1/agent/services : 返回本地agent注册的所有 服务
    /v1/agent/members : 返回agent在集群的gossip pool中看到的成员
    /v1/agent/self : 返回本地agent的配置和成员信息
    /v1/agent/join/<address> : 触发本地agent加入node
    /v1/agent/force-leave/<node>>: 强制删除node
    /v1/agent/check/register : 在本地agent增加一个检查项,使用PUT方法传输一个json格式的数据
    /v1/agent/check/deregister/<checkID> : 注销一个本地agent的检查项
    /v1/agent/check/pass/<checkID> : 设置一个本地检查项的状态为passing
    /v1/agent/check/warn/<checkID> : 设置一个本地检查项的状态为warning
    /v1/agent/check/fail/<checkID> : 设置一个本地检查项的状态为critical
    /v1/agent/service/register : 在本地agent增加一个新的服务项,使用PUT方法传输一个json格式的数据
    /v1/agent/service/deregister/<serviceID> : 注销一个本地agent的服务项
    
    catalog
    /v1/catalog/register : Registers a new node, service, or check
    /v1/catalog/deregister : Deregisters a node, service, or check
    /v1/catalog/datacenters : Lists known datacenters
    /v1/catalog/nodes : Lists nodes in a given DC
    /v1/catalog/services : Lists services in a given DC
    /v1/catalog/service/<service> : Lists the nodes in a given service
    /v1/catalog/node/<node> : Lists the services provided by a node
    
    health
    /v1/health/node/<node>: 返回node所定义的检查,可用参数?dc=
    /v1/health/checks/<service>: 返回和服务相关联的检查,可用参数?dc=
    /v1/health/service/<service>: 返回给定datacenter中给定node中service
    /v1/health/state/<state>: 返回给定datacenter中指定状态的服务,state可以是"any", "unknown", "passing", "warning", or "critical",可用参数?dc=
    
    注册外部服务
    https://www.consul.io/docs/guides/external.html
    curl -X PUT -d '{"Datacenter": "dc1", "Node": "google",
    "Address": "www.google.com",
    "Service": {"Service": "search", "Port": 80}}'
    http://127.0.0.1:8500/v1/catalog/register
    
    删除外部服务:
    curl -X PUT -d '{"Datacenter": "dc1", "Node": "google"}' http://127.0.0.1:8500/v1/catalog/deregister
    curl -X PUT -d '{"id": "3d-virtual-number-ykt-com","name": "3d-virtual-number-ykt-com","address": "api.1ketong.com","port":80}' http://localhost:8500/v1/agent/service/register
    curl -X PUT http://localhost:8500/v1/agent/service/deregister/settlerconsumer-service@10.9.153.21
  • 相关阅读:
    【译】System.Text.Json 的下一步是什么
    渲染路径(Rendering Path):Forward、Deferred、LightPrePass、Tiled、Clustered
    前端面试汇总
    微前端建设方案
    微前端说明以及使用
    大家好,新来到贵宝地,想跟大家一起学习,一起交流,请大伙多多指教。
    Active Directroy user and computers 批量查询被Disable的user 和长时间没有登录的User
    Powershell 启动windows server
    iTerm2与oh my zsh的安装使用记录
    Linux 命令行编辑快捷键[转]
  • 原文地址:https://www.cnblogs.com/skyzy/p/16874604.html
Copyright © 2020-2023  润新知