Introduction
Problem
While trying to restore a Vault snapshot the following error occurs
$ vault operator raft snapshot restore -force vault.snap
Error installing the snapshot: Error making API request.
URL: POST http://localhost:8200/v1/sys/storage/raft/snapshot-force
Code: 500. Errors:
* failed to read request body
Cause
Usually this error occurs while restoring a large snapshot and the request could not be read within the default 60s timeout of the Vault agent running the command.
Solutions:
The Vault agent has a timeout which defaults to 60s.
This timeout can be configured via the system variableVAULT_CLIENT_TIMEOUT
Example:
In this specific case the snapshot has the size of 8GB
$ export VAULT_CLIENT_TIMEOUT=300s
$ vault operator raft snapshot restore -force vault.snap
Outcome
The restore of the snapshot completes without error after increase the value of VAULT_CLIENT_TIMEOUT