Über Open CoDE Software Wiki Diskussionen GitLab

Skip to content

Update etcd defrag and backup

Kurt Garloff requested to merge 384_update_defrag_backup_etcd into main

Created by: matofeder

This PR updates etcd defragmentation and backup script as follows:

  • Script exits without any defragmentation/backup/trim action if:

    • It is executed on non leader etcd member
    • It is executed on etcd cluster with some unhealthy member
    • It is executed on single member etcd cluster
  • Conditions above could be skipped and the script execution could be forced by the optional arguments:

    • --force-single
    • --force-unhealthy
    • --force-nonleader
  • Script then defragments the etcd cluster as follows:

    • Defrag the non leader etcd members first
    • Change the leadership to the randomly selected and defragmentation completed etcd member
    • Defrag the local (ex-leader) etcd member
  • Script then backup & trim local (ex-leader) etcd member

Note: This script executes etcdctl commands like etcdctl move-leader or etcdctl endpoint status --cluster which were introduced in etcdctl version 3.3.0. The previous etcdctl client was installed as an apt package. The latest etcdctl version available in Ubuntu 20.04 repositories is v3.2.26, hence this PR also installs the desired version of etcdctl client. Etcdctl client is then used for etcd DB maintenance tasks.

Closes #384 (closed)

Merge request reports

Loading