* Raft configuration doc

* API docs

* join sample

* Fix the Join API

* Add snapshot-force

* Update sys/storage subsection

* Use actual certs in examples

* Add sample configuration response

* Fix link

* remove TLS config options
This commit is contained in:
Vishal Nayak 2019-06-28 14:09:14 -04:00 committed by GitHub
parent 6dbd8c228f
commit 2fcac90052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 261 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
layout: "api"
page_title: "/sys/storage - HTTP API"
sidebar_title: "<code>/sys/storage </code>"
sidebar_current: "api-http-system-storage"
description: |-
The '/sys/storage' endpoints are used to manage Vault's storage backends.
---
This API sub-section is currently only used to manage [Raft](raft.html) storage backend.

View File

@ -0,0 +1,195 @@
---
layout: "api"
page_title: "/sys/storage/raft - HTTP API"
sidebar_title: "<code>/sys/storage/raft</code>"
sidebar_current: "api-http-system-storage-raft"
description: |-
The `/sys/storage/raft` endpoints are used to manage Vault's Raft storage
backend.
---
## Join a Raft cluster
This endpoint joins a new server node to the Raft cluster. When using Shamir
seal, as soon as the Vault server is brought up, this API should be invoked
instead of `sys/init`. This API completes in 2 phases. Once this is invoked,
the joining node will receive a challenge from the Raft's leader node. This
challenge can be answered by the joining node only after a successful unseal.
Hence, the joining node should be unsealed using the unseal keys of the Raft's
leader node.
| Method | Path |
| :--------------------------- | :--------------------- |
| `POST` | `/sys/storage/raft/join` |
### Parameters
- `leader_api_addr` `(string: <required>)` Address of the leader node in the
Raft cluster to which this node is trying to join.
- `retry` `(bool: false)` - Retry joining the Raft cluster in case of
failures.
- `leader_ca_cert` `(string: "")` - CA certificate used to communicate with
Raft's leader node.
- `leader_client_cert` `(string: "")` - Client certificate used to communicate
with Raft's leader node.
- `leader_client_key` `(string: "")` - Client key used to communicate with
Raft's leader node.
### Sample Payload
```json
{
"leader_api_addr": "https://127.0.0.1:8200",
"leader_ca_cert": "-----BEGIN CERTIFICATE-----\nMIIDKTCCAhGgAwIBAgIUcd+Uyk1Tz+FhcbYP0zmynlkAR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q9HytWkV9OLz0zbcAUEIrFAljnC32Mybsj8LzdSKIZ3wErf9Txh8zqZqMyhedxL\nOn17cpJAq5Vi71uXOaxnhkf7TPuRs8nBRRJfgyNHPXuXLkuWeuvXEe/PIC+nvOIX\nas0Ab0Pvx0fRGl4EkZ2pV9oDAEUezbVVZCoO8l8CgYEAp4p3YNfzwpj0d+5tXPBu\ngBakzJ+tQjewnP1dbLk1TuqLXjdQ2wfVyzOrbFEtCquPwy8bSICDLxt8VURR88eU\n+6kTJK+InBYR029GUtRUhmzd7qpugyQ14IOXa9ofQI8GUbCf8M1IoWWWXQHJzN3I\ngX98QHqiOU+d2k94WYb6dzMCgYA3E7p2oMdZShLRss3hzqtH/Zd2WeQSWIrjox3u\nR4Kp/Bl9UST5GDPHl7SrhcwsWgmmthusq/VkDmeE8aUyurGmJigla3mESMQjfwrX\nue8sti6PcEsNS0HPAKc1EbriCeDkkomC3RBPxk/ZZTp3YgnKpSOs6MxNCnpLAKVj\nmQlX3wKBgQCFYyYJdCKMoaoMrNjMM34sAfTqmZT4Hbxg9KM4OMDSxyvIi0ZaVcnB\nkzssvt0FOMucp4o7h8Iujt8xsgnBHwg81IV7WOw+ZwpUDAzgVc7+kCU6CLd2Q40j\n5uFnuRgiWeGm1aT4arNLWlJrDLSGbyrf59SlGJV1hmu/7SMaYIZHSQ==\n-----END RSA PRIVATE KEY-----"
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/sys/storage/raft/join
```
**Note:** Unseal the joining node immediately after this API is invoked.
## Read Raft Configuration
This endpoint returns the details of all the nodes in the raft cluster.
| Method | Path |
| :--------------------------- | :---------------------------- |
| `GET` | `/sys/storage/raft/configuration` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
http://127.0.0.1:8200/v1/sys/storage/raft/configuration
```
### Sample Response
```json
{
"request_id": "ca4b5a1d-38d6-e27e-e756-269521328a15",
"lease_id": "",
"lease_duration": 0,
"renewable": false,
"data": {
"config": {
"index": 24,
"servers": [
{
"address": "127.0.0.1:8201",
"leader": true,
"node_id": "raft1",
"protocol_version": "\u0003",
"voter": true
},
{
"address": "127.0.0.2:8201",
"leader": false,
"node_id": "raft2",
"protocol_version": "\u0003",
"voter": true
}
]
}
},
"warnings": null
}
```
## Remove a node from Raft cluster
This endpoint removes a node from the raft cluster.
| Method | Path |
| :--------------------------- | :--------------------- |
| `POST` | `/sys/storage/raft/remove-peer` |
### Sample Payload
```json
{
"server_id": "raft1"
}
```
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/sys/storage/raft/remove-peer
```
## Take a snapshot of the Raft cluster
This endpoint returns a snapshot of the current state of the raft cluster. The
snapshot is returned as binary data and should be redirected to a file.
| Method | Path |
| :--------------------------- | :---------------------------- |
| `GET` | `/sys/storage/raft/snapshot` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request GET \
http://127.0.0.1:8200/v1/sys/storage/raft/snapshot > raft.snap
```
## Restore Raft using a snapshot
Installs the provided snapshot, returning the cluster to the state defined in it.
| Method | Path |
| :--------------------------- | :--------------------- |
| `POST` | `/sys/storage/raft/snapshot` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
-- data-binary @raft.snap
http://127.0.0.1:8200/v1/sys/storage/raft/snapshot
```
## Force Restore Raft using a snapshot
Installs the provided snapshot, returning the cluster to the state defined in
it. This is same as writing to `/sys/storage/raft/snapshot` except that this
bypasses checks ensuring the Autounseal or shamir keys are consistent with the
snapshot data.
| Method | Path |
| :--------------------------- | :--------------------- |
| `POST` | `/sys/storage/raft/snapshot-force` |
### Sample Request
```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data-binary @raft.snap
http://127.0.0.1:8200/v1/sys/storage/raft/snapshot-force
```

