linux安装consul

1.下载consul_0.7.5_linux_amd64.zip

    wget https://releases.hashicorp.com/consul/0.7.5/consul_0.7.5_linux_amd64.zip

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.启动

我的linux Ip地址192.168.128.149

    ./consul agent -dev -ui -node=consul-dev -client=192.168.128.149

 5.访问

    192.168.128.149:8500

如果访问不了,临时关闭防火墙

    systemctl stop firewalld

6.使用postMan注册服务(Post请求)

    http://192.168.128.149:8500/v1/catalog/register

参数

        {
            "Datacenter": "dc1",
            "Node": "tomcat",
            "Address": "192.168.1.100",
            "Service": {
                "Id": "192.168.1.100:8080",
                "Service": "itmayiedu",
                "tags": [
                    "dev"
                ],
                "Port": 8080
            }
        }

参数

        {
            "Datacenter": "dc1",
            "Node": "tomcat",
            "Address": "192.168.1.100",
            "Service": {
                "Id": "192.168.1.100:8081",
                "Service": "itmayeidu",
                "tags": [
                    "dev"
                ],
                "Port": 8081
            }
        }

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

7.存储key/value

使用postmen 发送put请求

http://192.168.128.149:8500/v1/kv/upstreams/itmayiedu/192.168.1.100:8080

http://192.168.128.149:8500/v1/kv/upstreams/itmayiedu/192.168.1.100:8081

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值