{"id":46293,"date":"2015-06-26T19:16:39","date_gmt":"2015-06-26T16:16:39","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=46293"},"modified":"2019-08-28T18:06:11","modified_gmt":"2019-08-28T15:06:11","slug":"how-to-discover-services-on-lattice-with-consul","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/","title":{"rendered":"How to Discover Services on Lattice with Consul"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/consul-lattice.png\" alt=\"consul-lattice\" width=\"237\" height=\"147\" style=\"margin: 10px\" class=\"alignright size-full wp-image-46294\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/cloudfoundry-attic\/lattice-release\" rel=\"noopener noreferrer\" target=\"_blank\">Lattice<\/a> is a light-weight, open-source tool for clustering containers. In a Lattice cluster, containers represent long-running processes or one-time tasks that are scaled and scheduled dynamically. Apps running in containers have to use external services, such as MySQL, RabbitMQ, etc., but if these services are dynamic, you cannot hardcode their IPs to the client.<\/p>\n<p>The solution is to use a service discovery product, such as <a href=\"https:\/\/www.consul.io\/\" rel=\"noopener noreferrer\" target=\"_blank\">Consul<\/a>, a highly available, distributed tool for discovering and configuring services. In this tutorial, we describe how an app running in Lattice can discover a MySQL service with Consul.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Creating_a_cluster\" >Creating a cluster<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Registering_the_MySQL_service\" >Registering the MySQL service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Discovering_a_MySQL_service_from_Lattice\" >Discovering a MySQL service from Lattice<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Related_videos\" >Related videos<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#Further_reading\" >Further reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#About_the_author\" >About the author<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>First, you need to download three Vagrant boxes, which are approximately 2 GB in size. So, make sure you have a good Internet connection. You will also need 1 GB of RAM for each machine (4 GB in total).<\/p>\n<p>In our case, the environment is:<\/p>\n<ul>\n<li>MacOS X 10.10.1<\/li>\n<li>Vagrant 1.7.2<\/li>\n<li>VirtualBox 4.3.28<\/li>\n<\/ul>\n<p>You can try repeating the steps described in this tutorial on any configuration, but this one has been tested, and it definitely works.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Creating_a_cluster\"><\/span>Creating a cluster<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To get started, let&#8217;s spin up four virtual machines. We use Vagrant and VirtualBox to do this on a laptop (without any external infrastructure provider, like AWS). This makes deployment faster and much simpler.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vagrant up\r\n  Bringing machine 'mysql01' up with 'virtualbox' provider...\r\n  Bringing machine 'mysql02' up with 'virtualbox' provider...\r\n  Bringing machine 'consul' up with 'virtualbox' provider...\r\n  Bringing machine 'lattice' up with 'virtualbox' provider...\r\n<\/pre>\n<p>We need to open SSH sessions to MySQL and Consul VMs. You will be interacting with Lattice using the Lattice CLI, so you don&#8217;t need to SSH to it.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vagrant ssh mysql01\r\n$ vagrant ssh mysql02\r\n$ vagrant ssh consul\r\n$ ltc target 10.0.0.13.xip.io\r\n    Api Location Set\r\n<\/pre>\n<p>Now, start your Consul cluster.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nconsul$ consul agent -server -bootstrap-expect 1 -data-dir \/tmp\/consul \\\r\n-bind=10.0.0.10 -ui-dir \/opt\/ui -client=10.0.0.10\r\n\r\nmysql01$ consul agent -data-dir \/tmp\/consul -bind=10.0.0.14 \\\r\n-config-dir \/etc\/consul.d -join 10.0.0.10\r\n\r\nmysql02$ consul agent -data-dir \/tmp\/consul -bind=10.0.0.11 \\\r\n-config-dir \/etc\/consul.d -join 10.0.0.10\r\n<\/pre>\n<p>So, we have launched Consul in a server mode on one node and in a client mode on two more nodes. Now, we need to verify that the cluster is running, and the clients are registered in the <a href=\"http:\/\/10.0.0.10:8500\/ui\" target=\"_blank\" rel=\"noopener noreferrer\">Consul Web UI<\/a>.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul-web-ui.jpg\" alt=\"service-discovery-with-consul-web-ui\" width=\"572\" height=\"562\" class=\"aligncenter size-full wp-image-46295\" \/><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Registering_the_MySQL_service\"><\/span>Registering the MySQL service<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Once our Consul infrastructure is up and running, it&#8217;s time to register the MySQL service. This has already been done for you, so let&#8217;s just verify it. To display the status of the MySQL service and make sure it is running, use the command below.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql01:~$ sudo service mysql status\r\n    mysql start\/running, process 1106\r\n<\/pre>\n<p>Then, connect to port 3306 using the CLI and check if it is listening to the port.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql01:~$ mysql -h10.0.0.11 -P3306 -ulexsys --password=altoros\r\n    mysql&gt;\r\n<\/pre>\n<p>Finally, run a query against MySQL. We will use the following query to check database health.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; select @@hostname;\r\n    +------------+\r\n    | @@hostname |\r\n    +------------+\r\n    | mysql01    |\r\n    +------------+\r\n    1 row in set (0.00 sec)\r\n<\/pre>\n<p>Check the service definition for MySQL.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql01:~$ cat \/etc\/consul.d\/mysql.json\r\n{\r\n  &quot;service&quot;: {\r\n    &quot;name&quot;: &quot;mysql&quot;,\r\n    &quot;port&quot;: 3306,\r\n    &quot;check&quot;: {\r\n      &quot;script&quot;: &quot;\/etc\/consul.d\/scripts\/mysql_health.sh&quot;,\r\n      &quot;interval&quot;: &quot;10s&quot;\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<p>View the status of the MySQL service in the Consul Web UI.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul-on-lattice-mysql.jpg\" alt=\"service-discovery-with-consul-on-lattice-mysql\" width=\"630\" height=\"429\" class=\"aligncenter size-full wp-image-46296\" \/><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Discovering_a_MySQL_service_from_Lattice\"><\/span>Discovering a MySQL service from Lattice<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Let&#8217;s make sure that we can discover the service using DNS and HTTP interfaces.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql02:~$ dig @127.0.0.1 -p 8600 mysql.service.consul SRV\r\n  ;; ANSWER SECTION:\r\n  mysql.service.consul.\t0\tIN\tSRV\t1 1 3306 mysql01.node.dc1.consul.\r\n  mysql.service.consul.\t0\tIN\tSRV\t1 1 3306 mysql02.node.dc1.consul.\r\n\r\n  ;; ADDITIONAL SECTION:\r\n  mysql01.node.dc1.consul. 0\tIN\tA\t10.0.0.14\r\n  mysql02.node.dc1.consul. 0\tIN\tA\t10.0.0.11\r\n\r\n\r\n$ curl http:\/\/localhost:8500\/v1\/catalog\/service\/mysql | jq .\r\n&#x5B;\r\n  {\r\n    &quot;ServicePort&quot;: 3306,\r\n    &quot;ServiceAddress&quot;: &quot;&quot;,\r\n    &quot;ServiceTags&quot;: null,\r\n    &quot;ServiceName&quot;: &quot;mysql&quot;,\r\n    &quot;ServiceID&quot;: &quot;mysql&quot;,\r\n    &quot;Address&quot;: &quot;10.0.0.11&quot;,\r\n    &quot;Node&quot;: &quot;mysql02&quot;\r\n  },\r\n  {\r\n    &quot;ServicePort&quot;: 3306,\r\n    &quot;ServiceAddress&quot;: &quot;&quot;,\r\n    &quot;ServiceTags&quot;: null,\r\n    &quot;ServiceName&quot;: &quot;mysql&quot;,\r\n    &quot;ServiceID&quot;: &quot;mysql&quot;,\r\n    &quot;Address&quot;: &quot;10.0.0.14&quot;,\r\n    &quot;Node&quot;: &quot;mysql01&quot;\r\n  }\r\n]  \r\n<\/pre>\n<p>We see that MySQL is running on two nodes, which IPs are 10.0.0.11 and 10.0.0.14.<\/p>\n<p>Now, let\u2019s push the Docker container with the application to Lattice. The container image is located on Docker Hub and is publicly available. There are a Consul agent alongside with a Go application inside. The application asks the local Consul agent what the MySQL service IPs are and chooses one of them randomly.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ltc create consul lexsys\/consul-app -r -- &quot;\/opt\/app.sh&quot;\r\n  ...\r\n  Creating App: consul\r\n  ...\r\n  http:\/\/consul.10.0.0.13.xip.io\r\n<\/pre>\n<p>The next step is to point your browser to the application\u2019s endpoint (<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">`\/demo`<\/code>) and refresh several times. You will see that the application balances between the MySQL instances.<\/p>\n<p>Below is the output for port 10.0.0.11.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul.jpg\" alt=\"service-discovery-with-consul\" width=\"630\" height=\"128\" class=\"aligncenter size-full wp-image-46298\" \/><\/center><\/p>\n<p>And the similar one for port 10.0.0.14.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul-on-lattice.jpg\" alt=\"service-discovery-with-consul-on-lattice\" width=\"644\" height=\"140\" class=\"aligncenter size-full wp-image-46299\" \/><\/center><\/p>\n<p>Let&#8217;s emulate failure of one service node. To do so, we will shut down one of the MySQL instances.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql01:~$ sudo service mysql stop\r\n    mysql stop\/waiting\r\n<\/pre>\n<p>Our app doesn&#8217;t try to connect to the failed instance.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul.jpg\" alt=\"service-discovery-with-consul\" width=\"630\" height=\"128\" class=\"aligncenter size-full wp-image-46298\" \/><\/center><\/p>\n<p>We can see a failed health check in the Consul\u2019s Web UI.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul-on-lattice-health-check.jpg\" alt=\"service-discovery-with-consul-on-lattice-health-check\" width=\"627\" height=\"367\" class=\"aligncenter size-full wp-image-46300\" \/><\/center><\/p>\n<p>Now, start the MySQL service.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nvagrant@mysql01:~$ sudo service mysql start\r\n    mysql start\/running, process 2576\r\n<\/pre>\n<p>This is it. Our application automatically learns that a new service instance is available and starts using it. Below is the output for port 10.0.0.11.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul.jpg\" alt=\"service-discovery-with-consul\" width=\"630\" height=\"128\" class=\"aligncenter size-full wp-image-46298\" \/><\/center><\/p>\n<p>Likewise, you get the output for port 10.0.0.14.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/08\/service-discovery-with-consul-on-lattice.jpg\" alt=\"service-discovery-with-consul-on-lattice\" width=\"644\" height=\"140\" class=\"aligncenter size-full wp-image-46299\" \/><\/center><\/p>\n<p>To replicate this process, use the source code from <a href=\"https:\/\/github.com\/Altoros\/lattice_consul\" target=\"_blank\" rel=\"noopener noreferrer\">this GitHub repository<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Related_videos\"><\/span>Related videos<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><small>In this video, <a href=\"https:\/\/www.linkedin.com\/in\/juanpgenovese\/\" rel=\"noopener noreferrer\" target=\"_blank\">Juan Pablo Genovese<\/a> and <a href=\"https:\/\/www.linkedin.com\/in\/alex-z\/\" rel=\"noopener noreferrer\" target=\"_blank\">Aleksey Zalesov<\/a> talk about enabling service discovery with Lattice during the <a href=\"https:\/\/www.altoros.com\/blog\/top-100-quotes-from-the-cloud-foundry-summit-2015\/\">Cloud Foundry Summit 2015<\/a>.<\/small><\/p>\n<p><center><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/thNlwp3MxkQ\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/center><\/p>\n<p><small>In this video, Alexey explains how to discover MySQL on Lattice via a console means.<\/small><\/p>\n<p><center><iframe loading=\"lazy\" width=\"480\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/2mDdfmuttio\" frameborder=\"0\" allowfullscreen><\/iframe><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Further_reading\"><\/span>Further reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/cloud-foundry-containers-warden-docker-and-garden\/\">Cloud Foundry Containers: Warden, Docker, and Garden<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/kubernetes-on-pcf-pivotal-container-service-pks-from-different-perspectives\/\">K8s Meets PCF: Pivotal Container Service from Different Perspectives<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/cloud-foundry-advisory-board-meeting-nov-2018-vms-vs-containers\/\">Cloud Foundry Advisory Board Meeting, Nov 2018: VMs vs. Containers<<\/a>\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"About_the_author\"><\/span>About the author<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><small><a href=\"https:\/\/www.linkedin.com\/in\/alex-z\/\" rel=\"noopener noreferrer\" target=\"_blank\">Aleksey Zalesov<\/a> is a Cloud Foundry\/DevOps Engineer at Altoros. He is an IBM Tivoli Certified Specialist with seven years of experience in system administration. Aleksey specializes in systems for IT monitoring and management, such as BOSH, a tool that can handle the full life cycle of large distributed systems, e.g., Cloud Foundry. His other professional interests include performance tuning techniques for Linux containers, etc.<\/small><\/p>\n<hr \/>\n<p><center><\/p>\n<p>:<em> <a href=\"https:\/\/www.youtube.com\/watch?v=thNlwp3MxkQ\">Service Discovery on Lattice with Consul (CF Summit 2015)<\/a><\/em><\/p>\n<p><\/center><center><\/center><\/p>\n<hr \/>\n<p><center><small>This post was written by <b>Aleksey Zalesov<\/b> and edited by <a href=\"https:\/\/www.altoros.com\/blog\/author\/sophie.turol\/\">Sophia Turol<\/a> and <a href=\"https:\/\/www.altoros.com\/blog\/author\/alex\/\">Alex Khizhniak<\/a>.<\/small><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<\/p>\n<p>Lattice is a light-weight, open-source tool for clustering containers. In a Lattice cluster, containers represent long-running processes or one-time tasks that are scaled and scheduled dynamically. Apps running in containers have to use external services, such as MySQL, RabbitMQ, etc., but if these services are dynamic, you cannot hardcode their [&#8230;]<\/p>\n","protected":false},"author":3,"featured_media":46338,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,570,206],"class_list":["post-46293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-containers","tag-oss-cloud-foundry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Discover Services on Lattice with Consul | Altoros<\/title>\n<meta name=\"description\" content=\"Learn how to create a cluster, register the MySQL service, and discover it from Lattice.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Discover Services on Lattice with Consul | Altoros\" \/>\n<meta property=\"og:description\" content=\"Lattice is a light-weight, open-source tool for clustering containers. In a Lattice cluster, containers represent long-running processes or one-time tasks that are scaled and scheduled dynamically. Apps running in containers have to use external services, such as MySQL, RabbitMQ, etc., but if these services are dynamic, you cannot hardcode their [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-26T16:16:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-28T15:06:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"360\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sophia Turol\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sophia Turol\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/\",\"name\":\"How to Discover Services on Lattice with Consul | Altoros\",\"isPartOf\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png\",\"datePublished\":\"2015-06-26T16:16:39+00:00\",\"dateModified\":\"2019-08-28T15:06:11+00:00\",\"author\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png\",\"width\":640,\"height\":360},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.altoros.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Discover Services on Lattice with Consul\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\",\"url\":\"https:\/\/www.altoros.com\/blog\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.altoros.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e\",\"name\":\"Sophia Turol\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg\",\"caption\":\"Sophia Turol\"},\"description\":\"Sophia Turol is passionate about delivering well-structured articles that cater for picky technical audience. With 3+ years in technical writing and 5+ years in editorship, she enjoys collaboration with developers to create insightful, yet intelligible technical tutorials, overviews, and case studies. Sophie is enthusiastic about deep learning solutions\u2014TensorFlow in particular\u2014and PaaS systems, such as Cloud Foundry.\",\"url\":\"https:\/\/www.altoros.com\/blog\/author\/sophie-turol\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Discover Services on Lattice with Consul | Altoros","description":"Learn how to create a cluster, register the MySQL service, and discover it from Lattice.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/","og_locale":"en_US","og_type":"article","og_title":"How to Discover Services on Lattice with Consul | Altoros","og_description":"Lattice is a light-weight, open-source tool for clustering containers. In a Lattice cluster, containers represent long-running processes or one-time tasks that are scaled and scheduled dynamically. Apps running in containers have to use external services, such as MySQL, RabbitMQ, etc., but if these services are dynamic, you cannot hardcode their [...]","og_url":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/","og_site_name":"Altoros","article_published_time":"2015-06-26T16:16:39+00:00","article_modified_time":"2019-08-28T15:06:11+00:00","og_image":[{"width":640,"height":360,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png","type":"image\/png"}],"author":"Sophia Turol","twitter_misc":{"Written by":"Sophia Turol","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/","url":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/","name":"How to Discover Services on Lattice with Consul | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png","datePublished":"2015-06-26T16:16:39+00:00","dateModified":"2019-08-28T15:06:11+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2015\/06\/how-to-discover-services-on-lattice-with-consul.png","width":640,"height":360},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/how-to-discover-services-on-lattice-with-consul\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Discover Services on Lattice with Consul"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e","name":"Sophia Turol","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg","caption":"Sophia Turol"},"description":"Sophia Turol is passionate about delivering well-structured articles that cater for picky technical audience. With 3+ years in technical writing and 5+ years in editorship, she enjoys collaboration with developers to create insightful, yet intelligible technical tutorials, overviews, and case studies. Sophie is enthusiastic about deep learning solutions\u2014TensorFlow in particular\u2014and PaaS systems, such as Cloud Foundry.","url":"https:\/\/www.altoros.com\/blog\/author\/sophie-turol\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/46293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=46293"}],"version-history":[{"count":10,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/46293\/revisions"}],"predecessor-version":[{"id":46340,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/46293\/revisions\/46340"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/46338"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=46293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=46293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=46293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}