Skip to content

Latest commit

 

History

History
269 lines (206 loc) · 10.8 KB

configuration.md

File metadata and controls

269 lines (206 loc) · 10.8 KB

Configuration Flags

etcd is configurable through command-line flags and environment variables. Options set on the command line take precedence over those from the environment.

The format of environment variable for flag -my-flag is ETCD_MY_FLAG. It applies to all flags.

To start etcd automatically using custom settings at startup in Linux, using a systemd unit is highly recommended.

Member Flags

-name
  • Human-readable name for this member.
  • default: "default"
  • env variable: ETCD_NAME
  • This value is referenced as this node's own entries listed in the -initial-cluster flag (Ex: default=http://localhost:2380 or default=http://localhost:2380,default=http://localhost:7001). This needs to match the key used in the flag if you're using static bootstrapping. When using discovery, each member must have a unique name. Hostname or machine-id can be a good choice.
-data-dir
  • Path to the data directory.
  • default: "${name}.etcd"
  • env variable: ETCD_DATA_DIR
-wal-dir
  • Path to the dedicated wal directory. If this flag is set, etcd will write the WAL files to the walDir rather than the dataDir. This allows a dedicated disk to be used, and helps avoid io competition between logging and other IO operations.
  • default: ""
  • env variable: ETCD_WAL_DIR
-snapshot-count
  • Number of committed transactions to trigger a snapshot to disk.
  • default: "10000"
  • env variable: ETCD_SNAPSHOT_COUNT
-heartbeat-interval
  • Time (in milliseconds) of a heartbeat interval.
  • default: "100"
  • env variable: ETCD_HEARTBEAT_INTERVAL
-election-timeout
  • Time (in milliseconds) for an election to timeout. See Documentation/tuning.md for details.
  • default: "1000"
  • env variable: ETCD_ELECTION_TIMEOUT
-listen-peer-urls
-listen-client-urls
-max-snapshots
  • Maximum number of snapshot files to retain (0 is unlimited)
  • default: 5
  • env variable: ETCD_MAX_SNAPSHOTS
  • The default for users on Windows is unlimited, and manual purging down to 5 (or your preference for safety) is recommended.
-max-wals
  • Maximum number of wal files to retain (0 is unlimited)
  • default: 5
  • env variable: ETCD_MAX_WALS
  • The default for users on Windows is unlimited, and manual purging down to 5 (or your preference for safety) is recommended.
-cors
  • Comma-separated white list of origins for CORS (cross-origin resource sharing).
  • default: none
  • env variable: ETCD_CORS

Clustering Flags

-initial prefix flags are used in bootstrapping (static bootstrap, discovery-service bootstrap or runtime reconfiguration) a new member, and ignored when restarting an existing member.

-discovery prefix flags need to be set when using discovery service.

-initial-advertise-peer-urls
-initial-cluster
-initial-cluster-state
  • Initial cluster state ("new" or "existing"). Set to new for all members present during initial static or DNS bootstrapping. If this option is set to existing, etcd will attempt to join the existing cluster. If the wrong value is set, etcd will attempt to start but fail safely.
  • default: "new"
  • env variable: ETCD_INITIAL_CLUSTER_STATE
-initial-cluster-token
  • Initial cluster token for the etcd cluster during bootstrap.
  • default: "etcd-cluster"
  • env variable: ETCD_INITIAL_CLUSTER_TOKEN
-advertise-client-urls
-discovery
  • Discovery URL used to bootstrap the cluster.
  • default: none
  • env variable: ETCD_DISCOVERY
-discovery-srv
  • DNS srv domain used to bootstrap the cluster.
  • default: none
  • env variable: ETCD_DISCOVERY_SRV
-discovery-fallback
  • Expected behavior ("exit" or "proxy") when discovery services fails.
  • default: "proxy"
  • env variable: ETCD_DISCOVERY_FALLBACK
-discovery-proxy
  • HTTP proxy to use for traffic to discovery service.
  • default: none
  • env variable: ETCD_DISCOVERY_PROXY
-strict-reconfig-check
  • Reject reconfiguration requests that would cause quorum loss.
  • default: false
  • env variable: ETCD_STRICT_RECONFIG_CHECK

