1、注册服务
请求接口:
PUT: http://{{host}}:8500/v1/agent/service/register
请求参数示例:
{
"ID": "dfs",
"Name": "dfs",
"Tags": ["schema=local","httpPort=9955","tcpPort=9956","wan-service=10.200.112.43","lan-service=10.200.112.43","version=1.1.0.27","environment=production","secure=false"
],
"Address": "10.200.112.43",
"Port": 9955,
"Check": {"TCP": "10.200.112.43:9955","interval": "30s"
}}
因为之前dfs已经注册过了,这里将ID变为aaa,Name变为bbb,可以看到已经注册到consul上了。
2、注销服务
请求接口:
PUT: http://{{host}}:8500/v1/agent/service/deregister/{服务ID}
注销后,bbb服务就不在服务列表了。