{"id":11176,"date":"2018-05-03T05:57:13","date_gmt":"2018-05-03T03:57:13","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/"},"modified":"2023-07-17T16:48:38","modified_gmt":"2023-07-17T14:48:38","slug":"load-balancing-with-docker-swarm-mode-and-sql-server-containers","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/","title":{"rendered":"Load Balancing with Docker Swarm mode and SQL Server containers"},"content":{"rendered":"<p>Docker swarm mode provides an easy way to publish ports for services. Indeed, in this mode all nodes participate in an ingress routing mesh and accept connections to any service port published. Thus, all incoming requests are routed to available nodes hosting a service.<\/p>\n<p>That\u2019s a pretty cool feature but it has some drawbacks. Let\u2019s say that a node goes wrong \u2026 In this case the application must retry connecting to the next available node and it will likely imply changing the application connection string or using a DNS redirection. A load balancer outside of the Swarm provides a better way to connect to the containers without having to worry about the cluster nodes from an application perspective. Thanks to the ingress routing all of the published services are available through any of the swarm nodes and the load balancer can be set to use the swarm private IP addresses without a concern of which node is hosting what service.<\/p>\n<p>After taking a look at the existing open source projects \/ solutions in the market, I quickly reduced the scope of my search to only 2 ones: <a href=\"https:\/\/nginx.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">nginx<\/a> and <a href=\"http:\/\/www.haproxy.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">HAProxy<\/a>. Each product has pros and cons but I choose HAProxy that fit well with my tests. In fact, I used more specifically the <a href=\"https:\/\/github.com\/docker\/dockercloud-haproxy\/tree\/master\" target=\"_blank\" rel=\"noopener noreferrer\">dockercloud-haproxy<\/a> because it includes an HAProxy docker image that runs with Docker Swarm mode including docker-compose. I\u2019m not sure this project is dead or alive referring to the dockerhub page that states the following: <strong><em>Unfortunately, this project is currently put into maintenance mode. Please do not send any PR for new features. We will still fix bugs if there is any<\/em><\/strong>. It exists some other alternatives as <a href=\"http:\/\/proxy.dockerflow.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">proxy.dockerflow<\/a> but once again the dockercloud-haproxy project remained relevant for what I wanted to test.<\/p>\n<p>Here my docker-compose file:<\/p>\n<pre class=\"brush: xml; gutter: true; first-line: 1\">version: '3.1'\nservices:\n  db: \n    build: .\n    image: 127.0.0.1:5000\/dbi_linux_sql2017:CU4\n    ports: \n      - \"1433:1433\"\n    volumes:\n      - \/u00\/db2:\/u00\n      - \/u01\/db2:\/u01\n      - \/u02\/db2:\/u02\n      - \/u03\/db2:\/u03\n      - \/u98\/db2:\/u98\n    environment:\n      - MSSQL_SA_PASSWORD_FILE=\/run\/secrets\/mssql_sa_password\n      - ACCEPT_EULA=Y\n      - MSSQL_PID=Developer\n      - MSSQL_USER=dbi\n      - MSSQL_USER_PASSWORD_FILE=\/run\/secrets\/mssql_user_password\n      - TZ=Europe\/Berlin\n      - SERVICE_PORTS=1433\n    networks:\n      - back-tier\n    deploy:\n      replicas: 1\n      placement:\n        constraints: [node.role != manager]\n      resources:\n        limits:\n          cpus: '1'\n          memory: 3584M\n        reservations:\n          cpus: '1'\n          memory: 3072M\n    secrets:\n      - source: mssql_sa_password\n        target: mssql_sa_password\n      - source: mssql_user_password\n        target: mssql_user_password\n\n  proxy:\n      image: dockercloud\/haproxy\n      depends_on:\n        - db\n      environment:\n        - BALANCE=leastconn\n        - ADDITIONAL_SERVICES=project_dir:db\n        - MODE=tcp\n      volumes:\n        - \/var\/run\/docker.sock:\/var\/run\/docker.sock\n      ports:\n        - 80:80\n        - 1936:1936\n      networks:\n        - back-tier\n      deploy:\n        placement:\n          constraints: [node.role == manager]\n\nnetworks:\n  back-tier:\n    external:\n      name: backend-server\n  front-tier:\n    external:\n      name: frontend-server\n\nsecrets: # top level secrets block\n  mssql_sa_password:\n    external: true\n  mssql_user_password:\n    external: true<\/pre>\n<p>It includes 2 services:<\/p>\n<ul>\n<li>db (my SQL Server container)<\/li>\n<li>proxy (my HAProxy server)<\/li>\n<\/ul>\n<p>I used some Swarm Mode specific <a href=\"https:\/\/github.com\/docker\/dockercloud-haproxy\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">environment variables<\/a>:<\/p>\n<ul>\n<li>SERVICE_PORTS=1433 &#8211; to expose the port of my db service (mssql default port)<\/li>\n<li>BALANCE=leastconn &#8211; because it is recommended with long sessions as LDAP, SQL, TSE etc\u2026<\/li>\n<li>ADDITIONAL_SERVICES=project_dir:db \u2013 to identify the db service from the proxy service<\/li>\n<li>MODE=tcp &#8211; mode of load balancing for HAProxy (TCP in my case)<\/li>\n<\/ul>\n<p>I deployed the stack as following:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">$ docker stack deploy -c docker-compose-test.yml mssql\nIgnoring unsupported options: build\n\nCreating service mssql_db\nCreating service mssql_proxy<\/pre>\n<p>My service state was as follows:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">$ docker service ls --filter name=mssql\nID                  NAME                MODE                REPLICAS            IMAGE                                  PORTS\n26zdisl9r64y        mssql_db            replicated          1\/1                 127.0.0.1:5000\/dbi_linux_sql2017:CU4   *:1433-&gt;1433\/tcp\nnhje3081gwr8        mssql_proxy         replicated          1\/1                 dockercloud\/haproxy:latest             *:80-&gt;80\/tcp,*:1936-&gt;1936\/tcp<\/pre>\n<p>Concerning the mssql_proxy service we may notice the exposed ports 80 and 1936. The former will be used to connect to the HAProxy for the SQL Server connection redirection and the latter concers the default port to get HAProxy stats information (from a web browser).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-22963 size-full\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\" alt=\"blog 132 - 2 - docker swarm node status1\" width=\"600\" height=\"348\" \/><\/p>\n<p>Here an example of my HAProxy\u00a0output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-22968\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-1-docker-swarm-HA-proxy-stats.jpg\" alt=\"blog 132 - 1 - docker swarm HA proxy stats\" width=\"1024\" height=\"431\" \/><\/p>\n<p>The db service task (mssql_db.1.o9s2xxxxx)\u00a0&#8211; that corresponds in fact to my service task (or container) is well-identified by the HA proxy.<\/p>\n<p>So, I tried to connect to my SQL Server DB container through the HAProxy:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">C:\\Users\\clustadmin&gt;sqlcmd -S docker1,80 -Usa -PPassw0rd1 -Q\"SELECT @@SERVERNAME\"\n\n---------------------------------------------------------------------------------\ncf7f9d6036f3<\/pre>\n<p>It worked like a charm!<\/p>\n<p>The next step consisted in simulating a failure of\u00a0my docker node DOCKER3 \u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22965\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-3-docker-swarm-node-status2-e1525295341773.jpg\" alt=\"blog 132 - 3 - docker swarm node status2\" width=\"600\" height=\"362\" \/><\/p>\n<p>\u2026 and try again a connection to the SQL Server DB container that has restarted on DOCKER2 node. As expected, the connection kept working and was automatically redirected by the HAProxy to the next available node. Obviously in this case the redirection was not transparent for the application. We have to take to into account the short period of outage that corresponds to the mssql_db container restart duration. By the way, if you take a look at the HAProxy default_service section you may notice that the task id has changed (mssql_db.1.zo8yqxxxxxx) meaning the system has created a new task (or container). However, my mssql_db container host name remained the same in my case.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-22969\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-4-docker-swarm-HA-proxy-stats2.jpg\" alt=\"blog 132 - 4 - docker swarm HA proxy stats2\" width=\"1024\" height=\"63\" \/><\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">C:\\Users\\clustadmin&gt;sqlcmd -S docker1,80 -Usa -PPassw0rd1 -Q\"SELECT @@SERVERNAME\"\n\n---------------------------------------------------------------------------------\ncf7f9d6036f3<\/pre>\n<p>Another interesting point I had to dig further concerns the HAProxy health check by itself. In my case I used TCP-based health check to ensure the service is alive but it is probably not good enough to check if my SQL Server instance (in other words my application) is working correctly. I spent some times to read\u00a0articles and documentations\u00a0and I discovered we may use custom health checks with HAProxy with databases as MySQL, PostgreSQL and Redis. Unfortunately, at the time I&#8217;m writing this blog post nothing concerning SQL Server probably because it is pretty new in this area (maybe I get wrong \u2026 so please feel free to comment) . I found out some other alternatives as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Xinetd\" target=\"_blank\" rel=\"noopener noreferrer\">xinetd<\/a> that may be used to trigger a custom routine (by using sqlcmd command line tool for example) but in my context it makes the game a little bit more complex because I have to include it to my SQL Server docker image. After thinking a little bit about this issue, I realized we already implemented such routine directly inside the SQL Server image itself (HEALTHCHECK section) that uses precisely the sqlcmd command line tool to check the SQL Server connection is working correctly.<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">\/opt\/mssql-tools\/bin\/sqlcmd -S localhost,$MSSQL_TCP_PORT -U sa -P ${SA_PASSWORD} -Q \"select 1\"<\/pre>\n<p>By the way, the task status can be viewed through the docker ps command as follows:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">$docker ps -f name=mssql --format 'table {{.ID}}\\t{{.Names}}\\t{{.CreatedAt}}\\t{{.Status}}'\nCONTAINER ID        NAMES\tCREATED AT                       STATUS\n9bfe04a97617        mssql_db.1.zc8yqp9llmjdcn3df49izyj72\t2018-05-01 23:01:39 +0200 CEST   Up 9 hours (healthy)<\/pre>\n<p>So, the combination of the docker health check routine and the HAProxy TCP health check seems to be a good solution to address different kind of failure including docker swarm node failures and application failures as well.<\/p>\n<p>This is just the first step about using an HAProxy with SQL Server (redirection capabilities). You may also extend this first scenario with a low cost solution including multiples SQL Server Express containers to address scale-out needs with Reporting queries for instance. I remember Christophe Laporte(<a href=\"https:\/\/conseilit.wordpress.com\/2016\/06\/06\/sqlsaturday-510-sql-server-scaleout\/\" target=\"_blank\" rel=\"noopener noreferrer\">b<\/a>) gave a session about\u00a0some years ago.\u00a0I will try to blog about soon!<\/p>\n<p>See you!<\/p>\n<p><span style=\"float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none;\">By David Barbarin<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker swarm mode provides an easy way to publish ports for services. Indeed, in this mode all nodes participate in an ingress routing mesh and accept connections to any service port published. Thus, all incoming requests are routed to available nodes hosting a service. That\u2019s a pretty cool feature but it has some drawbacks. Let\u2019s [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":11177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[601,1348,73,1346,1275],"type_dbi":[],"class_list":["post-11176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","tag-docker","tag-haproxy","tag-linux","tag-sqlserver","tag-swarm"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Load Balancing with Docker Swarm mode and SQL Server containers<\/title>\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.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Load Balancing with Docker Swarm mode and SQL Server containers\" \/>\n<meta property=\"og:description\" content=\"Docker swarm mode provides an easy way to publish ports for services. Indeed, in this mode all nodes participate in an ingress routing mesh and accept connections to any service port published. Thus, all incoming requests are routed to available nodes hosting a service. That\u2019s a pretty cool feature but it has some drawbacks. Let\u2019s [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-03T03:57:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-17T14:48:38+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"348\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\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\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"Load Balancing with Docker Swarm mode and SQL Server containers\",\"datePublished\":\"2018-05-03T03:57:13+00:00\",\"dateModified\":\"2023-07-17T14:48:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/\"},\"wordCount\":946,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\",\"keywords\":[\"Docker\",\"HAProxy\",\"Linux\",\"SQLServer\",\"Swarm\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/\",\"name\":\"Load Balancing with Docker Swarm mode and SQL Server containers\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\",\"datePublished\":\"2018-05-03T03:57:13+00:00\",\"dateModified\":\"2023-07-17T14:48:38+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg\",\"width\":600,\"height\":348},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Load Balancing with Docker Swarm mode and SQL Server containers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/microsoft-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Load Balancing with Docker Swarm mode and SQL Server containers","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.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/","og_locale":"en_US","og_type":"article","og_title":"Load Balancing with Docker Swarm mode and SQL Server containers","og_description":"Docker swarm mode provides an easy way to publish ports for services. Indeed, in this mode all nodes participate in an ingress routing mesh and accept connections to any service port published. Thus, all incoming requests are routed to available nodes hosting a service. That\u2019s a pretty cool feature but it has some drawbacks. Let\u2019s [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/","og_site_name":"dbi Blog","article_published_time":"2018-05-03T03:57:13+00:00","article_modified_time":"2023-07-17T14:48:38+00:00","og_image":[{"width":600,"height":348,"url":"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"Load Balancing with Docker Swarm mode and SQL Server containers","datePublished":"2018-05-03T03:57:13+00:00","dateModified":"2023-07-17T14:48:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/"},"wordCount":946,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg","keywords":["Docker","HAProxy","Linux","SQLServer","Swarm"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/","url":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/","name":"Load Balancing with Docker Swarm mode and SQL Server containers","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg","datePublished":"2018-05-03T03:57:13+00:00","dateModified":"2023-07-17T14:48:38+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-132-2-docker-swarm-node-status1-e1525295212659.jpg","width":600,"height":348},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/load-balancing-with-docker-swarm-mode-and-sql-server-containers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Load Balancing with Docker Swarm mode and SQL Server containers"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=11176"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11176\/revisions"}],"predecessor-version":[{"id":26778,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11176\/revisions\/26778"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/11177"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=11176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=11176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=11176"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=11176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}