Consul常用接口使用
2024-09-26 01:34:19
prometheus.yml 配置
- job_name: 'node_exporter'
consul_sd_configs:
- server: 'consul_ip:8500'
services: ['node_exporter']
# 匹配service关键字
- job_name: 'service'
consul_sd_configs:
- server: 'consul_ip:8500'
services: []
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*service.*
action: keep
注册服务
curl -X PUT -d '{"id": "test1","name": "test1","address": "10.80.229.55","port": 9100,"tags": ["service"],"checks": [{"http": "http:// 10.80.229.55:9100/","interval": "5s"}]}' http://consul_ip:8500/v1/agent/service/register
查询指定节点以及指定的服务信息
curl http://consul_ip:8500/v1/catalog/service/mysql
删除服务
curl --request PUT http://consul_ip:8500/v1/agent/service/deregister/mysql
列出数据中心
curl http://consul_ip:8500/v1/catalog/datacenters
列出节点
curl http://consul_ip:8500/v1/catalog/nodes
列出服务
curl http://consul_ip:8500/v1/catalog/services
列出服务节点
curl http://consul_ip:8500/v1/catalog/service/my-service
最新文章
- hbase-site.xml中HBASE_CLASSPATH 的设置
- 备份MySQL数据库
- Asp.net Json数据解析的一种思路
- cJSON: 一个用c写的一个简单好用的JSON解析器
- HDU 3555 数位dp入门
- Hibernate解决n+1问题
- web开发注意的问题
- UISegmentedControl 分段器加载不同的viewcontroller
- leetcode第17题--4Sum
- Java面试07|Redis数据库
- 解决oracle11G密码过期问题
- CLOSE_WAIT状态的原因与解决方法
- JavaScript内置对象——Math对象
- robots.txt、humans.txt、.editorconfig、.gitignore、LICENSE.txt、README.md、CHANGLOG.md
- linux tmux 工具使用 tmux.conf 文件
- MySQL优化技巧之四:mysql数据库开发常见问题及优化[转]
- 一分钟让你学会使用Android AsyncTask
- 【python】理想论坛帖子爬虫1.06
- R语言查找变量ls函数
- 【Java多线程】线程池学习