1# Clustering Guide 2 3## Overview 4 5Starting an etcd cluster statically requires that each member knows another in the cluster. In a number of cases, the IPs of the cluster members may be unknown ahead of time. In these cases, the etcd cluster can be bootstrapped with the help of a discovery service. 6 7Once an etcd cluster is up and running, adding or removing members is done via [runtime reconfiguration][runtime-conf]. To better understand the design behind runtime reconfiguration, we suggest reading [the runtime configuration design document][runtime-reconf-design]. 8 9This guide will cover the following mechanisms for bootstrapping an etcd cluster: 10 11* [Static](#static) 12* [etcd Discovery](#etcd-discovery) 13* [DNS Discovery](#dns-discovery) 14 15Each of the bootstrapping mechanisms will be used to create a three machine etcd cluster with the following details: 16 17|Name|Address|Hostname| 18|------|---------|------------------| 19|infra0|10.0.1.10|infra0.example.com| 20|infra1|10.0.1.11|infra1.example.com| 21|infra2|10.0.1.12|infra2.example.com| 22 23## Static 24 25As 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 environment variables or command line: 26 27``` 28ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380" 29ETCD_INITIAL_CLUSTER_STATE=new 30``` 31 32``` 33--initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ 34--initial-cluster-state new 35``` 36 37Note 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. 38 39If spinning up multiple clusters (or creating and destroying a single cluster) with same configuration for testing purpose, it is highly recommended that each cluster is given a unique `initial-cluster-token`. 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 etcd from cross-cluster-interaction, which might corrupt the clusters. 40 41etcd listens on [`listen-client-urls`][conf-listen-client] to accept client traffic. etcd member advertises the URLs specified in [`advertise-client-urls`][conf-adv-client] to other members, proxies, clients. Please make sure the `advertise-client-urls` are reachable from intended clients. A common mistake is setting `advertise-client-urls` to localhost or leave it as default if the remote clients should reach etcd. 42 43On each machine, start etcd with these flags: 44 45``` 46$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ 47 --listen-peer-urls http://10.0.1.10:2380 \ 48 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 49 --advertise-client-urls http://10.0.1.10:2379 \ 50 --initial-cluster-token etcd-cluster-1 \ 51 --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ 52 --initial-cluster-state new 53``` 54``` 55$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ 56 --listen-peer-urls http://10.0.1.11:2380 \ 57 --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ 58 --advertise-client-urls http://10.0.1.11:2379 \ 59 --initial-cluster-token etcd-cluster-1 \ 60 --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ 61 --initial-cluster-state new 62``` 63``` 64$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ 65 --listen-peer-urls http://10.0.1.12:2380 \ 66 --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ 67 --advertise-client-urls http://10.0.1.12:2379 \ 68 --initial-cluster-token etcd-cluster-1 \ 69 --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ 70 --initial-cluster-state new 71``` 72 73The command line parameters starting with `--initial-cluster` will be ignored on subsequent runs of etcd. Feel free to remove the environment variables or command line flags after the initial bootstrap process. If the configuration needs changes later (for example, adding or removing members to/from the cluster), see the [runtime configuration][runtime-conf] guide. 74 75### TLS 76 77etcd supports encrypted communication through the TLS protocol. TLS channels can be used for encrypted internal cluster communication between peers as well as encrypted client traffic. This section provides examples for setting up a cluster with peer and client TLS. Additional information detailing etcd's TLS support can be found in the [security guide][security-guide]. 78 79#### Self-signed certificates 80 81A cluster using self-signed certificates both encrypts traffic and authenticates its connections. To start a cluster with self-signed certificates, each cluster member should have a unique key pair (`member.crt`, `member.key`) signed by a shared cluster CA certificate (`ca.crt`) for both peer connections and client connections. Certificates may be generated by following the etcd [TLS setup][tls-setup] example. 82 83On each machine, etcd would be started with these flags: 84 85``` 86$ etcd --name infra0 --initial-advertise-peer-urls https://10.0.1.10:2380 \ 87 --listen-peer-urls https://10.0.1.10:2380 \ 88 --listen-client-urls https://10.0.1.10:2379,https://127.0.0.1:2379 \ 89 --advertise-client-urls https://10.0.1.10:2379 \ 90 --initial-cluster-token etcd-cluster-1 \ 91 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 92 --initial-cluster-state new \ 93 --client-cert-auth --trusted-ca-file=/path/to/ca-client.crt \ 94 --cert-file=/path/to/infra0-client.crt --key-file=/path/to/infra0-client.key \ 95 --peer-client-cert-auth --peer-trusted-ca-file=ca-peer.crt \ 96 --peer-cert-file=/path/to/infra0-peer.crt --peer-key-file=/path/to/infra0-peer.key 97``` 98``` 99$ etcd --name infra1 --initial-advertise-peer-urls https://10.0.1.11:2380 \ 100 --listen-peer-urls https://10.0.1.11:2380 \ 101 --listen-client-urls https://10.0.1.11:2379,https://127.0.0.1:2379 \ 102 --advertise-client-urls https://10.0.1.11:2379 \ 103 --initial-cluster-token etcd-cluster-1 \ 104 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 105 --initial-cluster-state new \ 106 --client-cert-auth --trusted-ca-file=/path/to/ca-client.crt \ 107 --cert-file=/path/to/infra1-client.crt --key-file=/path/to/infra1-client.key \ 108 --peer-client-cert-auth --peer-trusted-ca-file=ca-peer.crt \ 109 --peer-cert-file=/path/to/infra1-peer.crt --peer-key-file=/path/to/infra1-peer.key 110``` 111``` 112$ etcd --name infra2 --initial-advertise-peer-urls https://10.0.1.12:2380 \ 113 --listen-peer-urls https://10.0.1.12:2380 \ 114 --listen-client-urls https://10.0.1.12:2379,https://127.0.0.1:2379 \ 115 --advertise-client-urls https://10.0.1.12:2379 \ 116 --initial-cluster-token etcd-cluster-1 \ 117 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 118 --initial-cluster-state new \ 119 --client-cert-auth --trusted-ca-file=/path/to/ca-client.crt \ 120 --cert-file=/path/to/infra2-client.crt --key-file=/path/to/infra2-client.key \ 121 --peer-client-cert-auth --peer-trusted-ca-file=ca-peer.crt \ 122 --peer-cert-file=/path/to/infra2-peer.crt --peer-key-file=/path/to/infra2-peer.key 123``` 124 125#### Automatic certificates 126 127If the cluster needs encrypted communication but does not require authenticated connections, etcd can be configured to automatically generate its keys. On initialization, each member creates its own set of keys based on its advertised IP addresses and hosts. 128 129On each machine, etcd would be started with these flags: 130 131``` 132$ etcd --name infra0 --initial-advertise-peer-urls https://10.0.1.10:2380 \ 133 --listen-peer-urls https://10.0.1.10:2380 \ 134 --listen-client-urls https://10.0.1.10:2379,https://127.0.0.1:2379 \ 135 --advertise-client-urls https://10.0.1.10:2379 \ 136 --initial-cluster-token etcd-cluster-1 \ 137 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 138 --initial-cluster-state new \ 139 --auto-tls \ 140 --peer-auto-tls 141``` 142``` 143$ etcd --name infra1 --initial-advertise-peer-urls https://10.0.1.11:2380 \ 144 --listen-peer-urls https://10.0.1.11:2380 \ 145 --listen-client-urls https://10.0.1.11:2379,https://127.0.0.1:2379 \ 146 --advertise-client-urls https://10.0.1.11:2379 \ 147 --initial-cluster-token etcd-cluster-1 \ 148 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 149 --initial-cluster-state new \ 150 --auto-tls \ 151 --peer-auto-tls 152``` 153``` 154$ etcd --name infra2 --initial-advertise-peer-urls https://10.0.1.12:2380 \ 155 --listen-peer-urls https://10.0.1.12:2380 \ 156 --listen-client-urls https://10.0.1.12:2379,https://127.0.0.1:2379 \ 157 --advertise-client-urls https://10.0.1.12:2379 \ 158 --initial-cluster-token etcd-cluster-1 \ 159 --initial-cluster infra0=https://10.0.1.10:2380,infra1=https://10.0.1.11:2380,infra2=https://10.0.1.12:2380 \ 160 --initial-cluster-state new \ 161 --auto-tls \ 162 --peer-auto-tls 163``` 164 165### Error cases 166 167In 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. 168 169``` 170$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ 171 --listen-peer-urls https://10.0.1.11:2380 \ 172 --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ 173 --advertise-client-urls http://10.0.1.11:2379 \ 174 --initial-cluster infra0=http://10.0.1.10:2380 \ 175 --initial-cluster-state new 176etcd: infra1 not listed in the initial cluster config 177exit 1 178``` 179 180In 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. 181 182``` 183$ etcd --name infra0 --initial-advertise-peer-urls http://127.0.0.1:2380 \ 184 --listen-peer-urls http://10.0.1.10:2380 \ 185 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 186 --advertise-client-urls http://10.0.1.10:2379 \ 187 --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ 188 --initial-cluster-state=new 189etcd: error setting up initial cluster: infra0 has different advertised URLs in the cluster and advertised peer URLs list 190exit 1 191``` 192 193If a peer is configured with a different set of configuration arguments and attempts to join this cluster, etcd will report a cluster ID mismatch will exit. 194 195``` 196$ etcd --name infra3 --initial-advertise-peer-urls http://10.0.1.13:2380 \ 197 --listen-peer-urls http://10.0.1.13:2380 \ 198 --listen-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379 \ 199 --advertise-client-urls http://10.0.1.13:2379 \ 200 --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra3=http://10.0.1.13:2380 \ 201 --initial-cluster-state=new 202etcd: conflicting cluster ID to the target cluster (c6ab534d07e8fcc4 != bc25ea2a74fb18b0). Exiting. 203exit 1 204``` 205 206## Discovery 207 208In a number of cases, the IPs of the cluster peers may not be known ahead of time. This is common when utilizing cloud providers or when the network uses DHCP. In these cases, rather than specifying a static configuration, use an existing etcd cluster to bootstrap a new one. This process is called "discovery". 209 210There two methods that can be used for discovery: 211 212* etcd discovery service 213* DNS SRV records 214 215### etcd discovery 216 217To better understand the design of the discovery service protocol, we suggest reading the discovery service protocol [documentation][discovery-proto]. 218 219#### Lifetime of a discovery URL 220 221A discovery URL identifies a unique etcd cluster. Instead of reusing an existing discovery URL, each etcd instance shares a new discovery URL to bootstrap the new cluster. 222 223Moreover, discovery URLs should ONLY be used for the initial bootstrapping of a cluster. To change cluster membership after the cluster is already running, see the [runtime reconfiguration][runtime-conf] guide. 224 225#### Custom etcd discovery service 226 227Discovery uses an existing cluster to bootstrap itself. If using a private etcd cluster, create a URL like so: 228 229``` 230$ curl -X PUT https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83/_config/size -d value=3 231``` 232 233By setting the size key to the URL, a discovery URL is created with an expected cluster size of 3. 234 235The URL to use in this case will be `https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83` and the etcd members will use the `https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83` directory for registration as they start. 236 237**Each member must have a different name flag specified. `Hostname` or `machine-id` can be a good choice. Or discovery will fail due to duplicated name.** 238 239Now we start etcd with those relevant flags for each member: 240 241``` 242$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ 243 --listen-peer-urls http://10.0.1.10:2380 \ 244 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 245 --advertise-client-urls http://10.0.1.10:2379 \ 246 --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 247``` 248``` 249$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ 250 --listen-peer-urls http://10.0.1.11:2380 \ 251 --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ 252 --advertise-client-urls http://10.0.1.11:2379 \ 253 --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 254``` 255``` 256$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ 257 --listen-peer-urls http://10.0.1.12:2380 \ 258 --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ 259 --advertise-client-urls http://10.0.1.12:2379 \ 260 --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 261``` 262 263This will cause each member to register itself with the custom etcd discovery service and begin the cluster once all machines have been registered. 264 265#### Public etcd discovery service 266 267If no exiting cluster is available, use the public discovery service hosted at `discovery.etcd.io`. To create a private discovery URL using the "new" endpoint, use the command: 268 269``` 270$ curl https://discovery.etcd.io/new?size=3 271https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 272``` 273 274This will create the cluster with an initial size of 3 members. If no size is specified, a default of 3 is used. 275 276``` 277ETCD_DISCOVERY=https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 278``` 279 280``` 281--discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 282``` 283 284**Each member must have a different name flag specified or else discovery will fail due to duplicated names. `Hostname` or `machine-id` can be a good choice. ** 285 286Now we start etcd with those relevant flags for each member: 287 288``` 289$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ 290 --listen-peer-urls http://10.0.1.10:2380 \ 291 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 292 --advertise-client-urls http://10.0.1.10:2379 \ 293 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 294``` 295``` 296$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ 297 --listen-peer-urls http://10.0.1.11:2380 \ 298 --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ 299 --advertise-client-urls http://10.0.1.11:2379 \ 300 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 301``` 302``` 303$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ 304 --listen-peer-urls http://10.0.1.12:2380 \ 305 --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ 306 --advertise-client-urls http://10.0.1.12:2379 \ 307 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 308``` 309 310This will cause each member to register itself with the discovery service and begin the cluster once all members have been registered. 311 312Use the environment variable `ETCD_DISCOVERY_PROXY` to cause etcd to use an HTTP proxy to connect to the discovery service. 313 314#### Error and warning cases 315 316##### Discovery server errors 317 318 319``` 320$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ 321 --listen-peer-urls http://10.0.1.10:2380 \ 322 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 323 --advertise-client-urls http://10.0.1.10:2379 \ 324 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 325etcd: error: the cluster doesn’t have a size configuration value in https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de/_config 326exit 1 327``` 328 329##### Warnings 330 331This is a harmless warning indicating the discovery URL will be ignored on this machine. 332 333``` 334$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ 335 --listen-peer-urls http://10.0.1.10:2380 \ 336 --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ 337 --advertise-client-urls http://10.0.1.10:2379 \ 338 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de 339etcdserver: discovery token ignored since a cluster has already been initialized. Valid log found at /var/lib/etcd 340``` 341 342### DNS discovery 343 344DNS [SRV records][rfc-srv] can be used as a discovery mechanism. 345The `-discovery-srv` flag can be used to set the DNS domain name where the discovery SRV records can be found. 346The following DNS SRV records are looked up in the listed order: 347 348* _etcd-server-ssl._tcp.example.com 349* _etcd-server._tcp.example.com 350 351If `_etcd-server-ssl._tcp.example.com` is found then etcd will attempt the bootstrapping process over TLS. 352 353To help clients discover the etcd cluster, the following DNS SRV records are looked up in the listed order: 354 355* _etcd-client._tcp.example.com 356* _etcd-client-ssl._tcp.example.com 357 358If `_etcd-client-ssl._tcp.example.com` is found, clients will attempt to communicate with the etcd cluster over SSL/TLS. 359 360If etcd is using TLS without a custom certificate authority, the discovery domain (e.g., example.com) must match the SRV record domain (e.g., infra1.example.com). This is to mitigate attacks that forge SRV records to point to a different domain; the domain would have a valid certificate under PKI but be controlled by an unknown third party. 361 362#### Create DNS SRV records 363 364``` 365$ dig +noall +answer SRV _etcd-server._tcp.example.com 366_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra0.example.com. 367_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra1.example.com. 368_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra2.example.com. 369``` 370 371``` 372$ dig +noall +answer SRV _etcd-client._tcp.example.com 373_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra0.example.com. 374_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra1.example.com. 375_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra2.example.com. 376``` 377 378``` 379$ dig +noall +answer infra0.example.com infra1.example.com infra2.example.com 380infra0.example.com. 300 IN A 10.0.1.10 381infra1.example.com. 300 IN A 10.0.1.11 382infra2.example.com. 300 IN A 10.0.1.12 383``` 384 385#### Bootstrap the etcd cluster using DNS 386 387etcd cluster members can listen on domain names or IP address, the bootstrap process will resolve DNS A records. 388 389The resolved address in `--initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. The etcd member reads the resolved address to find out if it belongs to the cluster defined in the SRV records. 390 391``` 392$ etcd --name infra0 \ 393--discovery-srv example.com \ 394--initial-advertise-peer-urls http://infra0.example.com:2380 \ 395--initial-cluster-token etcd-cluster-1 \ 396--initial-cluster-state new \ 397--advertise-client-urls http://infra0.example.com:2379 \ 398--listen-client-urls http://infra0.example.com:2379 \ 399--listen-peer-urls http://infra0.example.com:2380 400``` 401 402``` 403$ etcd --name infra1 \ 404--discovery-srv example.com \ 405--initial-advertise-peer-urls http://infra1.example.com:2380 \ 406--initial-cluster-token etcd-cluster-1 \ 407--initial-cluster-state new \ 408--advertise-client-urls http://infra1.example.com:2379 \ 409--listen-client-urls http://infra1.example.com:2379 \ 410--listen-peer-urls http://infra1.example.com:2380 411``` 412 413``` 414$ etcd --name infra2 \ 415--discovery-srv example.com \ 416--initial-advertise-peer-urls http://infra2.example.com:2380 \ 417--initial-cluster-token etcd-cluster-1 \ 418--initial-cluster-state new \ 419--advertise-client-urls http://infra2.example.com:2379 \ 420--listen-client-urls http://infra2.example.com:2379 \ 421--listen-peer-urls http://infra2.example.com:2380 422``` 423 424The cluster can also bootstrap using IP addresses instead of domain names: 425 426``` 427$ etcd --name infra0 \ 428--discovery-srv example.com \ 429--initial-advertise-peer-urls http://10.0.1.10:2380 \ 430--initial-cluster-token etcd-cluster-1 \ 431--initial-cluster-state new \ 432--advertise-client-urls http://10.0.1.10:2379 \ 433--listen-client-urls http://10.0.1.10:2379 \ 434--listen-peer-urls http://10.0.1.10:2380 435``` 436 437``` 438$ etcd --name infra1 \ 439--discovery-srv example.com \ 440--initial-advertise-peer-urls http://10.0.1.11:2380 \ 441--initial-cluster-token etcd-cluster-1 \ 442--initial-cluster-state new \ 443--advertise-client-urls http://10.0.1.11:2379 \ 444--listen-client-urls http://10.0.1.11:2379 \ 445--listen-peer-urls http://10.0.1.11:2380 446``` 447 448``` 449$ etcd --name infra2 \ 450--discovery-srv example.com \ 451--initial-advertise-peer-urls http://10.0.1.12:2380 \ 452--initial-cluster-token etcd-cluster-1 \ 453--initial-cluster-state new \ 454--advertise-client-urls http://10.0.1.12:2379 \ 455--listen-client-urls http://10.0.1.12:2379 \ 456--listen-peer-urls http://10.0.1.12:2380 457``` 458 459### Gateway 460 461etcd gateway is a simple TCP proxy that forwards network data to the etcd cluster. Please read [gateway guide] for more information. 462 463### Proxy 464 465When the `--proxy` flag is set, etcd runs in [proxy mode][proxy]. This proxy mode only supports the etcd v2 API; there are no plans to support the v3 API. Instead, for v3 API support, there will be a new proxy with enhanced features following the etcd 3.0 release. 466 467To setup an etcd cluster with proxies of v2 API, please read the the [clustering doc in etcd 2.3 release][clustering_etcd2]. 468 469[conf-adv-client]: configuration.md#--advertise-client-urls 470[conf-listen-client]: configuration.md#--listen-client-urls 471[discovery-proto]: ../dev-internal/discovery_protocol.md 472[rfc-srv]: http://www.ietf.org/rfc/rfc2052.txt 473[runtime-conf]: runtime-configuration.md 474[runtime-reconf-design]: runtime-reconf-design.md 475[proxy]: https://github.com/coreos/etcd/blob/release-2.3/Documentation/proxy.md 476[clustering_etcd2]: https://github.com/coreos/etcd/blob/release-2.3/Documentation/clustering.md 477[security-guide]: security.md 478[tls-setup]: ../../hack/tls-setup 479[gateway]: gateway.md 480