Advertisement

Consul 5: Service Registration Example

阅读量:
在这里插入图片描述

本文通过具体实例阐述了在Consul平台中实现服务注册的操作方式。

事前准备

Consul安装指南

本例所采用的Consul软件版本详情如下

复制代码
    liumiaocn:~ liumiao$ consul --version
    Consul v1.7.1
    Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
    liumiaocn:~ liumiao$ 
    
    
      
      
      
      
    

服务定义

采用服务定义作为最为通用的服务注册手段,Consul同样支持通过HTTP API实现该功能。在本文中,直接选用Consul的配置方式,借助-config-dir参数来设定配置文件的存储路径,系统在启动时会自动读取该目录下的所有服务定义文件并完成注册操作。

全部评论 (0)

还没有任何评论哟~