Difference between revisions of "Etcd"
(23 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[wikipedia: | + | {{lc}} |
+ | [[wikipedia:etcd]] is a distributed [[key-value]] store that uses the [[Raft]] consensus algorithm to manage a highly-available replicated store, it is used as a software component for software such as [[CoreOS]] [[Container Linux]] or [[Kubernetes]] and for many organizations such as wikipedia<ref> https://wikitech.wikimedia.org/wiki/Etcd</ref> | ||
Latency is an important metric as Raft is only as fast as the slowest machine in the majority. | Latency is an important metric as Raft is only as fast as the slowest machine in the majority. | ||
Line 5: | Line 6: | ||
Since etcd’s consensus protocol depends on persistently storing metadata to a log, a majority of etcd cluster members must write every request down to disk | Since etcd’s consensus protocol depends on persistently storing metadata to a log, a majority of etcd cluster members must write every request down to disk | ||
− | Beside the configuration management, etcd also provides [[service discovery]] by allowing deployed applications to announce themselves and the services they offer. Communication with etcd is performed through an exposed REST-based API, which internally uses JSON on top of HTTP; the API may be used directly (through curl or wget, for example), or indirectly through<code>[[ | + | Beside the configuration management, etcd also provides [[service discovery]] by allowing deployed applications to announce themselves and the services they offer. Communication with etcd is performed through an exposed REST-based API, which internally uses JSON on top of HTTP; the API may be used directly (through curl or wget, for example), or indirectly through<code>[[etcdctl]]</code> command. |
A simple use case is storing database connection details or feature flags in etcd as key-value pairs. | A simple use case is storing database connection details or feature flags in etcd as key-value pairs. | ||
Line 12: | Line 13: | ||
=== Adding a new member to the cluster === | === Adding a new member to the cluster === | ||
To add a new server called <kbd>conf1001.example.com</kbd> to our cluster, using the <kbd>etcdctl</kbd> tool: | To add a new server called <kbd>conf1001.example.com</kbd> to our cluster, using the <kbd>etcdctl</kbd> tool: | ||
− | + | [[etcdctl -C]] https://etcd1001.example.com:2379 member add conf1001 http://conf1001.example.com:2380 | |
− | + | Added member named conf1001 with ID 5f62a924ac85910 to cluster | |
− | Added member named conf1001 with ID 5f62a924ac85910 to cluster | ||
− | ETCD_NAME="conf1001" | + | ETCD_NAME="conf1001" |
− | # Next line is broken down artificially for ease of reading | + | # Next line is broken down artificially for ease of reading |
− | ETCD_INITIAL_CLUSTER="conf1001=http://conf1001.example.com:2380, | + | ETCD_INITIAL_CLUSTER="conf1001=http://conf1001.example.com:2380, |
− | + | etcd1001=http://etcd1001.example.com:2380, | |
− | ETCD_INITIAL_CLUSTER_STATE="existing" | + | ETCD_INITIAL_CLUSTER_STATE="existing" |
− | |||
== etcd ports == | == etcd ports == | ||
TCP Ports 2379 for client communication and on port 2380 for server-to-server communication needs to be open <ref>https://github.com/etcd-io/etcd</ref> | TCP Ports 2379 for client communication and on port 2380 for server-to-server communication needs to be open <ref>https://github.com/etcd-io/etcd</ref> | ||
+ | |||
+ | == CKA == | ||
+ | * [[CKA 1.23]]-[[CKA 1.20]] [[Implement etcd backup and restore]] | ||
+ | |||
+ | == Related == | ||
+ | * [[Apache Zookeeper]] | ||
+ | * <code>[[:2379/health]]</code> | ||
+ | * <code>[[kubectl -n kube-system get pod]]</code> | ||
+ | /etc/kubernetes/pki/etcd/ca.crt | ||
+ | /etc/kubernetes/pki/etcd/server.crt | ||
+ | /etc/kubernetes/pki/etcd/server.key | ||
+ | [[Rancher]]: https://hub.docker.com/r/rancher/mirrored-coreos-etcd | ||
+ | |||
+ | * <code>[[docker logs etcd]]</code> | ||
== See also == | == See also == | ||
− | * {{ | + | * {{etcd}} |
− | |||
− | |||
* {{Key-value databases}} | * {{Key-value databases}} | ||
Line 36: | Line 47: | ||
[[Category:Server administration]] | [[Category:Server administration]] | ||
+ | [[Category:Kubernetes]] | ||
+ | [[Category:Etcd]] |
Latest revision as of 08:33, 21 December 2023
wikipedia:etcd is a distributed key-value store that uses the Raft consensus algorithm to manage a highly-available replicated store, it is used as a software component for software such as CoreOS Container Linux or Kubernetes and for many organizations such as wikipedia[1]
Latency is an important metric as Raft is only as fast as the slowest machine in the majority.
Since etcd’s consensus protocol depends on persistently storing metadata to a log, a majority of etcd cluster members must write every request down to disk
Beside the configuration management, etcd also provides service discovery by allowing deployed applications to announce themselves and the services they offer. Communication with etcd is performed through an exposed REST-based API, which internally uses JSON on top of HTTP; the API may be used directly (through curl or wget, for example), or indirectly throughetcdctl
command.
A simple use case is storing database connection details or feature flags in etcd as key-value pairs.
Contents
Basic etcd Operation[edit]
Adding a new member to the cluster[edit]
To add a new server called conf1001.example.com to our cluster, using the etcdctl tool:
etcdctl -C https://etcd1001.example.com:2379 member add conf1001 http://conf1001.example.com:2380 Added member named conf1001 with ID 5f62a924ac85910 to cluster
ETCD_NAME="conf1001" # Next line is broken down artificially for ease of reading ETCD_INITIAL_CLUSTER="conf1001=http://conf1001.example.com:2380, etcd1001=http://etcd1001.example.com:2380, ETCD_INITIAL_CLUSTER_STATE="existing"
etcd ports[edit]
TCP Ports 2379 for client communication and on port 2380 for server-to-server communication needs to be open [2]
CKA[edit]
Related[edit]
/etc/kubernetes/pki/etcd/ca.crt /etc/kubernetes/pki/etcd/server.crt /etc/kubernetes/pki/etcd/server.key Rancher: https://hub.docker.com/r/rancher/mirrored-coreos-etcd
See also[edit]
- etcd,
etcdctl, etcdctl snapshot save
, etcd versions,etcdHighNumberOfFailedGRPCRequests
- Key-value databases: Berkeley DB, Redis,
etcd
, leveldb, RocksDB (MyRocks), Infinispan, Amazon DynamoDB, Apache Zookeeper, LevelDB, RocksDB, Pebble
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Advertising: