Query Consul from the command line and SSH into a server from Consul catalog.
go get -u github.com/outbrain/consult
consult needs to know where Consul's API is, this can be configured using the CONSUL_URL environment variable or the --server command line flag.
Run consult -h or consult help for a complete list of flags.
--json,-j- JSON output--detailed,-d- Print detailed results with header line--dc=DC_NAME- Datacenter to query, can be specified multiple times--all-dcs- Query all datacenters. Overrides the--dcflag
To list the node for service and tag:
consult query --service=my_awesome_service --tag=some_tag
Multiple tags - you can choose to match any or all tags. By default, all tags must be matched.
consult query -s my_awesome_service -t tag1 -t tag2 -m any
Multiple datacenter support
consult query -s service1 --dc dc1 --dc dc2
consult query -s service1 --all-dcs
query flags also work on http and ssh subcommands.
consult ssh --service=my_awesome_service --tag=some_tag --username=joe
--username is optional of course
Perform an HTTP request on endpoints returned from Consul query:
consult http -s service1 -t tag1 --all-endpoints --uri="/ping"
For other options check out consul help http
consult list dc
consult list service --dc dc1 --dc dc2
consult list node -r '^ap.*a' # list node matching regex
Apache V2