tech:notes_etcd
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_etcd [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_etcd [2026/06/04 10:15] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes etcd | ||
| + | |||
| + | Voir aussi : | ||
| + | * [[Notes CouchDB|CouchDB]] | ||
| + | |||
| + | Python : | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ## Intro | ||
| + | |||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ## Install | ||
| + | |||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ~~~bash | ||
| + | apt install etcd-client | ||
| + | apt-get install etcd | ||
| + | ~~~ | ||
| + | |||
| + | ## Config | ||
| + | |||
| + | ### Droits | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ## Exemples basiques | ||
| + | |||
| + | Lancement | ||
| + | ~~~bash | ||
| + | etcd | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Connexion | ||
| + | ~~~bash | ||
| + | etcdctl --endpoints http:// | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Put | ||
| + | ~~~bash | ||
| + | etcdctl put greeting " | ||
| + | ~~~ | ||
| + | |||
| + | Get | ||
| + | ~~~bash | ||
| + | ETCDCTL_API=3 etcdctl get greeting | ||
| + | etcdctl get foo --print-value-only | ||
| + | etcdctl get --prefix --rev=4 foo | ||
| + | etcdctl watch foo --hex | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | etcdctl --no-sync --peers https// | ||
| + | |||
| + | alias e=' | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | etcdctl mk x 3 | ||
| + | etcdctl mk y 123 | ||
| + | etcdctl ls | ||
| + | etcdctl get /y | ||
| + | etcdctl set new 6 | ||
| + | etcdctl set d/a 4 | ||
| + | etcdctl set d/b 5 | ||
| + | etcdctl ls d | ||
| + | etcdctl rm --recursive d | ||
| + | |||
| + | # TTL of 5 seconds | ||
| + | etcdctl mk e 4 --ttl " | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | export ETCDCTL_API=3 | ||
| + | export ETCDCTL_ENDPOINTS=$(minikube service example-etcd-cluster-client-service --url) | ||
| + | ~~~ | ||
| + | |||
| + | backup (cluster & local) | ||
| + | Voir https:// | ||
| + | ~~~bash | ||
| + | ETCDCTL_API=3 etcdctl --endpoints $ENDPOINT snapshot save snapshot.db #--cacert / | ||
| + | ~~~ | ||
| + | |||
| + | Verify the snapshot: | ||
| + | ~~~bash | ||
| + | ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshotdb | ||
| + | ~~~ | ||
| + | |||
| + | Restore (local) | ||
| + | ~~~bash | ||
| + | ETCDCTL_API=3 etcdctl snapshot restore snapshot.db | ||
| + | ~~~ | ||
| + | |||
| + | grpc-proxy | ||
| + | ~~~bash | ||
| + | etcd grpc-proxy start --endpoints=infra0.example.com, | ||
| + | ~~~ | ||
| + | |||
| + | ## Tuning | ||
| + | |||
| + | IO | ||
| + | ~~~bash | ||
| + | # best effort, highest priority | ||
| + | sudo ionice -c2 -n0 -p `pgrep etcd` | ||
| + | ~~~ | ||
| + | |||
| + | CPU | ||
| + | ~~~bash | ||
| + | echo performance | tee / | ||
| + | ~~~ | ||
| + | |||
| + | ## Diag | ||
| + | |||
| + | ~~~bash | ||
| + | sudo chown -R etcd:etcd / | ||
| + | sudo systemctl start etcd | ||
| + | ~~~ | ||
| + | |||
| + | List the cluster member: | ||
| + | ~~~bash | ||
| + | etcdctl --endpoints=http:// | ||
| + | ~~~ | ||
| + | |||
| + | ## Client API Python | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ## Autre | ||
| + | |||
| + | ### pas de type list ? | ||
| + | |||
| + | Voir https:// | ||
| + | |||
| + | |||
| + | etcd doesn' | ||
| + | |||
| + | JSON Input: | ||
| + | ~~~javascript | ||
| + | { | ||
| + | " | ||
| + | { " | ||
| + | { " | ||
| + | ] | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | Result in etcd: | ||
| + | ~~~ | ||
| + | users/ | ||
| + | users/ | ||
| + | users/ | ||
| + | users/ | ||
| + | users/ | ||
| + | users/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