Proxy Flags

-proxy prefix flags configures etcd to run in proxy mode.

-proxy
  • Proxy mode setting ("off", "readonly" or "on").
  • default: "off"
  • env variable: ETCD_PROXY
-proxy-failure-wait
  • Time (in milliseconds) an endpoint will be held in a failed state before being reconsidered for proxied requests.
  • default: 5000
  • env variable: ETCD_PROXY_FAILURE_WAIT
-proxy-refresh-interval
  • Time (in milliseconds) of the endpoints refresh interval.
  • default: 30000
  • env variable: ETCD_PROXY_REFRESH_INTERVAL
-proxy-dial-timeout
  • Time (in milliseconds) for a dial to timeout or 0 to disable the timeout
  • default: 1000
  • env variable: ETCD_PROXY_DIAL_TIMEOUT
-proxy-write-timeout
  • Time (in milliseconds) for a write to timeout or 0 to disable the timeout.
  • default: 5000
  • env variable: ETCD_PROXY_WRITE_TIMEOUT
-proxy-read-timeout
  • Time (in milliseconds) for a read to timeout or 0 to disable the timeout.
  • Don't change this value if you use watches because they are using long polling requests.
  • default: 0
  • env variable: ETCD_PROXY_READ_TIMEOUT

Security Flags

The security flags help to build a secure etcd cluster.

-ca-file [DEPRECATED]
  • Path to the client server TLS CA file. -ca-file ca.crt could be replaced by -trusted-ca-file ca.crt -client-cert-auth and etcd will perform the same.
  • default: none
  • env variable: ETCD_CA_FILE
-cert-file
  • Path to the client server TLS cert file.
  • default: none
  • env variable: ETCD_CERT_FILE
-key-file
  • Path to the client server TLS key file.
  • default: none
  • env variable: ETCD_KEY_FILE
-client-cert-auth
  • Enable client cert authentication.
  • default: false
  • env variable: ETCD_CLIENT_CERT_AUTH
-trusted-ca-file
  • Path to the client server TLS trusted CA key file.
  • default: none
  • env variable: ETCD_TRUSTED_CA_FILE
-peer-ca-file [DEPRECATED]
  • Path to the peer server TLS CA file. -peer-ca-file ca.crt could be replaced by -peer-trusted-ca-file ca.crt -peer-client-cert-auth and etcd will perform the same.
  • default: none
  • env variable: ETCD_PEER_CA_FILE
-peer-cert-file
  • Path to the peer server TLS cert file.
  • default: none
  • env variable: ETCD_PEER_CERT_FILE
-peer-key-file
  • Path to the peer server TLS key file.
  • default: none
  • env variable: ETCD_PEER_KEY_FILE
-peer-client-cert-auth
  • Enable peer client cert authentication.
  • default: false
  • env variable: ETCD_PEER_CLIENT_CERT_AUTH
-peer-trusted-ca-file
  • Path to the peer server TLS trusted CA file.
  • default: none
  • env variable: ETCD_PEER_TRUSTED_CA_FILE

Logging Flags

-debug
  • Drop the default log level to DEBUG for all subpackages.
  • default: false (INFO for all packages)
  • env variable: ETCD_DEBUG
-log-package-levels
  • Set individual etcd subpackages to specific log levels. An example being etcdserver=WARNING,security=DEBUG
  • default: none (INFO for all packages)
  • env variable: ETCD_LOG_PACKAGE_LEVELS

Unsafe Flags

Please be CAUTIOUS when using unsafe flags because it will break the guarantees given by the consensus protocol. For example, it may panic if other members in the cluster are still alive. Follow the instructions when using these flags.

-force-new-cluster
  • Force to create a new one-member cluster. It commits configuration changes in force to remove all existing members in the cluster and add itself. It needs to be set to restore a backup.
  • default: false
  • env variable: ETCD_FORCE_NEW_CLUSTER

Experimental Flags

-experimental-v3demo
  • Enable experimental v3 demo API.
  • default: false
  • env variable: ETCD_EXPERIMENTAL_V3DEMO

Miscellaneous Flags

-version
  • Print the version and exit.
  • default: false