zoukankan      html  css  js  c++  java
  • Centos7-4下安装Consul

    1、安装Consul

    wget https://releases.hashicorp.com/consul/0.7.5/consul_0.7.5_linux_amd64.zip
    
    //我这里出现报错:-bash: wget: 未找到命令,解决方法
    
    yum -y install wget
    
    //然后在执行上面的命令,将Consul下载下来
    

    2、解压consul_0.7.5_linux_amd64.zip

    unzip consul_0.7.5_linux_amd64.zip
    
    //有可能会出现-bash: unzip: 未找到命令,解决方案
    
    yum -y install unzip
    

    3、执行以下 ./consul 看是否安装成功(是一个启动文件,不是一个目录)

    4、启动consul

    我的ip地址是192.168.100.129

    ./consul agent -dev -ui -node=consul-dev -client=192.168.100.129
    
    //关闭临时防火墙
    
    systemctl stop firewalld
    

    5、访问consul

    http://192.168.100.129:8500
    

    6.使用PostMan 注册Http服务

    //地址  使用post请求
    
    http://192.168.100.129:8500/v1/catalog/register
    
    //发送json格式数据
    //参数1
    {"Datacenter": "dc1",
     "Node":"tomcat",
     "Address":"192.168.0.102",
     "Service": {
    	"Id" :"192.168.0.102:8080", 
    		"Service": "yangk",
    		"tags": ["dev"],
    		"Port": 8080
    		}}
    

    Datacenter指定数据中心,Address指定服务IP,Service.Id指定服务唯一标识,Service.Service指定服务分组,Service.tags指定服务标签(如测试环境、预发环境等),Service.Port指定服务端口。

    7.发现Http服务

  • 相关阅读:
    自考新教材-p209
    自考新教材-p205
    自考新教材-p200
    自考新教材-p197
    Java IO (5)
    Java IO (1)
    Java IO (2)
    Java IO (3)
    通过源码学Java基础:InputStream、OutputStream、FileInputStream和FileOutputStream
    Spring入门(1)-第一个Spring项目
  • 原文地址:https://www.cnblogs.com/yangk1996/p/12656667.html
Copyright © 2011-2022 走看看