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/"?
You need to ensure that a value written to the KV store is persisted to disk on a majority of Consul servers before returning. Which parameter affects this?
You need to store a small JSON configuration blob in Consul KV and later retrieve it exactly as written. Which Consul CLI command should you use to write the value from a file named config.json to the key app/config?
You are using Consul KV to store feature flags. A service instance reads a flag using a blocking query with a wait time of 5 minutes. After 3 minutes, the flag is updated. The service instance expects to receive the new value immediately. However, it does not receive an update until the full 5 minutes elapse. What is the most likely reason for this behavior?
You are using the Consul KV store to store feature flags. You want to ensure that a read request returns the most up-to-date value, even if it means increased latency. Which consistency mode should you use for the KV read operation?
A CI pipeline writes build artifacts metadata under `ci/builds/`. An operator needs to remove the entire `ci/builds/` subtree, including all nested keys, in a single command without affecting `ci/other/`. Which command accomplishes this?
You are using Consul KV to store feature flags for a distributed application. You need to perform a transaction that atomically updates two keys: one to enable a feature and another to set its rollout percentage. Which two Consul KV operations can be combined in a single transaction to achieve this? (Choose two.)
You are using the Consul KV store to coordinate a rolling deployment. A service instance acquires a lock on the key 'deploy/lock' with a session that has a TTL of 30 seconds. The instance crashes, but the Consul agent on that node remains healthy and continues to send TTL renewals because the application process that owned the session was separate from the agent. What will happen to the lock?
You are designing a system that uses Consul KV to store configuration data. You need to ensure that reads are highly available and can tolerate stale data, while writes must be strongly consistent. Which TWO of the following statements are true regarding Consul's consistency modes for KV operations? (Choose two.)
A service reads a KV key that holds a leader-election lock value and must never receive data older than its previous read, even if that means contacting the leader over extra network hops. Which read behavior should the operator request from the KV API?
A Consul operator is using the KV store to store feature flags. They notice that after updating a key with `consul kv put feature/new-ui true`, some Consul agents return the old value `false` for a short period. They need to ensure that all reads reflect the latest write immediately. Which consistency mode should they use when reading the key?
You are designing a system that uses Consul KV to store feature flags. You need to ensure that when a key is updated, all watchers receive the new value with minimal delay, and that the update is visible to all Consul servers before any watcher reads it. Which Consul KV write consistency mode should you use?
You need to store a binary value in Consul KV using the CLI. The value is a small PNG image. Which command correctly stores the file 'logo.png' under the key 'images/logo'?
You need to store a configuration value in Consul KV that will be read by multiple services. The value is a JSON object. Which Consul KV CLI command should you use to store this value from a file?
An application uses Consul sessions to hold a lock on the KV key `locks/primary` and must ensure the lock is released if the holder dies. Which two behaviors correctly describe how Consul sessions interact with that KV lock? (Choose two.)
You are using Consul KV to store feature flags. You want to ensure that when a client reads a key, it gets the most up-to-date value, even if it means a slightly higher latency. Which consistency mode should the client use when querying the KV store?
You are using Consul KV to store dynamic configuration for a service. You want to receive notifications whenever a specific key changes, so that the service can reload its configuration. You decide to use Consul's blocking queries. Which parameter must you include in your HTTP GET request to the KV endpoint to implement a blocking query?
You are using the Consul CLI to manage KV data. You want to create a new key named 'config/db/host' with the value 'db.example.com'. Which command should you run?
You are managing a Consul KV store and need to perform operations that involve sessions. Which two of the following statements are true regarding Consul sessions and their interaction with the KV store? (Choose two.)
A developer writes application configuration to `config/web/db_url` and wants the application to block until that key's value changes rather than polling every second. The application must receive the new value and the index at which the change occurred, and it should wait up to five minutes for a change. Which request satisfies this requirement?
You are using Consul KV to store application configuration. You need to retrieve all keys under the prefix 'app/config/' and also see the metadata for each key, such as the number of times it has been modified. Which TWO of the following approaches will provide both the keys and their metadata? (Choose two.)
You are using Consul KV to store application configuration. You need to update a key's value and ensure that the update only succeeds if the key's current value matches a specific value you provide. Which Consul KV operation should you use?
You are designing a leader-election mechanism using Consul KV and sessions for a cluster of workers. You need to ensure that only one worker holds leadership at a time and that leadership is automatically relinquished if a worker dies. Which two statements about Consul session-based locking are true? (Choose two.)
A developer is using the Consul KV store to coordinate a distributed batch processing system. They need to atomically acquire a lock on a key to ensure only one worker processes a batch at a time. They have created a Consul session and want to use the KV API to acquire the lock. Which two HTTP API endpoints should they use to acquire and release the lock? (Choose two.)
You are configuring a Consul Watch to trigger a script whenever a specific KV key changes. Which type of watch should you define in your configuration file?
You have implemented a leader election mechanism using Consul KV sessions. The session has a TTL of 15 seconds. If the application crashes, how long will it take for the lock to be automatically released?
You want to perform a blocking query on a KV key to watch for updates. Which parameter must you provide in your request based on the last observed index?
You need to perform a write operation to the Consul KV store that only succeeds if the current ModifyIndex of the key is zero. Which parameter should you include in your API call?
You want to perform a list operation on a KV prefix to see all keys, but you don't want the values returned. Which API parameter helps reduce payload size?
You are using a Consul KV entry to store a feature flag. You want the flag to be automatically deleted if the node that owns it becomes unhealthy. Which Consul API operation should you use?
You are designing a configuration system where multiple instances of a service must coordinate to elect a single leader using Consul KV. Which two statements accurately describe how to implement leader election with sessions? (Choose two.)
A developer has stored the database connection string under the Consul KV path `config/db/primary`. A configuration management script needs to fetch this value as raw text so it can be exported directly into an environment variable. Which Consul CLI command retrieves only the value of that key?
An operator writes a feature flag to `app/features/new-ui` using `consul kv put app/features/new-ui true`. Later, a health-check script reads that key and receives an error instead of the value. The operator confirms the key exists with `consul kv get app/features/new-ui`. Which command should the operator run to inspect the metadata that would reveal a problem such as a missing or expired session on the key?
A developer uses the Consul KV store to coordinate a rolling deployment. They write a key `deploy/status` with the value `in-progress` using `consul kv put deploy/status in-progress`. Later, they want to check the current value of that key without any blocking or long-polling behavior. Which command should they run?
A developer stores a feature flag at the key `config/features/new-ui` in Consul KV and wants to atomically create it only if it does not already exist, failing the write if the key is present. Which Consul CLI command accomplishes this?
You are designing a distributed leader election system using Consul. A service instance must hold a lock on the KV key 'service/leader' to become the leader. You need to ensure that if the instance crashes or loses network connectivity, the lock is automatically released so another instance can acquire it. Which Consul feature should you use to achieve this?
A team stores rolling deployment state under `deploy/current`. To avoid a race where two operators both believe they own the release, the application must acquire the key only if it is not already held, and it must automatically release the key if the holding process dies. Which combination of Consul primitives achieves this?
A platform team stores feature-flag values under the prefix `config/features/`. They need to read the single key `config/features/checkout` and receive its value along with metadata such as `CreateIndex` and `ModifyIndex` in the response. Which Consul CLI command accomplishes this?
You are deploying a service that must store a critical configuration value in Consul KV. The value must only be visible to services with a token that has read access to that specific key. You also need to ensure that any write to the key can only be performed by a token with write access. Which Consul feature should you use?
An operator wants to create a distributed lock using the Consul KV store and sessions. They create a session with `consul session create` and obtain a session ID. They then attempt to acquire a lock on the key `locks/primary` by running `consul kv put -acquire locks/primary leader1`. The command fails with an error indicating the lock is already held. Which of the following best explains why the lock acquisition failed?
An operator needs to delete the single KV entry `app/temp/cache-ttl` but must leave every other key under `app/temp/` untouched. Which command performs exactly that deletion?
An operator wants to atomically create a key `locks/leader` only if it does not already exist, so that two competing processes cannot both become leader. Which Consul KV operation should be used?
A team is using the Consul KV store to store application configuration. They want to implement a watch that runs a script whenever the value of the key `config/app` changes. Which two of the following statements are true regarding Consul KV watches? (Choose two.)
A system administrator needs to delete a single key named `temp/config` from the Consul KV store. They want to ensure that only that key is removed and no other keys are affected. Which command should they use?
A team wants to store structured configuration for several microservices in Consul's KV store and retrieve an entire service's configuration with a single CLI call. They plan to keep all keys for `payments` under `services/payments/`. Which command retrieves every key under that prefix in one invocation?
You are deploying a service that requires distributed locking with automatic release if the service instance fails. You have created a session named 'lock-session' and acquired a lock on the KV key 'locks/db'. After a few minutes, the lock is unexpectedly released even though the service instance is still running. Which action should you take to diagnose the most likely cause?
You need to store a value in Consul KV that will be read by a service. The value should be retrievable by a simple HTTP GET request to the Consul API. Which HTTP endpoint should you use to read the value of a key named 'app/config/db_host'?
An engineer is designing a service that must coordinate access to a shared resource using Consul KV sessions and needs to understand the guarantees the lock provides. Which TWO statements accurately describe how Consul's KV locking with sessions behaves? (Choose two.)
You are deploying a blue/green release where the active environment is selected by the value of the Consul KV key `deploy/active-color`, currently set to `blue`. Your CI pipeline must atomically switch the value to `green` but only if the current value is still `blue`, and must fail if another pipeline already changed it. Which API operation should the pipeline use?
You are using Consul KV to coordinate a distributed job scheduler. A worker acquires a lock on a key to ensure only one worker runs a job at a time. The lock is tied to a session. The worker crashes and the session expires after its TTL. What happens to the lock on the key?
A developer needs to remove an obsolete configuration key `app/legacy/timeout` from Consul's KV store so the application no longer reads it. Which command deletes this single key?
An operator runs `consul kv put config/app/timeout 30s` and then `consul kv get config/app/timeout`. The second command prints only `30s` with no metadata. The operator wants to see the key's `CreateIndex`, `ModifyIndex`, and `Flags` from the command line without writing code against the HTTP API. Which command should be used?
A microservice uses a Consul session with a 30-second TTL and holds a lock on `locks/leader` via `acquire`. The service process is alive and healthy but its network link to the Consul servers is severed for several minutes. When connectivity is restored, the service finds it no longer owns the lock. Which behavior explains this outcome?
An operator wants to list every key beneath the `services/web/` prefix, including nested paths, and see each key's associated flags and modify index. Which command returns that information?
You are implementing a distributed semaphore using Consul KV and sessions. You create a session with a TTL of 60 seconds and use the 'acquire' parameter to lock a key. After acquiring the lock, the application holding the session experiences a 90-second pause due to a garbage collection stop-the-world event. The Consul agent on the node is healthy and continues to renew the session. What happens to the lock?
A platform team stores service configuration under the Consul KV prefix `config/web/`. An operator runs `consul kv put config/web/timeout 30` at a time when the key already exists with value `45` and ModifyIndex `812`. The operator later needs to update the value only if no one else has changed the key since that write. Which Consul CLI invocation correctly performs this compare-and-swap using the index returned by the prior write?
A security team stores application secrets under the Consul KV prefix `app/prod/`. They want to be notified whenever any key under that prefix changes, without repeatedly polling the entire prefix. They have access to the Consul HTTP API and the `consul watch` command. Which approach should they use?
An operator needs to update the value of `config/database/url` in Consul KV, but only if the current value is exactly `postgres://old:5432`. They want to use the Consul CLI to perform a compare-and-swap operation. Which command should they use?