{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarm/pulls/comments/32786802","id":32786802,"diff_hunk":"@@ -0,0 +1,154 @@\n+# High availability in Swarm\n+\n+In Docker Swarm, the **swarm manager** is responsible for the entire cluster and manages the resources of multiple `docker` hosts at scale. If the swarm manager dies, you must create a new one and deal with an interruption of service.\n+\n+The *High Availability* feature allows a Docker Swarm to gracefully handle the failover of a manager instance. Using this feature, you can create a single **primary manager** instance and multiple **replica** instances.\n+\n+A primary manager is the main point of contact with the Docker Swarm cluster. You can also create and talk to replica instances that will act as backups. Requests issued on a replica are automatically proxied to the primary manager. If the primary manager fails, a replica takes away the lead. In this way, you always keep a point of contact with the cluster.\n+\n+## Setup primary and replicas\n+\n+This section explains how to set up Docker Swarm using multiple **managers**.\n+\n+### Assumptions\n+\n+You need either a `Consul`, `etcd`, or `Zookeeper` cluster. This procedure is written assuming a `Consul` server running on address `192.168.42.10:8500`. The sample swarm configuration has three machines:\n+\n+- `manager-1` on `192.168.42.200`\n+- `manager-2` on `192.168.42.201`\n+- `manager-3` on `192.168.42.202`\n+\n+### Create the primary manager\n+\n+You use the `swarm manage` command with the `--replication` and `--advertise` flags to create a primary manager.\n+    \n+      user@manager-1 $ swarm manage -H :4000 <tls-config-flags> --replication --avertise 192.168.42.200:4000 consul://192.168.42.10:8500/nodes\n+      INFO[0000] Listening for HTTP addr=:4000 proto=tcp\n+      INFO[0000] Cluster leadership acquired\n+      INFO[0000] New leader elected: 192.168.42.200:4000\n+      [...]\n+\n+\n+The  `--replication` flag tells swarm that the manager is part of a a multi-manager configuration and that this primary manager competes with other manager instances for the primary role. The primary manager has the authority to manage cluster, replicate logs, and replicate events happening inside the cluster.\n+\n+The `--advertise` option specifies the primary manager address. Swarm uses this address to advertise to the cluster when the node is elected as the primary. As you see in the command's output, the address you provided now appears to be the one of the elected Primary manager.\n+\n+\n+### Create two replicas\n+\n+Now that you have a primary manager, you can create replicas.\n+\n+    user@manager-2 $ swarm manage -H :4000 <tls-config-flags> --replication --advertise 192.168.42.201:4000 consul://192.168.42.10:8500/nodes\n+    INFO[0000] Listening for HTTP                            addr=:4000 proto=tcp\n+    INFO[0000] Cluster leadership lost\n+    INFO[0000] New leader elected: 192.168.42.200:4000\n+    [...]\n+\n+This command creates a replica manager on `192.168.42.201:4000` which is looking at `192.168.42.200:4000` as the primary manager.\n+\n+Create an additional, third *manager* instance:\n+\n+    user@manager-2 $ swarm manage -H :4000 <tls-config-flags> --replication --advertise 192.168.42.202:4000 consul://192.168.42.10:8500/nodes\n+    INFO[0000] Listening for HTTP                            addr=:4000 proto=tcp\n+    INFO[0000] Cluster leadership lost\n+    INFO[0000] New leader elected: 192.168.42.200:4000\n+    [...]\n+\n+Once you have established your primary manager and the replicas, create **swarm agents** as you normally would.\n+\n+\n+### List machines in the cluster\n+\n+Typing `docker info` should give you an output similar to the following:\n+\n+\n+    user@my-machine $ export DOCKER_HOST=192.168.42.200:4000 # Points to machine-1\n+    user@my-machine $ docker info\n+    Containers: 0\n+    Images: 25\n+    Storage Driver:\n+    Role: Primary  <--------- machine-1 is the Primary manager","path":"docs/multi-manager-setup.md","position":70,"original_position":70,"commit_id":"3f148db76bc25eaa87bc033a35773849d48b574f","original_commit_id":"bb15f98ce960c52df116c74812f2e5a9f9e0021e","user":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"body":"s/machine-1/manager-1/","created_at":"2015-06-18T22:44:57Z","updated_at":"2015-06-18T22:44:57Z","html_url":"https://github.com/docker/swarm/pull/940#discussion_r32786802","pull_request_url":"https://api.github.com/repos/docker/swarm/pulls/940","_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments/32786802"},"html":{"href":"https://github.com/docker/swarm/pull/940#discussion_r32786802"},"pull_request":{"href":"https://api.github.com/repos/docker/swarm/pulls/940"}}},"pull_request":{"url":"https://api.github.com/repos/docker/swarm/pulls/940","id":37589134,"html_url":"https://github.com/docker/swarm/pull/940","diff_url":"https://github.com/docker/swarm/pull/940.diff","patch_url":"https://github.com/docker/swarm/pull/940.patch","issue_url":"https://api.github.com/repos/docker/swarm/issues/940","number":940,"state":"open","locked":false,"title":"Add documentation on Leader Election/High Availability for `swarm manage`","user":{"login":"abronan","id":1655859,"avatar_url":"https://avatars.githubusercontent.com/u/1655859?v=3","gravatar_id":"","url":"https://api.github.com/users/abronan","html_url":"https://github.com/abronan","followers_url":"https://api.github.com/users/abronan/followers","following_url":"https://api.github.com/users/abronan/following{/other_user}","gists_url":"https://api.github.com/users/abronan/gists{/gist_id}","starred_url":"https://api.github.com/users/abronan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronan/subscriptions","organizations_url":"https://api.github.com/users/abronan/orgs","repos_url":"https://api.github.com/users/abronan/repos","events_url":"https://api.github.com/users/abronan/events{/privacy}","received_events_url":"https://api.github.com/users/abronan/received_events","type":"User","site_admin":false},"body":"Depends on #938 \r\n\r\nFirst attempt, just want to make sure we agree on the terms used.\r\n\r\n/cc @aluzzardi @vieux \r\n\r\nSigned-off-by: Alexandre Beslic <abronan@docker.com>","created_at":"2015-06-12T18:05:03Z","updated_at":"2015-06-18T22:44:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4889bb3f7dc441543f7892c2e79fa3967d4a23dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarm/pulls/940/commits","review_comments_url":"https://api.github.com/repos/docker/swarm/pulls/940/comments","review_comment_url":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarm/issues/940/comments","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/3f148db76bc25eaa87bc033a35773849d48b574f","head":{"label":"abronan:leader_election_doc","ref":"leader_election_doc","sha":"3f148db76bc25eaa87bc033a35773849d48b574f","user":{"login":"abronan","id":1655859,"avatar_url":"https://avatars.githubusercontent.com/u/1655859?v=3","gravatar_id":"","url":"https://api.github.com/users/abronan","html_url":"https://github.com/abronan","followers_url":"https://api.github.com/users/abronan/followers","following_url":"https://api.github.com/users/abronan/following{/other_user}","gists_url":"https://api.github.com/users/abronan/gists{/gist_id}","starred_url":"https://api.github.com/users/abronan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronan/subscriptions","organizations_url":"https://api.github.com/users/abronan/orgs","repos_url":"https://api.github.com/users/abronan/repos","events_url":"https://api.github.com/users/abronan/events{/privacy}","received_events_url":"https://api.github.com/users/abronan/received_events","type":"User","site_admin":false},"repo":{"id":32493940,"name":"swarm","full_name":"abronan/swarm","owner":{"login":"abronan","id":1655859,"avatar_url":"https://avatars.githubusercontent.com/u/1655859?v=3","gravatar_id":"","url":"https://api.github.com/users/abronan","html_url":"https://github.com/abronan","followers_url":"https://api.github.com/users/abronan/followers","following_url":"https://api.github.com/users/abronan/following{/other_user}","gists_url":"https://api.github.com/users/abronan/gists{/gist_id}","starred_url":"https://api.github.com/users/abronan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronan/subscriptions","organizations_url":"https://api.github.com/users/abronan/orgs","repos_url":"https://api.github.com/users/abronan/repos","events_url":"https://api.github.com/users/abronan/events{/privacy}","received_events_url":"https://api.github.com/users/abronan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abronan/swarm","description":"Swarm: a Docker-native clustering system","fork":true,"url":"https://api.github.com/repos/abronan/swarm","forks_url":"https://api.github.com/repos/abronan/swarm/forks","keys_url":"https://api.github.com/repos/abronan/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abronan/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abronan/swarm/teams","hooks_url":"https://api.github.com/repos/abronan/swarm/hooks","issue_events_url":"https://api.github.com/repos/abronan/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/abronan/swarm/events","assignees_url":"https://api.github.com/repos/abronan/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/abronan/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/abronan/swarm/tags","blobs_url":"https://api.github.com/repos/abronan/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abronan/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abronan/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/abronan/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abronan/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/abronan/swarm/languages","stargazers_url":"https://api.github.com/repos/abronan/swarm/stargazers","contributors_url":"https://api.github.com/repos/abronan/swarm/contributors","subscribers_url":"https://api.github.com/repos/abronan/swarm/subscribers","subscription_url":"https://api.github.com/repos/abronan/swarm/subscription","commits_url":"https://api.github.com/repos/abronan/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/abronan/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/abronan/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/abronan/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/abronan/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/abronan/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abronan/swarm/merges","archive_url":"https://api.github.com/repos/abronan/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abronan/swarm/downloads","issues_url":"https://api.github.com/repos/abronan/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/abronan/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/abronan/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/abronan/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abronan/swarm/labels{/name}","releases_url":"https://api.github.com/repos/abronan/swarm/releases{/id}","created_at":"2015-03-19T01:27:04Z","updated_at":"2015-04-14T10:52:26Z","pushed_at":"2015-06-18T22:40:49Z","git_url":"git://github.com/abronan/swarm.git","ssh_url":"git@github.com:abronan/swarm.git","clone_url":"https://github.com/abronan/swarm.git","svn_url":"https://github.com/abronan/swarm","homepage":"","size":6242,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"d0a457f209598ce685485f7ac4dc5b6247c684a4","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":19360616,"name":"swarm","full_name":"docker/swarm","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarm","description":"Swarm: a Docker-native clustering system","fork":false,"url":"https://api.github.com/repos/docker/swarm","forks_url":"https://api.github.com/repos/docker/swarm/forks","keys_url":"https://api.github.com/repos/docker/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarm/teams","hooks_url":"https://api.github.com/repos/docker/swarm/hooks","issue_events_url":"https://api.github.com/repos/docker/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarm/events","assignees_url":"https://api.github.com/repos/docker/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarm/tags","blobs_url":"https://api.github.com/repos/docker/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarm/languages","stargazers_url":"https://api.github.com/repos/docker/swarm/stargazers","contributors_url":"https://api.github.com/repos/docker/swarm/contributors","subscribers_url":"https://api.github.com/repos/docker/swarm/subscribers","subscription_url":"https://api.github.com/repos/docker/swarm/subscription","commits_url":"https://api.github.com/repos/docker/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarm/merges","archive_url":"https://api.github.com/repos/docker/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarm/downloads","issues_url":"https://api.github.com/repos/docker/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarm/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarm/releases{/id}","created_at":"2014-05-01T23:15:17Z","updated_at":"2015-06-18T22:04:29Z","pushed_at":"2015-06-18T22:40:50Z","git_url":"git://github.com/docker/swarm.git","ssh_url":"git@github.com:docker/swarm.git","clone_url":"https://github.com/docker/swarm.git","svn_url":"https://github.com/docker/swarm","homepage":"","size":11905,"stargazers_count":2788,"watchers_count":2788,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":345,"mirror_url":null,"open_issues_count":110,"forks":345,"open_issues":110,"watchers":2788,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/940"},"html":{"href":"https://github.com/docker/swarm/pull/940"},"issue":{"href":"https://api.github.com/repos/docker/swarm/issues/940"},"comments":{"href":"https://api.github.com/repos/docker/swarm/issues/940/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarm/pulls/940/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarm/pulls/940/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarm/statuses/3f148db76bc25eaa87bc033a35773849d48b574f"}}}}