|
|
@@ -10,7 +10,7 @@ This guide will walk you through configuring a three machine etcd cluster with t
|
|
|
|
|
|
## Static
|
|
|
|
|
|
-As we know the cluster members, their addresses and the size of the cluster before starting we can use an offline bootstrap configuration. Each machine will get either the following command line or environment variables:
|
|
|
+As we know the cluster members, their addresses and the size of the cluster before starting, we can use an offline bootstrap configuration by setting the `initial-cluster` flag. Each machine will get either the following command line or environment variables:
|
|
|
|
|
|
```
|
|
|
ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380"
|
|
|
@@ -22,6 +22,8 @@ ETCD_INITIAL_CLUSTER_STATE=new
|
|
|
-initial-cluster-state new
|
|
|
```
|
|
|
|
|
|
+Note that the URLs specified in `initial-cluster` are the _advertised peer URLs_, i.e. they should match the value of `initial-advertise-peer-urls` on the respective nodes.
|
|
|
+
|
|
|
If you are spinning up multiple clusters (or creating and destroying a single cluster) with same configuration for testing purpose, it is highly recommended that you specify a unique `initial-cluster-token` for the different clusters. By doing this, etcd can generate unique cluster IDs and member IDs for the clusters even if they otherwise have the exact same configuration. This can protect you from cross-cluster-interaction, which might corrupt your clusters.
|
|
|
|
|
|
On each machine you would start etcd with these flags:
|
|
|
@@ -45,11 +47,11 @@ $ etcd -name infra2 -initial-advertise-peer-urls https://10.0.1.12:2380 \
|
|
|
-initial-cluster-state new
|
|
|
```
|
|
|
|
|
|
-The command line parameters starting with `-initial-cluster` will be ignored on subsequent runs of etcd. You are free to remove the environment variables or command line flags after the initial bootstrap process. If you need to make changes to the configuration later see our guide on [runtime configuration](runtime-configuration.md).
|
|
|
+The command line parameters starting with `-initial-cluster` will be ignored on subsequent runs of etcd. You are free to remove the environment variables or command line flags after the initial bootstrap process. If you need to make changes to the configuration later (for example, adding or removing members to/from the cluster), see the [runtime configuration](runtime-configuration.md) guide.
|
|
|
|
|
|
### Error Cases
|
|
|
|
|
|
-In the following case we have not included our new host in the list of enumerated nodes. If this is a new cluster, the node must be added to the list of initial cluster members.
|
|
|
+In the following example, we have not included our new host in the list of enumerated nodes. If this is a new cluster, the node _must_ be added to the list of initial cluster members.
|
|
|
|
|
|
```
|
|
|
$ etcd -name infra1 -initial-advertise-peer-urls http://10.0.1.11:2380 \
|
|
|
@@ -59,13 +61,13 @@ etcd: infra1 not listed in the initial cluster config
|
|
|
exit 1
|
|
|
```
|
|
|
|
|
|
-In this case we are attempting to map a node (infra0) on a different address (127.0.0.1:2380) than its enumerated address in the cluster list (10.0.1.10:2380). If this node is to listen on multiple addresses, all addresses must be reflected in the "initial-cluster" configuration directive.
|
|
|
+In this example, we are attempting to map a node (infra0) on a different address (127.0.0.1:2380) than its enumerated address in the cluster list (10.0.1.10:2380). If this node is to listen on multiple addresses, all addresses _must_ be reflected in the "initial-cluster" configuration directive.
|
|
|
|
|
|
```
|
|
|
$ etcd -name infra0 -initial-advertise-peer-urls http://127.0.0.1:2380 \
|
|
|
-initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \
|
|
|
-initial-cluster-state=new
|
|
|
-etcd: infra0 has different advertised URLs in the cluster and advertised peer URLs list
|
|
|
+etcd: error setting up initial cluster: infra0 has different advertised URLs in the cluster and advertised peer URLs list
|
|
|
exit 1
|
|
|
```
|
|
|
|
|
|
@@ -81,7 +83,7 @@ exit 1
|
|
|
|
|
|
## Discovery
|
|
|
|
|
|
-In a number of cases you might not know the IPs of your cluster peers ahead of time. This is common when utilizing cloud providers or when your network uses DHCP. In these cases you can use an existing etcd cluster to bootstrap a new one. We call this process "discovery".
|
|
|
+In a number of cases, you might not know the IPs of your cluster peers ahead of time. This is common when utilizing cloud providers or when your network uses DHCP. In these cases, rather than specifying a static configuration, you can use an existing etcd cluster to bootstrap a new one. We call this process "discovery".
|
|
|
|
|
|
### Lifetime of a Discovery URL
|
|
|
|
|
|
@@ -99,7 +101,7 @@ Discovery uses an existing cluster to bootstrap itself. If you are using your ow
|
|
|
$ curl -X PUT https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83/_config/size -d value=3
|
|
|
```
|
|
|
|
|
|
-By setting the size key to the URL, you create a discovery URL with expected-cluster-size of 3.
|
|
|
+By setting the size key to the URL, you create a discovery URL with an expected cluster size of 3.
|
|
|
|
|
|
If you bootstrap an etcd cluster using discovery service with more than the expected number of etcd members, the extra etcd processes will [fall back][fall-back] to being [proxies][proxy] by default.
|
|
|
|
|
|
@@ -124,14 +126,14 @@ This will cause each member to register itself with the custom etcd discovery se
|
|
|
|
|
|
### Public discovery service
|
|
|
|
|
|
-If you do not have access to an existing cluster you can use the public discovery service hosted at discovery.etcd.io. You can create a private discovery URL using the "new" endpoint like so:
|
|
|
+If you do not have access to an existing cluster, you can use the public discovery service hosted at `discovery.etcd.io`. You can create a private discovery URL using the "new" endpoint like so:
|
|
|
|
|
|
```
|
|
|
$ curl https://discovery.etcd.io/new?size=3
|
|
|
https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de
|
|
|
```
|
|
|
|
|
|
-This will create the cluster with an initial expected size of 3 members. If you do not specify a size a default of 3 will be used.
|
|
|
+This will create the cluster with an initial expected size of 3 members. If you do not specify a size, a default of 3 will be used.
|
|
|
|
|
|
If you bootstrap an etcd cluster using discovery service with more than the expected number of etcd members, the extra etcd processes will [fall back][fall-back] to being [proxies][proxy] by default.
|
|
|
|
|
|
@@ -169,6 +171,7 @@ You can use the environment variable `ETCD_DISCOVERY_PROXY` to cause etcd to use
|
|
|
|
|
|
#### Discovery Server Errors
|
|
|
|
|
|
+
|
|
|
```
|
|
|
$ etcd -name infra0 -initial-advertise-peer-urls http://10.0.1.10:2380 \
|
|
|
-discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de
|
|
|
@@ -178,10 +181,13 @@ exit 1
|
|
|
|
|
|
#### User Errors
|
|
|
|
|
|
+This error will occur if the discovery cluster already has the configured number of members, and `discovery-fallback` is explicitly disabled
|
|
|
+
|
|
|
```
|
|
|
$ etcd -name infra0 -initial-advertise-peer-urls http://10.0.1.10:2380 \
|
|
|
- -discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de
|
|
|
-etcd: error: the cluster using discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de has already started with all 5 members
|
|
|
+ -discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de \
|
|
|
+ -discovery-fallback exit
|
|
|
+etcd: discovery: cluster is full
|
|
|
exit 1
|
|
|
```
|
|
|
|
|
|
@@ -193,7 +199,7 @@ ignored on this machine.
|
|
|
```
|
|
|
$ etcd -name infra0 -initial-advertise-peer-urls http://10.0.1.10:2380 \
|
|
|
-discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de
|
|
|
-etcd: warn: ignoring discovery URL: etcd has already been initialized and has a valid log in /var/lib/etcd
|
|
|
+etcdserver: warn: ignoring discovery: etcd has already been initialized and has a valid log in /var/lib/etcd
|
|
|
```
|
|
|
|
|
|
# 0.4 to 0.5+ Migration Guide
|