Add for persistence Chaos Dashboard (#267)

* add doc

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* doc: persistence chaos-dashboard

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* add doc for persistence chaos dashboard

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* update sidecar

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* fix link

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* mirror updates

Signed-off-by: Cwen Yin <cwenyin0@gmail.com>

* Vector remove experimental WASM support
https://vector.dev/highlights/2021-08-23-removing-wasm/

Signed-off-by: Aolin Zhang <aolin.zhang@pingcap.com>

* add wasm link

Signed-off-by: Aolin Zhang <aolin.zhang@pingcap.com>

* fix comments

Signed-off-by: cwen0 <cwenyin0@gmail.com>

Co-authored-by: Aolin Zhang <aolin.zhang@pingcap.com>
This commit is contained in:
Cwen Yin 2022-05-23 18:56:47 +08:00 committed by GitHub
parent 8cbacd6958
commit 6536f50000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 361 additions and 44 deletions

View File

@ -0,0 +1,73 @@
---
title: Persistence Chaos Dashboard
---
import PickHelmVersion from '@site/src/components/PickHelmVersion'
This document describes how to make Chaos Dashboard persistence.
Chaos Dashboard support `SQLite`, `MySQL` and `PostgreSQL` as database backends for persistence.
## SQLite (default)
Chaos Dashboard uses `SQLite` as the default database engine, and it is recommended to enable [PV (Persistent Volumes)](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). To enable PV, set `dashboard.persistentVolume.enabled` to `true`. You can find related configurations on [`value.yaml`](https://github.com/chaos-mesh/chaos-mesh/blob/master/helm/chaos-mesh/values.yaml#L255-L282) as follows:
```yaml
dashboard:
...
persistentVolume:
# If you are using SQLite as your DB for Chaos Dashboard, it is recommended to enable persistence.
# If enable, the chart will create a PersistenceVolumeClaim to store its state in. If you are
# using a DB other than SQLite, set this to false to avoid allocating unused storage.
# If set to false, Chaos Mesh will use an emptyDir instead, which is ephemeral.
enabled: true
# If you'd like to bring your own PVC for persisting chaos event, pass the name of the
# created + ready PVC here. If set, this Chart will not create the default PVC.
# Requires server.persistentVolume.enabled: true
existingClaim: ""
# Chaos Dashboard data Persistent Volume size.
size: 8Gi
# Chaos Dashboard data Persistent Volume Storage Class.
# If defined, storageClassName: <storageClass>
storageClassName: standard
# Chaos Dashboard data Persistent Volume mount root path
mountPath: /data
# Subdirectory of Chaos Dashboard data Persistent Volume to mount
# Useful if the volume's root directory is not empty
subPath: ""
```
:::warning
If Chaos Dashboard component restarts without PV, the data of Chaos Dashboard will be lost and can't be retrieved.
:::
## MySQL
Chaos Dashboard supports MySQL 5.6 and higher versions as the database engine. The below example demonstrates MySQL database configuration. For details about connection string configuration, refer to the [MySQL-Driver for Go](https://github.com/go-sql-driver/mysql#dsn-data-source-name).
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=mysql --set dashboard.env.DATABASE_DATASOURCE=root:password@tcp(1.2.3.4:3306)/chaos-mesh?parseTime=true
</PickHelmVersion>
## PostgreSQL
Chaos Dashboard supports PostgreSQL 9.6 and higher versions as the database engine. The below example demonstrates PostgreSQL database configuration. For details about connection string configuration, refer to [libpq connect](https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING).
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=postgres --set dashboard.env.DATABASE_DATASOURCE=postgres://root:password@1.2.3.4:5432/postgres?sslmode=disable
</PickHelmVersion>
## Set TTL (Time To Live) for Chaos Dashboard data
Chaos Dashboard supports setting the expiration time of Chaos Dashboard data. The default `Event` related data expires by `168h`, and the `Experiment` related data defaults to `336h`. If you need to modify it, you can set `dashboard.env.TTL_EVENT` and `dashboard.env.TTL_EXPERIMENT` parameters, like:
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.TTL_EVENT=168h --set dashboard.env.TTL_EXPERIMENT=336h
</PickHelmVersion>

View File

@ -192,3 +192,7 @@ The safe mode is enabled by default. To disable the safe mode, specify `dashboar
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set dashboard.securityMode=false --version latest
</PickHelmVersion>
### How can I persist Chaos Dashboard data
Chaos Dashboard uses `SQLite` as the default database engine. If [PV (Persistent Volumes)](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) is disabled, the data of Chaos Dashboard will be lost after a reboot occurs. To avoid data loss, you can refer to the [Persistence of Chaos Dashboard Data](persistence-dashboard.md) document to enable PV for Chaos Dashboard or set `MySQL` and `PostgreSQL` as the database engine.

View File

@ -76,18 +76,19 @@ The fields in the YAML configuration file are described in the following table:
##### MemoryStressor
| Parameter | Type | Description | Default value | Required | Example |
| --------- | ------ | -------------------------------------------------------- | ------------- | -------- | ------- |
| workers | int | Specifies the number of threads that apply memory stress | | No | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `size`. | | No | `256MB / 25%` |
| time | string | Specifies the time to reach the memory `size`. The growth model is a linear model. | | No | `10min` |
| oomScoreAdj | int | Specifies the [oom_score_adj](https://man7.org/linux/man-pages/man5/proc.5.html) of the stress process. | | No | `-1000` |
| Parameter | Type | Description | Default value | Required | Example |
| --- | --- | --- | --- | --- | --- |
| workers | int | Specifies the number of threads that apply memory stress | | No | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `workers * size`. | | No | `256MB / 25%` |
| time | string | Specifies the time to reach the memory `size`. The growth model is a linear model. | | No | `10min` |
| oomScoreAdj | int | Specifies the [oom_score_adj](https://man7.org/linux/man-pages/man5/proc.5.html) of the stress process. | | No | `-1000` |
:::note
To avoid the high CPU load caused by the read and write pressure from `stress-ng`, Chaos Mesh uses [memStress](https://github.com/chaos-mesh/memStress) to simulate memory stress. This is because memStress simulates memory stress by consuming actual memory instead of applying the read and write pressure to memory.
:::
##### CPUStressor
| Parameter | Type | Description | Default value | Required | Example |

View File

@ -0,0 +1,73 @@
---
title: 持久化 Chaos Dashboard 数据
---
import PickHelmVersion from '@site/src/components/PickHelmVersion'
本文档介绍如何持久化 Chaos Dashboard 数据。
Chaos Dashboard 支持 `SQLite`、`MySQL` 和 `PostgreSQL` 作为后端数据存储。
## SQLite默认存储
Chaos Dashboard 默认使用 `SQLite` 作为后端存储,并推荐为 `SQLite` 配置单独的[持久卷 (PV)](https://kubernetes.io/zh/docs/concepts/storage/persistent-volumes/) 。如需要配置 PV请在安装的时候指定 `dashboard.persistentVolume.enabled``true` 和设置其他 PV 相关的配置。[`value.yaml`](https://github.com/chaos-mesh/chaos-mesh/blob/master/helm/chaos-mesh/values.yaml#L255-L282) 中 PV 相关的配置如下:
```yaml
dashboard:
...
persistentVolume:
# If you are using SQLite as your DB for Chaos Dashboard, it is recommended to enable persistence.
# If enable, the chart will create a PersistenceVolumeClaim to store its state in. If you are
# using a DB other than SQLite, set this to false to avoid allocating unused storage.
# If set to false, Chaos Mesh will use an emptyDir instead, which is ephemeral.
enabled: true
# If you'd like to bring your own PVC for persisting chaos event, pass the name of the
# created + ready PVC here. If set, this Chart will not create the default PVC.
# Requires server.persistentVolume.enabled: true
existingClaim: ""
# Chaos Dashboard data Persistent Volume size.
size: 8Gi
# Chaos Dashboard data Persistent Volume Storage Class.
# If defined, storageClassName: <storageClass>
storageClassName: standard
# Chaos Dashboard data Persistent Volume mount root path
mountPath: /data
# Subdirectory of Chaos Dashboard data Persistent Volume to mount
# Useful if the volume's root directory is not empty
subPath: ""
```
:::warning 注意
如果不配置 PV 的情况下Chaos Dashboard 发生重启,数据将出现丢失,并且无法找回。
:::
## MySQL
Chaos Dashboard 支持使用 MySQL 5.6 或者更高版本作为后端存储。若想使用 MySQL 作为后端存储,可以在安装的时候设置 `dashboard.env.DATABASE_DRIVER``dashboard.env.DATABASE_DATASOURCE` 参数,具体参数配置请参考[官方驱动文档(https://github.com/go-sql-driver/mysql#dsn-data-source-name) 。
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=mysql --set dashboard.env.DATABASE_DATASOURCE=root:password@tcp(1.2.3.4:3306)/chaos-mesh?parseTime=true
</PickHelmVersion>
## PostgreSQL
Chaos Dashboard 支持使用 PostgreSQL 9.6 或者更高版本作为后端存储。若想使用 PostgreSQL 作为后端存储,可以在安装的时候设置 `dashboard.env.DATABASE_DRIVER``dashboard.env.DATABASE_DATASOURCE` 参数,具体参数配置请参考 [libpq connect](https://github.com/go-sql-driver/mysql#dsn-data-source-name)。
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=postgres --set dashboard.env.DATABASE_DATASOURCE=postgres://root:password@1.2.3.4:5432/postgres?sslmode=disable
</PickHelmVersion>
## 配置数据过期时间
Chaos Dashboard 支持配置数据的过期时间,默认 `Event` 相关数据默认 `168h` 过期,`Experiment` 相关数据默认 `336h` 过期,如需要修改,可以设置 `dashboard.env.TTL_EVENT``dashboard.env.TTL_EXPERIMENT` 参数,如:
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.TTL_EVENT=168h --set dashboard.env.TTL_EXPERIMENT=336h
</PickHelmVersion>

View File

@ -198,3 +198,7 @@ helm install chaos-mesh helm/chaos-mesh -n=chaos-testing
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set dashboard.securityMode=false --version latest
</PickHelmVersion>
### 如何持久化 Chaos Dashboard 数据
默认 Chaos Dashboard 组件使用 `SQLite` 作为后端存储,如果没有为 Chaos Dashboard 配置[持久卷 (PV)](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) Chaos Dashboard 在发生重启后,数据会出现丢失。为了避免数据丢失,可以参考[持久化 Chaos Dashboard 数据](persistence-dashboard.md) 文档,为 Chaos Dashboard 配置持久卷或者设置 `MySQL`、`Postgres` 作为后端存储。

View File

@ -76,21 +76,22 @@ Chaos Mesh 提供的 StressChaos 实验类型可用于模拟容器内压力的
##### MemoryStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ------ | ---------------------------- | ------ | -------- | ------- |
| workers | int | 指定施加内存压力的线程个数 | | 否 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `size` | | 否 | `256MB`/`25%` |
| time | string | 指定达到分配内存大小的时间,增长模型为线性模型 | | 否 | `10min` |
| oomScoreAdj | int | 指定占用内存压力进程的 [oom_score_adj](https://man7.org/linux/man-pages/man5/proc.5.html) | | 否 | `-1000` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加内存压力的线程个数 | | 否 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `workers * size` | | 否 | `256MB`/`25%` |
| time | string | 指定达到分配内存大小的时间,增长模型为线性模型 | | 否 | `10min` |
| oomScoreAdj | int | 指定占用内存压力进程的 [oom_score_adj](https://man7.org/linux/man-pages/man5/proc.5.html) | | 否 | `-1000` |
:::note
为避免因 `stress-ng` 施加读写压力而造成的高 CPU 负载Chaos Mesh 使用 [memStress](https://github.com/chaos-mesh/memStress) 模拟内存压力的方法。这是因为 memStress 模拟内存压力的方法会占用实际内存,而不是对内存施加读写压力。
:::
##### CPUStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ---- | --------------------------------------------------------------- | ------ | -------- | ---- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |

View File

@ -69,21 +69,22 @@ Chaos Mesh 提供的 StressChaos 实验类型可用于模拟容器内压力的
#### Stressors
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------ | --------------------------------- | ------------------- | ------ | -------- | ---- |
| memory | [MemoryStressor](#memorystressor) | 指定内存压力的参数 | 无 | 否 | |
| cpu | [CPUStressor](#cpustressor) | 指定 CPU 压力的参数 | 无 | 否 | |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| memory | [MemoryStressor](#memorystressor) | 指定内存压力的参数 | 无 | 否 | |
| cpu | [CPUStressor](#cpustressor) | 指定 CPU 压力的参数 | 无 | 否 | |
##### MemoryStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ------ | ---------------------------- | ------ | -------- | ------- |
| workers | int | 指定施加内存压力的线程个数 | | 是 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `size` | | 否 | `256MB`/`25%` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加内存压力的线程个数 | | 是 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `size` | | 否 | `256MB`/`25%` |
##### CPUStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ---- | --------------------------------------------------------------- | ------ | -------- | ---- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |

View File

@ -0,0 +1,73 @@
---
title: 持久化 Chaos Dashboard 数据
---
import PickHelmVersion from '@site/src/components/PickHelmVersion'
本文档介绍如何持久化 Chaos Dashboard 数据。
Chaos Dashboard 支持 `SQLite`、`MySQL` 和 `PostgreSQL` 作为后端数据存储。
## SQLite默认存储
Chaos Dashboard 默认使用 `SQLite` 作为后端存储,并推荐为 `SQLite` 配置单独的[持久卷 (PV)](https://kubernetes.io/zh/docs/concepts/storage/persistent-volumes/) 。如需要配置 PV请在安装的时候指定 `dashboard.persistentVolume.enabled``true` 和设置其他 PV 相关的配置。[`value.yaml`](https://github.com/chaos-mesh/chaos-mesh/blob/master/helm/chaos-mesh/values.yaml#L255-L282) 中 PV 相关的配置如下:
```yaml
dashboard:
...
persistentVolume:
# If you are using SQLite as your DB for Chaos Dashboard, it is recommended to enable persistence.
# If enable, the chart will create a PersistenceVolumeClaim to store its state in. If you are
# using a DB other than SQLite, set this to false to avoid allocating unused storage.
# If set to false, Chaos Mesh will use an emptyDir instead, which is ephemeral.
enabled: true
# If you'd like to bring your own PVC for persisting chaos event, pass the name of the
# created + ready PVC here. If set, this Chart will not create the default PVC.
# Requires server.persistentVolume.enabled: true
existingClaim: ""
# Chaos Dashboard data Persistent Volume size.
size: 8Gi
# Chaos Dashboard data Persistent Volume Storage Class.
# If defined, storageClassName: <storageClass>
storageClassName: standard
# Chaos Dashboard data Persistent Volume mount root path
mountPath: /data
# Subdirectory of Chaos Dashboard data Persistent Volume to mount
# Useful if the volume's root directory is not empty
subPath: ""
```
:::warning 注意
如果不配置 PV 的情况下Chaos Dashboard 发生重启,数据将出现丢失,并且无法找回。
:::
## MySQL
Chaos Dashboard 支持使用 MySQL 5.6 或者更高版本作为后端存储。若想使用 MySQL 作为后端存储,可以在安装的时候设置 `dashboard.env.DATABASE_DRIVER``dashboard.env.DATABASE_DATASOURCE` 参数,具体参数配置请参考[官方驱动文档(https://github.com/go-sql-driver/mysql#dsn-data-source-name) 。
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=mysql --set dashboard.env.DATABASE_DATASOURCE=root:password@tcp(1.2.3.4:3306)/chaos-mesh?parseTime=true
</PickHelmVersion>
## PostgreSQL
Chaos Dashboard 支持使用 PostgreSQL 9.6 或者更高版本作为后端存储。若想使用 PostgreSQL 作为后端存储,可以在安装的时候设置 `dashboard.env.DATABASE_DRIVER``dashboard.env.DATABASE_DATASOURCE` 参数,具体参数配置请参考 [libpq connect](https://github.com/go-sql-driver/mysql#dsn-data-source-name)。
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=postgres --set dashboard.env.DATABASE_DATASOURCE=postgres://root:password@1.2.3.4:5432/postgres?sslmode=disable
</PickHelmVersion>
## 配置数据过期时间
Chaos Dashboard 支持配置数据的过期时间,默认 `Event` 相关数据默认 `168h` 过期,`Experiment` 相关数据默认 `336h` 过期,如需要修改,可以设置 `dashboard.env.TTL_EVENT``dashboard.env.TTL_EXPERIMENT` 参数,如:
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.TTL_EVENT=168h --set dashboard.env.TTL_EXPERIMENT=336h
</PickHelmVersion>

View File

@ -198,3 +198,7 @@ helm install chaos-mesh helm/chaos-mesh -n=chaos-testing
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set dashboard.securityMode=false --version latest
</PickHelmVersion>
### 如何持久化 Chaos Dashboard 数据
默认 Chaos Dashboard 组件使用 SQLite 作为后端存储,如果没有为 Chaos Dashboard 配置 [`PV(Persistent Volumes)`](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) Chaos Dashboard 在发生重启后,数据会出现丢失。为了避免数据丢失,可以参考[持久化 Chaos Dashboard 数据](persistence-dashboard.md) 文档,为 Chaos Dashboard 配置 `PV` 或者设置 `MySQL` 、`Postgres` 作为后端存储。

View File

@ -76,13 +76,14 @@ Chaos Mesh 提供的 StressChaos 实验类型可用于模拟容器内压力的
##### MemoryStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ------ | ---------------------------- | ------ | -------- | ------- |
| workers | int | 指定施加内存压力的线程个数 | | 是 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `size` | | 否 | `256MB`/`25%` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加内存压力的线程个数 | | 是 | `1` |
| size | string | 指定分配内存的大小或是占总内存的百分比,分配内存的总和为 `size` | | 否 | `256MB`/`25%` |
##### CPUStressor
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| ------- | ---- | --------------------------------------------------------------- | ------ | -------- | ---- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |
| 参数 | 类型 | 说明 | 默认值 | 是否必填 | 示例 |
| --- | --- | --- | --- | --- | --- |
| workers | int | 指定施加 CPU 压力的线程个数 | | 是 | `1` |
| load | int | 指定占据 CPU 的百分比。`0` 意味着没有增加额外的负载,`100` 意味着满负载。总的负载为 `workers * load`。 | | 否 | `50` |

View File

@ -18,6 +18,7 @@ module.exports = {
'quick-start',
'production-installation-using-helm',
'offline-installation',
'persistence-dashboard',
'uninstallation',
'supported-releases'
],

View File

@ -76,10 +76,10 @@ The fields in the YAML configuration file are described in the following table:
##### MemoryStressor
| Parameter | Type | Description | Default value | Required | Example |
| --------- | ------ | -------------------------------------------------------- | ------------- | -------- | ------- |
| workers | int | Specifies the number of threads that apply memory stress | | Yes | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `size`. | | No | `256MB / 25%` |
| Parameter | Type | Description | Default value | Required | Example |
| --- | --- | --- | --- | --- | --- |
| workers | int | Specifies the number of threads that apply memory stress | | Yes | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `size`. | | No | `256MB / 25%` |
##### CPUStressor

View File

@ -0,0 +1,73 @@
---
title: Persistence Chaos Dashboard
---
import PickHelmVersion from '@site/src/components/PickHelmVersion'
This document describes how to make Chaos Dashboard persistence.
Chaos Dashboard support `SQLite`, `MySQL` and `PostgreSQL` as database backends for persistence.
## SQLite (default)
Chaos Dashboard uses `SQLite` as the default database engine, and it is recommended to enable [PV (Persistent Volumes)](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). To enable PV, set `dashboard.persistentVolume.enabled` to `true`. You can find related configurations on [`value.yaml`](https://github.com/chaos-mesh/chaos-mesh/blob/master/helm/chaos-mesh/values.yaml#L255-L282) as follows:
```yaml
dashboard:
...
persistentVolume:
# If you are using SQLite as your DB for Chaos Dashboard, it is recommended to enable persistence.
# If enable, the chart will create a PersistenceVolumeClaim to store its state in. If you are
# using a DB other than SQLite, set this to false to avoid allocating unused storage.
# If set to false, Chaos Mesh will use an emptyDir instead, which is ephemeral.
enabled: true
# If you'd like to bring your own PVC for persisting chaos event, pass the name of the
# created + ready PVC here. If set, this Chart will not create the default PVC.
# Requires server.persistentVolume.enabled: true
existingClaim: ""
# Chaos Dashboard data Persistent Volume size.
size: 8Gi
# Chaos Dashboard data Persistent Volume Storage Class.
# If defined, storageClassName: <storageClass>
storageClassName: standard
# Chaos Dashboard data Persistent Volume mount root path
mountPath: /data
# Subdirectory of Chaos Dashboard data Persistent Volume to mount
# Useful if the volume's root directory is not empty
subPath: ""
```
:::warning
If Chaos Dashboard component restarts without PV, the data of Chaos Dashboard will be lost and can't be retrieved.
:::
## MySQL
Chaos Dashboard supports MySQL 5.6 and higher versions as the database engine. The below example demonstrates MySQL database configuration. For details about connection string configuration, refer to the [MySQL-Driver for Go](https://github.com/go-sql-driver/mysql#dsn-data-source-name).
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=mysql --set dashboard.env.DATABASE_DATASOURCE=root:password@tcp(1.2.3.4:3306)/chaos-mesh?parseTime=true
</PickHelmVersion>
## PostgreSQL
Chaos Dashboard supports PostgreSQL 9.6 and higher versions as the database engine. The below example demonstrates PostgreSQL database configuration. For details about connection string configuration, refer to [libpq connect](https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING).
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.DATABASE_DRIVER=postgres --set dashboard.env.DATABASE_DATASOURCE=postgres://root:password@1.2.3.4:5432/postgres?sslmode=disable
</PickHelmVersion>
## Set TTL (Time To Live) for Chaos Dashboard data
Chaos Dashboard supports setting the expiration time of Chaos Dashboard data. The default `Event` related data expires by `168h`, and the `Experiment` related data defaults to `336h`. If you need to modify it, you can set `dashboard.env.TTL_EVENT` and `dashboard.env.TTL_EXPERIMENT` parameters, like:
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version latest --set dashboard.env.TTL_EVENT=168h --set dashboard.env.TTL_EXPERIMENT=336h
</PickHelmVersion>

View File

@ -192,3 +192,7 @@ The safe mode is enabled by default. To disable the safe mode, specify `dashboar
<PickHelmVersion>
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --set dashboard.securityMode=false --version latest
</PickHelmVersion>
### How can I persist Chaos Dashboard data
Chaos Dashboard uses SQLite as the default database engine. If [`PV(Persistent Volumes)`](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) is disabled, the data of Chaos Dashboard will be lost after a reboot occurs. To avoid data loss, you can refer to the [Persistence of Chaos Dashboard Data](persistence-dashboard.md) document to enable `PV` for Chaos Dashboard or set `MySQL` and `Postgres` as the database engine.

View File

@ -76,10 +76,10 @@ The fields in the YAML configuration file are described in the following table:
##### MemoryStressor
| Parameter | Type | Description | Default value | Required | Example |
| --------- | ------ | -------------------------------------------------------- | ------------- | -------- | ------- |
| workers | int | Specifies the number of threads that apply memory stress | | Yes | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `size`. | | No | `256MB / 25%` |
| Parameter | Type | Description | Default value | Required | Example |
| --- | --- | --- | --- | --- | --- |
| workers | int | Specifies the number of threads that apply memory stress | | Yes | `1` |
| size | string | Specifies the memory size to be occupied or a percentage of the total memory size. The final sum of the occupied memory size is `size`. | | No | `256MB / 25%` |
##### CPUStressor

View File

@ -38,6 +38,10 @@
"type": "doc",
"id": "version-2.1.5/offline-installation"
},
{
"type": "doc",
"id": "version-2.1.5/persistence-dashboard"
},
{
"type": "doc",
"id": "version-2.1.5/uninstallation"