Skip to content

Instantly share code, notes, and snippets.

@hoshinotsuyoshi
Last active October 15, 2015 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoshinotsuyoshi/92b5558e33f25cb4f3ce to your computer and use it in GitHub Desktop.
Save hoshinotsuyoshi/92b5558e33f25cb4f3ce to your computer and use it in GitHub Desktop.

docker swarm触ってみた

hoshinotsuyoshi 2015/10/14


rails エンジニア的な


問題意識


[おれ@とあるサーバ] $ crontab -l | wc -l
200

200%

SPOF(単一障害点)


docker swarmとは


swarmとは

  • docker謹製クラスタ管理ツール
  • 俺「コンテナの気持ちをわかってそう、よさ気!」
    • と思った

original 200%


swarmとは


swarmとは

ブログ書いた(手前味噌) http://hoppie.hatenablog.com/entry/2015/09/30/194106


今回


original 100%


AMI: ami-f2338ff2 CoreOS-stable-723.3.0-hvm
CoreOS: 723.3.0
docker: 1.6.2
etcd: 2.0.12
docker swarm: 0.4.0

docker toolboxつかわない


cloud-config

https://gist.github.com/hoshinotsuyoshi/dce5e957aa9ebfec816c

  • 80行程度

swarm join

ExecStart=/usr/bin/docker run
  --name=swarm-join
  swarm join 
  --advertise=$private_ipv4:2375 
  etcd://$private_ipv4:2379/swarm

swarm manage

ExecStart=/usr/bin/docker run
  --net=host
  --name=swarm-manage
  swarm manage 
  -H :4000 
  --replication 
  --strategy=binpack 
  --advertise $private_ipv4:4000 
  etcd://$private_ipv4:2379/swarm

デモ

swarmのリーダー

$ etcdctl get /swarm/docker/swarm/leader

ふつうのdocker info

docker info


デモ

tcp越しのdocker info (swarm)

$ docker -H :4000 info

managerのdocker info

$ docker -H $(etcdctl get /swarm/docker/swarm/leader) info


(時間あれば binpackストラテジーのdemoとか)


おわり

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment