举例:
$ curl http://127.0.0.1:8500/v1/agent/members|jq .
root@t7-node-1:~# curl http://127.0.0.1:8500/v1/agent/members|jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1873 100 1873 0 0 1829k 0 --:--:-- --:--:-- --:--:-- 1829k
[
{
"Name": "t7-compute02_mgmt",
"Addr": "10.122.51.29",
"Port": 8301,
"Tags": {
"acls": "0",
"build": "1.4.4:ea5210a3",
"dc": "mgmt",
"id": "244655c7-1b93-9911-7cc6-ea3352f8b69c",
"role": "node",
"segment": "",
"vsn": "2",
"vsn_max": "3",
"vsn_min": "2"
},
"Status": 4,
"ProtocolMin": 1,
"ProtocolMax": 5,
"ProtocolCur": 2,
"DelegateMin": 2,
"DelegateMax": 5,
"DelegateCur": 4
},
{
"Name": "t7-node-1_mgmt",
"Addr": "10.122.51.71",
"Port": 8301,
"Tags": {
"acls": "0",
"build": "1.4.4:ea5210a3",
"dc": "mgmt",
"expect": "3",
"id": "56882c62-c31b-f4c9-2196-cf484a8901d3",
"port": "8300",
"raft_vsn": "3",
"role": "consul",
"segment": "",
"vsn": "2",
"vsn_max": "3",
"vsn_min": "2",
"wan_join_port": "8302"
},
"Status": 1,
"ProtocolMin": 1,
"ProtocolMax": 5,
"ProtocolCur": 2,
"DelegateMin": 2,
"DelegateMax": 5,
"DelegateCur": 4
},
{
"Name": "t7-compute01_mgmt",
"Addr": "10.122.51.20",
"Port": 8301,
"Tags": {
"acls": "0",
"build": "1.4.4:ea5210a3",
"dc": "mgmt",
"id": "9dcdb220-711a-6afd-5bdc-43a7e2a2cdc1",
"role": "node",
"segment": "",
"vsn": "2",
"vsn_max": "3",
"vsn_min": "2"
},
"Status": 1,
"ProtocolMin": 1,
"ProtocolMax": 5,
"ProtocolCur": 2,
"DelegateMin": 2,
"DelegateMax": 5,
"DelegateCur": 4
},
{
"Name": "t7-node-2_mgmt",
"Addr": "10.122.51.72",
"Port": 8301,
"Tags": {
"acls": "0",
"build": "1.4.4:ea5210a3",
"dc": "mgmt",
"expect": "3",
"id": "bd23b1f8-0bfb-d663-b380-d88f5b1e2ca6",
"port": "8300",
"raft_vsn": "3",
"role": "consul",
"segment": "",
"vsn": "2",
"vsn_max": "3",
"vsn_min": "2",
"wan_join_port": "8302"
},
"Status": 1,
"ProtocolMin": 1,
"ProtocolMax": 5,
"ProtocolCur": 2,
"DelegateMin": 2,
"DelegateMax": 5,
"DelegateCur": 4
},
{
"Name": "t7-node-3_mgmt",
"Addr": "10.122.51.73",
"Port": 8301,
"Tags": {
"acls": "0",
"build": "1.4.4:ea5210a3",
"dc": "mgmt",
"expect": "3",
"id": "ccddeb71-890c-278a-5e44-9e154b50ba44",
"port": "8300",
"raft_vsn": "3",
"role": "consul",
"segment": "",
"vsn": "2",
"vsn_max": "3",
"vsn_min": "2",
"wan_join_port": "8302"
},
"Status": 1,
"ProtocolMin": 1,
"ProtocolMax": 5,
"ProtocolCur": 2,
"DelegateMin": 2,
"DelegateMax": 5,
"DelegateCur": 4
}
]
Linux下处理JSON的命令行工具:jq---安装
https://my.oschina.net/u/3157270/blog/1529669?utm_medium=referral
简介:
完整的安装和使用...
网友评论