« Previous 1 2 3
Service discovery, monitoring, load balancing, and more with Consul
Cloud Nanny
Accessing Services Through DNS
The registered Consul services can be accessed through DNS, and one of the easiest ways is with Dnsmasq. Adding the /etc/dnsmasq.d/10-consul
file shown in Listing 13 should enable Consul DNS lookup.
Listing 13
Consul DNS Lookup
$ cat /etc/dnsmasq.d/10-consul # Enable forward lookup of the 'consul' domain: server=/consul/127.0.0.1#8600 $ dig @localhost -p 8600 MyTomcatApp.service.consul ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.57.amzn1 <<>> @localhost -p 8600 MyTomcatApp.service.consul ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5337 ;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;MyTomcatApp.service.consul. IN A ;; ANSWER SECTION: MyTomcatApp.service.consul. 0 IN A 172.31.31.130 MyTomcatApp.service.consul. 0 IN TXT "VERSIONEDCONSULREGISTRATION=false" MyTomcatApp.service.consul. 0 IN TXT "APPLICATION=app" ;; Query time: 1 msec ;; SERVER: 127.0.0.1#8600(127.0.0.1) ;; WHEN: Tue Jul 10 04:31:28 2018 ;; MSG SIZE rcvd: 134
Conclusions
Consul is one of the best tools for helping you manage your dynamic infrastructure in a cloud environment, and it works well not only with VMs and EC2 instances, but with containers as well. With the appropriate Consul templates, your entire application and production infrastructure maintenance can be automated and overhead reduced.
Infos
- Service mesh made easy: https://www.consul.io
- Consul architecture: https://www.consul.io/docs/internals/architecture.html
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.