본문 바로가기

리눅스

[리눅스] consul 서비스 등록 - 2

반응형

consul 서비스 등록

consul nodes

curl -s localhost:8500/v1/catalog/nodes | jq

consul nodes leader

curl -s localhost:8500/v1/status/leader

consul members address list

curl -s http://127.0.0.1:8500/v1/agent/members | jq -r '.[].Addr'

consul domain 확인(ptr 레코드 질의)

dig @127.0.0.1 -p 8600 -x {Consul Member IP}

dig @127.0.0.1 -p 8600 -x {Consul Member IP}

CONSUL CLIENT ADDRESS(local ip)

export CONSUL_CLIENT_ADDRESS=`ip route get 1.2.3.4 | awk '{ print $7 }' | egrep -v '^$'`
echo $CONSUL_CLIENT_ADDRESS

Agent HTTP API

register

curl -XPUT http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/service/register -d '{ "ID": "web1", "Name": "web1", "Address": "www.google.com", "Meta": {"google_path":"/", "google_ssl":"true" }, "Port": 443}'

agent -services

curl -s http://${CONSUL_CLIENT_ADDRESS}:8500/v1/catalog/services | jq

agent -services

curl -s http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/services | jq
curl -s http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/service/web | jq

agent -health -service

curl -s http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/health/service/name/web | jq

agent -checks

curl -s http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/checks | jq

deregister

curl -XPUT http://${CONSUL_CLIENT_ADDRESS}:8500/v1/agent/service/deregister/web1

 

참고URL

- Consul Health Checks : https://developer.hashicorp.com/consul/docs/discovery/checks

 

728x90
반응형