github.com/ghodss/etcd@v0.3.1-0.20140417172404-cc329bfa55cb/Documentation/design/discovery.md (about) 1 ## Discovery Rule 2 3 Peer discovery uses the following sources in this order: `-discovery`, `-peers`, log data in `-data-dir`. 4 5 If none of these is set, it will start a new cluster by itself. If any of them is set, it will make 6 best efforts to find cluster, and panic if none is reachable. 7 8 If a discover URL is provided and the discovery process succeeds then it will find peers specified by the discover URL only. 9 This is because we assume that it has been registered in discover URL and 10 should not join other clusters. 11 12 If a discover URL is provided but the discovery process fails then we will prevent the node from forming 13 a new cluster. We assume the user doesn't want to start a brand new cluster without noticing discover URL. 14 15 ## Logical Workflow 16 17 Start an etcd machine: 18 19 ``` 20 If discovery url is given: 21 Do discovery 22 If Success: 23 Join to the cluster discovered 24 return 25 26 If peer list is given: 27 Try to join as follower via peer list 28 If Success: return 29 30 If log data is given: 31 Try to join as follower via peers in previous cluster 32 If Success: return 33 34 If log data is given: 35 Restart the previous cluster which is down 36 return 37 38 If discovery url is given: 39 Panic 40 41 If peer list is given: 42 Panic 43 44 Start as the leader of a new cluster 45 ```