docs(ds): Move Raft-related parts to emqx_ds_builtin_raft README

This commit is contained in:
ieQu1 2024-06-28 15:55:10 +02:00
parent afe1c5617d
commit 71dad0242e
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
2 changed files with 39 additions and 24 deletions

View File

@ -1,3 +1,36 @@
# `emqx_ds_builtin_raft` # `emqx_ds_builtin_raft`
Replication layer for the builtin EMQX durable storage backend that uses Raft algorithm. Replication layer for the builtin EMQX durable storage backend that uses Raft algorithm.
Raft backend introduces the concept of **site** to alleviate the problem of changing node names.
Site IDs are persistent, and they are randomly generated at the first startup of the node.
Each node in the cluster has a unique site ID, that is independent from the Erlang node name (`emqx@...`).
## Configurations
OTP application environment variables:
- `emqx_durable_storage.reads`: `leader_preferred` | `local_preferred`.
# CLI
Runtime settings for the durable storages can be modified via CLI as well as the REST API.
The following CLI commands are available:
- `emqx ctl ds info` — get a quick overview of the durable storage state
- `emqx ctl ds set_replicas <DS> <Site1> <Site2> ...` — update the list of replicas for a durable storage.
- `emqx ctl ds join <DS> <Site>` — add a replica of durable storage on the site
- `emqx ctl ds leave <DS> <Site>` — remove a replica of a durable storage from the site
# HTTP APIs
The following REST APIs are available for managing the builtin durable storages:
- `/ds/sites` — list known sites.
- `/ds/sites/:site` — get information about the site (its status, current EMQX node name managing the site, etc.)
- `/ds/storages` — list durable storages
- `/ds/storages/:ds` — get information about the durable storage and its shards
- `/ds/storages/:ds/replicas` — list or update sites that contain replicas of a durable storage
- `/ds/storages/:ds/replicas/:site` — add or remove replica of the durable storage on the site

View File

@ -13,11 +13,10 @@ This makes the storage disk requirements very predictable: only the number of _p
DS _backend_ is a callback module that implements `emqx_ds` behavior. DS _backend_ is a callback module that implements `emqx_ds` behavior.
EMQX repository contains the "builtin" backend, implemented in `emqx_ds_replication_layer` module, that uses Raft algorithm for data replication, and RocksDB as the main storage. EMQX repository contains two builtin backends based on RocksDB:
Note that builtin backend introduces the concept of **site** to alleviate the problem of changing node names. - `emqx_ds_builtin_local`
Site IDs are persistent, and they are randomly generated at the first startup of the node. - `emqx_ds_builtin_raft`
Each node in the cluster has a unique site ID, that is independent from the Erlang node name (`emqx@...`).
### Layout ### Layout
@ -113,8 +112,8 @@ In the future it can serve as a storage for retained messages or as a generic me
# Configurations # Configurations
Global options for `emqx_durable_storage` application are configured via OTP application environment. Common global options for builtin backends are configured via OTP application environment.
Database-specific settings are stored in the schema table. Database-specific settings are stored in EMQX config.
The following application environment variables are available: The following application environment variables are available:
@ -124,26 +123,9 @@ The following application environment variables are available:
- `emqx_durable_storage.egress_flush_interval`: period at which the batches of messages are committed to the durable storage. - `emqx_durable_storage.egress_flush_interval`: period at which the batches of messages are committed to the durable storage.
- `emqx_durable_storage.reads`: `leader_preferred` | `local_preferred`.
Runtime settings for the durable storages can be modified via CLI as well as the REST API.
The following CLI commands are available:
- `emqx ctl ds info` — get a quick overview of the durable storage state
- `emqx ctl ds set_replicas <DS> <Site1> <Site2> ...` — update the list of replicas for a durable storage.
- `emqx ctl ds join <DS> <Site>` — add a replica of durable storage on the site
- `emqx ctl ds leave <DS> <Site>` — remove a replica of a durable storage from the site
# HTTP APIs # HTTP APIs
The following REST APIs are available for managing the builtin durable storages: None
- `/ds/sites` — list known sites.
- `/ds/sites/:site` — get information about the site (its status, current EMQX node name managing the site, etc.)
- `/ds/storages` — list durable storages
- `/ds/storages/:ds` — get information about the durable storage and its shards
- `/ds/storages/:ds/replicas` — list or update sites that contain replicas of a durable storage
- `/ds/storages/:ds/replicas/:site` — add or remove replica of the durable storage on the site
# Other # Other