An application is using Consul KV to store configuration. You notice that the KV store is becoming large. What is the most efficient way to retrieve only the keys under the prefix "service/web/"?
Trap 1: Set the depth parameter to 1.
Depth is not a parameter for the standard Consul KV API.
Trap 2: Use the index parameter with value 0.
Index is for long polling.
Trap 3: Use the keys parameter with the prefix.
While keys can be used, recurse is the standard approach to retrieve the full tree.
- A
Set the depth parameter to 1.
Why it fails: Depth is not a parameter for the standard Consul KV API.
- B
Use the index parameter with value 0.
Why it fails: Index is for long polling.
- C
Use the keys parameter with the prefix.
Why it fails: While keys can be used, recurse is the standard approach to retrieve the full tree.
- D
Use the recurse=true parameter in the query string.
Recurse=true returns all keys sharing the specified prefix.