Last active
June 4, 2020 01:33
-
-
Save dkeightley/ec84d316de2aa558595305427bf46142 to your computer and use it in GitHub Desktop.
etcd-objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Run within a etcd container | |
# etcd object sizes | |
export ETCDCTL_API=3 | |
for key in `etcdctl get --prefix --keys-only /` | |
do | |
size=`etcdctl get $key --print-value-only | wc -c` | |
versions=`etcdctl get $key --write-out=fields | grep \"Version\" | cut -f2 -d':'` | |
total=$(( $size * $versions)) | |
echo $total $size $versions $key >> /tmp/etcdkeys.txt | |
done | |
sort -n /tmp/etcdkeys.txt | |
## Run from the etcd node | |
# etcd object counts | |
docker exec etcd etcdctl get /registry --prefix=true --keys-only | grep -v ^$ | awk -F'/' '{ if ($3 ~ /cattle.io/) {h[$3"/"$4]++} else { h[$3]++ }} END { for(k in h) print h[k], k }' | sort -n > etcd-count-objecttype.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment