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服务

  • 相关阅读:
    bzoj4282 慎二的随机数列
    bzoj2839 集合计数
    bzoj1735 [Usaco2005 jan]Muddy Fields 泥泞的牧场
    bzoj3732 Network
    Kruskal重构树
    bzoj1568 [JSOI2008]Blue Mary开公司
    bzoj4576 [Usaco2016 Open]262144
    p2522 [HAOI2011]Problem b
    bzoj2463 谁能赢呢
    p4301 [CQOI2013]新Nim游戏
  • 原文地址:https://www.cnblogs.com/yangk1996/p/12656667.html
Copyright © 2011-2022 走看看