通过API向consul内注册服务
1.请求地址 PUT 2.请求数据 { "id": "test222", "name": "test222name", "tags": ["xiaoshu611-/core.product"], "address": "192.168.211.130", "port": 18306, "checks": [{ "name": "core.product.check", "http": "http://192.168.211.130:18306", "interval": "10s", "timeout": "5s" }] }
3.打开consul页面就可以在服务内看到信息了
4.查询当前服务节点下的服务
http://192.168.211.130:8530/v1/agent/services GET
5.删除服务
http://192.168.211.130:8530/v1/agent/service/deregister/<serviceID> <serviceID>是服务id PUT
6.更新服务
1.地址 http://192.168.211.130:8530/v1/agent/service/register PUT 2.请求数据 { "id": "test222", "name": "test222name", "tags": ["xiaoshu611-/core.product"], "address": "192.168.211.130", "port": 18306, "checks": [{ "name": "core.product.check", "http": "http://192.168.211.130:18306", "interval": "10s", "timeout": "5s" }] }
本文由:xiasohu168.com 作者:xiaoshu发表,转载请注明来源!