mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-11 01:42:06 -04:00
Guard against using Raft as a seperate HA Storage (#8239)
* Guard against using Raft as a seperate HA Storage * Document that Raft cannot be used as a seperate ha_storage backend at this time * remove duplicate imports from updating with master
This commit is contained in:
parent
099eb060ba
commit
e87f01845c
3 changed files with 20 additions and 1 deletions
|
|
@ -1132,6 +1132,12 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
// Initialize the separate HA storage backend, if it exists
|
||||
var ok bool
|
||||
if config.HAStorage != nil {
|
||||
// TODO: Remove when Raft can server as the ha_storage backend.
|
||||
// See https://github.com/hashicorp/vault/issues/8206
|
||||
if config.HAStorage.Type == "raft" {
|
||||
c.UI.Error("Raft cannot be used as seperate HA storage at this time")
|
||||
return 1
|
||||
}
|
||||
factory, exists := c.PhysicalBackends[config.HAStorage.Type]
|
||||
if !exists {
|
||||
c.UI.Error(fmt.Sprintf("Unknown HA storage type %s", config.HAStorage.Type))
|
||||
|
|
|
|||
|
|
@ -1018,6 +1018,13 @@ func (l *RaftLock) Lock(stopCh <-chan struct{}) (<-chan struct{}, error) {
|
|||
// Cache the notifyCh locally
|
||||
leaderNotifyCh := l.b.raftNotifyCh
|
||||
|
||||
// TODO: Remove when Raft can server as the ha_storage backend. The internal
|
||||
// raft pointer should not be nil here, but the nil check is a guard against
|
||||
// https://github.com/hashicorp/vault/issues/8206
|
||||
if l.b.raft == nil {
|
||||
return nil, errors.New("attempted to grab a lock on a nil raft backend")
|
||||
}
|
||||
|
||||
// Check to see if we are already leader.
|
||||
if l.b.raft.State() == raft.Leader {
|
||||
err := l.b.applyLog(context.Background(), &LogData{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,13 @@ storage "raft" {
|
|||
cluster_addr = "http://127.0.0.1:8201"
|
||||
```
|
||||
|
||||
**Note:** When using the Raft storage backend, it is required to provide `cluster_addr` to indicate the address and port to be used for communication between the nodes in the Raft cluster.
|
||||
~> **Note:** When using the Raft storage backend, it is required to provide
|
||||
`cluster_addr` to indicate the address and port to be used for communication
|
||||
between the nodes in the Raft cluster.
|
||||
|
||||
~> **Note:** Raft cannot be used as the configured `ha_storage` backend at this
|
||||
time. To use Raft for HA coordination users must also use Raft for storage and
|
||||
set `ha_enabled = true`.
|
||||
|
||||
## `raft` Parameters
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue