{"id":267,"date":"2026-06-12T12:00:00","date_gmt":"2026-06-12T12:00:00","guid":{"rendered":"https:\/\/konteynerium.com\/?p=209"},"modified":"2026-10-06T11:34:00","modified_gmt":"2026-10-06T11:34:00","slug":"docker-swarm-nedir-coklu-sunucuda-container-orkestrasyonu","status":"publish","type":"post","link":"https:\/\/konteynerium.com\/index.php\/2026\/06\/12\/docker-swarm-nedir-coklu-sunucuda-container-orkestrasyonu\/","title":{"rendered":"Docker Swarm Nedir? \u00c7oklu Sunucuda Container Orkestrasyonu"},"content":{"rendered":"<p>Tek bir sunucuda birka\u00e7 container \u00e7al\u0131\u015ft\u0131rmak <code>docker run<\/code> veya Docker Compose ile kolayca y\u00f6netilebilir. Ama trafi\u011finiz b\u00fcy\u00fcy\u00fcp tek makine yetmemeye ba\u015flad\u0131\u011f\u0131nda, &#8220;bu container&#8217;lar\u0131 birden fazla sunucuya nas\u0131l da\u011f\u0131t\u0131r\u0131m, biri \u00e7\u00f6kerse ne olur?&#8221; sorusu ortaya \u00e7\u0131kar. \u0130\u015fte bu noktada devreye <strong>orkestrasyon<\/strong> ara\u00e7lar\u0131 girer \u2014 ve Docker&#8217;\u0131n kendi \u00e7\u00f6z\u00fcm\u00fc <strong>Docker Swarm<\/strong>&#8216;d\u0131r.<\/p>\n<h2>Orkestrasyon nedir, neden gerekir?<\/h2>\n<p>Orkestrasyon, birden fazla sunucuya (node) yay\u0131lm\u0131\u015f container&#8217;lar\u0131n nerede \u00e7al\u0131\u015faca\u011f\u0131na, ka\u00e7 kopya (replica) olaca\u011f\u0131na, biri \u00e7\u00f6kt\u00fc\u011f\u00fcnde nas\u0131l yeniden ba\u015flat\u0131laca\u011f\u0131na ve trafi\u011fin bu kopyalar aras\u0131nda nas\u0131l da\u011f\u0131t\u0131laca\u011f\u0131na otomatik olarak karar veren bir y\u00f6netim katman\u0131d\u0131r. Elle &#8220;\u015fu container&#8217;\u0131 \u015fu sunucuda ba\u015flat&#8221; demek yerine, istedi\u011finiz <em>son durumu<\/em> (&#8220;bu servisin her zaman 3 kopyas\u0131 \u00e7al\u0131\u015fs\u0131n&#8221;) tan\u0131mlars\u0131n\u0131z; orkestrat\u00f6r bu durumu s\u00fcrekli sa\u011flamaya \u00e7al\u0131\u015f\u0131r.<\/p>\n<h2>Docker Swarm&#8217;\u0131n mimarisi<\/h2>\n<p>Docker Swarm, Docker Engine&#8217;in i\u00e7ine g\u00f6m\u00fcl\u00fc olarak gelir \u2014 ayr\u0131 bir kurulum gerektirmez. Bir k\u00fcme (cluster) iki t\u00fcr node&#8217;dan olu\u015fur:<\/p>\n<ul>\n<li><strong>Manager node:<\/strong> K\u00fcmenin durumunu tutar, hangi container&#8217;\u0131n nerede \u00e7al\u0131\u015faca\u011f\u0131na karar verir (scheduling), di\u011fer node&#8217;lar\u0131 izler. G\u00fcvenilirlik i\u00e7in genellikle 3 veya 5 manager (tek say\u0131) \u00e7al\u0131\u015ft\u0131r\u0131l\u0131r.<\/li>\n<li><strong>Worker node:<\/strong> Manager&#8217;dan ald\u0131\u011f\u0131 g\u00f6revleri (task) \u00e7al\u0131\u015ft\u0131r\u0131r \u2014 yani as\u0131l container&#8217;lar burada ko\u015far. Bir manager ayn\u0131 zamanda worker g\u00f6revi de g\u00f6rebilir.<\/li>\n<\/ul>\n<h2>K\u00fcme olu\u015fturmak<\/h2>\n<p>Bir Swarm k\u00fcmesi ba\u015flatmak tek komutla olur:<\/p>\n<pre><code># \u0130lk sunucuda (manager olacak)\ndocker swarm init --advertise-addr 10.0.0.1\n\n# \u00c7\u0131kt\u0131da verilen \"docker swarm join\" komutunu\n# di\u011fer sunucularda \u00e7al\u0131\u015ft\u0131rarak worker olarak k\u00fcmeye kat\u0131n\ndocker swarm join --token SWMTKN-1-xxxxxxxx 10.0.0.1:2377<\/code><\/pre>\n<h2>Service: Swarm&#8217;da container yerine &#8220;servis&#8221; tan\u0131mlars\u0131n\u0131z<\/h2>\n<p>Tek makinede <code>docker run<\/code> ile bir container ba\u015flat\u0131rs\u0131n\u0131z; Swarm&#8217;da ise bir <strong>service<\/strong> tan\u0131mlars\u0131n\u0131z \u2014 &#8220;bu imajdan her zaman \u015fu kadar kopya \u00e7al\u0131\u015fs\u0131n&#8221; iste\u011fidir:<\/p>\n<pre><code>docker service create \\\n  --name web \\\n  --replicas 3 \\\n  --publish 8080:80 \\\n  nginx:1.27\n\n# Ka\u00e7 kopya \u00e7al\u0131\u015f\u0131yor, hangi node'larda g\u00f6r\u00fcn\ndocker service ps web<\/code><\/pre>\n<p>Bu komuttan sonra Swarm, <code>nginx<\/code> imaj\u0131ndan 3 kopyay\u0131 k\u00fcmedeki uygun worker node&#8217;lara otomatik olarak da\u011f\u0131t\u0131r. Bir node \u00e7\u00f6kerse, Swarm eksik kalan kopyalar\u0131 ba\u015fka bir node&#8217;da yeniden ba\u015flatarak <strong>istenen 3 kopya durumunu<\/strong> otomatik olarak korur \u2014 buna <em>self-healing<\/em> (kendini iyile\u015ftirme) denir.<\/p>\n<h2>\u00d6l\u00e7eklemek tek komut<\/h2>\n<pre><code># 3 kopyadan 8 kopyaya \u00e7\u0131k\ndocker service scale web=8\n\n# Yeni bir s\u00fcr\u00fcm\u00fc kademeli olarak (rolling update) da\u011f\u0131t\ndocker service update --image nginx:1.28 web<\/code><\/pre>\n<div class=\"callout\">\n  <span class=\"glyph\">\u2713<\/span><\/p>\n<p>Rolling update, t\u00fcm kopyalar\u0131 ayn\u0131 anda de\u011fil, s\u0131rayla g\u00fcnceller \u2014 b\u00f6ylece g\u00fcncelleme s\u0131ras\u0131nda servis kesintisiz kal\u0131r. Bir g\u00fcncelleme hatal\u0131ysa <code>docker service rollback web<\/code> ile bir \u00f6nceki s\u00fcr\u00fcme an\u0131nda d\u00f6nebilirsiniz.<\/p>\n<\/div>\n<h2>Swarm mu, Kubernetes mi?<\/h2>\n<p>Docker Swarm&#8217;\u0131n en b\u00fcy\u00fck avantaj\u0131 basitli\u011fidir: Docker Engine&#8217;de zaten y\u00fckl\u00fc gelir, \u00f6\u011frenme e\u011frisi d\u00fc\u015f\u00fckt\u00fcr ve k\u00fc\u00e7\u00fck-orta \u00f6l\u00e7ekli projeler i\u00e7in yeterlidir. Kubernetes ise \u00e7ok daha b\u00fcy\u00fck bir ekosisteme, daha esnek yap\u0131land\u0131rma se\u00e7eneklerine ve daha geni\u015f end\u00fcstri deste\u011fine sahiptir ama \u00f6\u011frenmesi de kurulumu da daha karma\u015f\u0131kt\u0131r. \u0130kisini yan yana kar\u015f\u0131la\u015ft\u0131ran detayl\u0131 yaz\u0131m\u0131za <a href=\"https:\/\/konteynerium.com\/index.php\/category\/karsilastirmalar\/\">Kar\u015f\u0131la\u015ft\u0131rmalar<\/a> b\u00f6l\u00fcm\u00fcnden ula\u015fabilirsiniz.<\/p>\n<p>Orkestrasyonun ne i\u015fe yarad\u0131\u011f\u0131n\u0131 g\u00f6rd\u00fcn\u00fcz \u2014 s\u0131radaki yaz\u0131da bug\u00fcn en yayg\u0131n kullan\u0131lan orkestrasyon arac\u0131 olan Kubernetes&#8217;in temel kavramlar\u0131n\u0131 (Pod, Deployment, Service) s\u0131f\u0131rdan ele al\u0131yoruz.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tek sunucudan birden fazla sunucuya ge\u00e7i\u015f yaparken kar\u015f\u0131n\u0131za \u00e7\u0131kan orkestrasyon ihtiyac\u0131n\u0131, Docker&#8217;\u0131n kendi \u00e7\u00f6z\u00fcm\u00fc Swarm \u00fczerinden manager\/worker mimarisi, service ve rolling update \u00f6rnekleriyle \u00f6\u011frenin.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"seviye":[8],"class_list":["post-267","post","type-post","status-publish","format-standard","hentry","category-orkestrasyon-guvenlik","seviye-orta"],"_links":{"self":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":2,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"predecessor-version":[{"id":568,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions\/568"}],"wp:attachment":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/tags?post=267"},{"taxonomy":"seviye","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/seviye?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}