View File

@ -0,0 +1,47 @@
---
layout: "docs"
page_title: "Raft - Storage Backends - Configuration"
sidebar_title: "Raft"
sidebar_current: "docs-configuration-storage-raft"
description: |-
The Raft storage backend is used to persist Vault's data. Unlike all the other
storage backends, this backend does not operate from a single source for the
data. Instead all the nodes in a Vault cluster will have a replicated copy of
the entire data. The data is replicated across the nodes using the Raft
Consensus Algorithm.
---
# Raft Storage Backend
The Raft storage backend is used to persist Vault's data. Unlike other storage
backends, Raft storage does not operate from a single source of data. Instead
all the nodes in a Vault cluster will have a replicated copy of Vault's data.
Data gets replicated across the all the nodes via the [Raft Consensus
Algorithm][raft].
- **High Availability** the Raft storage backend supports high availability.
- **HashiCorp Supported** the Raft storage backend is officially supported
by HashiCorp.
```hcl
storage "raft" {
path = "/path/to/raft/data"
node_id = "raft_node_1"
}
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.
## `raft` Parameters
- `path` `(string: "")` The file system path where all the Vault data gets
stored.
- `node_id` `(string: "")` - The identifier for the node in the Raft cluster.
[raft]: https://raft.github.io/ "The Raft Consensus Algorithm"

View File

@ -138,6 +138,12 @@
'seal',
'seal-status',
'step-down',
{
category: 'storage',
content: [
'raft'
]
},
'tools',
'unseal',
'wrapping-lookup',

View File

@ -70,6 +70,7 @@
'mssql',
'mysql',
'postgresql',
'raft',
's3',
'swift',
'zookeeper'