0

I need to analyze a very large etcd key value database that I have no previous knowledge of or schema documentation.

Using etcdctl I would just want to list top-level keys so I can start mind-mapping the structure.

So lets say my etcd store (extremely simplified) has these keys:

/foo/bar/zoo/1
/foo/bar/school/0
/sol/bar/zoo/1
/sol/q/bee/1
/sol/q/bee/2
/sol/q/zee/4
/sol/los/zee/4

In this example, I would just want to see foo and sol on my output, nothing more. This gives me knowledge on the top level schema within this store when there is a massive KV database I need to analyze.

Furthermore, I would like to drill down layer by layer, so I could show the top 2 levels, which would give me /foo/bar, /sol/bar, /sol/q, and /sol/los. Or 3 levels, 4 levels, etc etc.

I know I can do etcdctl get / --prefix --keys-only but this lists every key. I then need to manipulate the output (with awk/sort -u, etc) but I was hoping that etcdctl has a native way to drill down levels in the tree. For example if I wanted to show X number of levels.

I checked --help but nothing jumped out at me. Wondering if anyone had any tricks or ideas to analyze tree levels in etcd without having to parse a full set of results.

Rino Bino
  • 366
  • 3
  • 15

0 Answers0