consul 基本命令整理

服务端启动

./consul agent -server -bootstrap -node server-1 -http-port 8580 -client 0.0.0.0 -bind 127.0.0.1 -ui -data-dir=/home/test/consul_data

查看版本

consul version

客户端相关命令

查看基本信息和帮助
consul info -http-addr=http://127.0.0.1:8580
consul catalog -h  
查看所有服务
consul.exe catalog services -http-addr=http://127.0.0.1:8580
查看某节点的所有服务
consul.exe catalog services -node=server-1 -http-addr=http://127.0.0.1:8580
查看所有数据中心
consul catalog datacenters  -http-addr=http://127.0.0.1:8580
查看所有结点详细信息
consul catalog nodes -detailed  -http-addr=http://127.0.0.1:8580
查看指定节点
consul catalog nodes -service=ga-govern -detailed -http-addr=http://127.0.0.1:8580
查看控制台实时日志
consul monitor -http-addr=http://127.0.0.1:8580
备份
consul snapshot save -http-addr=http://127.0.0.1:8580 backup.snap
恢复
consul snapshot restore  -http-addr=http://127.0.0.1:8580 backup.snap
查看备份文件
consul snapshot inspect backup.snap
查看特定数据视图
consul watch  -type=nodes  -http-addr=http://127.0.0.1:8580
# type可以是nodesserviceschecksevent
查看节点与节点数据往返的估计时间
consul rtt -http-addr=http://127.0.0.1:8580 server-1
KV操作
consul kv put -http-addr=http://127.0.0.1:8580 test1 123
consul kv get -http-addr=http://127.0.0.1:8580 test1
consul,consul状态查看 | suger 2019-04-03 10:08:45