Skip to content

Commit

Permalink
Add database config docs (#4414)
Browse files Browse the repository at this point in the history
* update kafka monitor

* add database config docs

* update database config docs

* update database config doc

* update database config docs detail

* update database config docs details

* update database config docs info

* update database config docs infos

* update database config table

* update database config table info

* update database config table details
  • Loading branch information
wallyxjh committed Dec 18, 2023
1 parent 38ec5da commit 72852aa
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 0 deletions.
104 changes: 104 additions & 0 deletions docs/4.0/docs/guides/dbprovider/config-docs/config-docs.md
@@ -0,0 +1,104 @@
---
sidebar_position: 2
---

# Tutorial on modifying database parameters with yaml

Some parameters of the database cannot take effect immediately after modification. Therefore, you need to apply yaml to modify parameters and restart the database. Modifying parameters in yaml will cause the database to **restart**, and the whole process will take about **20 seconds**. The following uses the **Postgres** database as an example to modify parameters:

1. **Access the terminal**

![config_1](./imgs/config_1.png)

2. **Edit pg-config.yaml**

```bash
$ vim pg-config.yaml
```
![config_2](./imgs/config_2.png)

3. **Copy yaml to pg-config.yaml and save pg-config.yaml**

![config_3](./imgs/config_3.png)
```yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: test
spec:
clusterRef: test-pg #Change the database name to your own
reconfigure:
componentName: postgresql
configurations: #The following configuration is for reference only. You only need to keep the part to be modified and modify the corresponding parameter values
- keys:
- key: postgresql.conf
parameters:
- key: max_connections #Sets the maximum number of simultaneous connections that can be made to the database
value: "1000"
name: postgresql-configuration
ttlSecondsAfterSucceed: 0
type: Reconfiguring
```
**Common PostgreSQL Parameters**:

| Parameter Name | Description |
|-------------------------|-------------------------------------------------------------------------------------------------------|
| max_connections | Sets the maximum number of connections that can be <br/>established with the database simultaneously. |
| max_wal_size | Sets the maximum size of WAL (Write-Ahead Logging) files. |
| min_wal_size | Sets the minimum size of WAL files. |
| max_worker_processes | Sets the maximum number of background processes that<br/> PostgreSQL can start. |
| shared_buffers | The size of memory used for data caching. |

**Common MySQL Parameters**:

| Parameter Name | Description |
|-------------------------|-----------------------------------------------------------|
| innodb_buffer_pool_size | Sets the size of the InnoDB buffer pool. |
| max_connections | The maximum number of concurrent connections allowed. |
| query_cache_size | The size of the query cache. |
| thread_cache_size | The size of the thread cache. |
| max_allowed_packet | The maximum packet size. |
| innodb_log_file_size | The size of the InnoDB log file. |

**Common MongoDB Parameters**:

| Parameter Name | Description |
|-------------------------|-----------------------------------------------------------|
| storage.dbPath | The path for storing data files. |
| storage.journal.enabled | Sets the maximum size of WAL (Write-Ahead Logging) files. |
| min_wal_size | Enables logging. |
| net.port | The server port. |
| net.bindIp | The bound IP address. |

**Common Redis Parameters**:

| Parameter Name | Description |
|-------------------------|-----------------------------------------------------------|
| maxclients | The maximum number of client connections. |
| maxmemory | The maximum amount of memory usage. |
| maxmemory-policy | The memory eviction policy. |
| appendonly | Switch for AOF persistence. |
| appendfsync | The frequency of AOF file flushing. |

4. **Apply pg-config.yaml**

```bash
$ kubectl apply -f pg-config.yaml
```
![config_4](./imgs/config_4.png)

5. **Check whether pg-config.yaml is successfully applied**
```bash
# If the status of OpsRequest is Succeed and the status of pod is Running, the application is successfully configured
$ kubectl get OpsRequest
$ kubectl get pod
```
![config_5](./imgs/config_5.png)

6. **Access the database to check whether the configuration takes effect**
```bash
$ show max_connections;
```
![config_6](./imgs/config_6.png)
![config_7](./imgs/config_7.png)

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions docs/4.0/i18n/zh-Hans/guides/dbprovider/config-docs/config-docs.md
@@ -0,0 +1,103 @@
---
sidebar_position: 2
---

# 通过yaml修改数据库参数教程

由于数据库的某些参数在修改后无法立即生效,因此需要通过应用yaml来实现修改参数并重启数据库通过yaml修改参数会导致数据库**重启**,整个过程大概会持续**20s**左右。这里以**Postgres**数据库的参数修改为例,具体操作步骤如下:
1. **进入终端**

![config_1](./imgs/config_1.png)

2. **编辑pg-config.yaml**

```bash
$ vim pg-config.yaml
```
![config_2](./imgs/config_2.png)

3. **复制yaml到pg-config.yaml中,保存pg-config.yaml**

![config_3](./imgs/config_3.png)
```yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: test
spec:
clusterRef: test-pg #修改为自己的数据库名
reconfigure:
componentName: postgresql
configurations: #以下配置仅供参考,只需保留要修改的部分即可,并修改对应的参数的值
- keys:
- key: postgresql.conf
parameters:
- key: max_connections #设置可以同时与数据库建立的最大连接数
value: "1000"
name: postgresql-configuration
ttlSecondsAfterSucceed: 0
type: Reconfiguring
```
**常见的postgres参数**

| 参数名 | 描述 |
|-------------------------|-----------------------------------|
| max_connections | 设置可以同时与数据库建立<br/>的最大连接数 |
| max_wal_size | 设置WAL文件的最大大小 |
| min_wal_size | 设置WAL文件的最小大小 |
| max_worker_processes | 设置PostgreSQL可以启动<br/>的最大后台进程数 |
| shared_buffers | 设置PostgreSQL可以启动<br/>的最大后台进程数 |

**常见的mysql参数**

| 参数名 | 描述 |
|-------------------------|-----------------------------------|
| innodb_buffer_pool_size | 设置InnoDB缓冲池的大小 |
| max_connections | 允许的最大并发连接数 |
| query_cache_size | 查询缓存的大小 |
| thread_cache_size | 线程缓存的大小 |
| max_allowed_packet | 最大数据包大小 |
| innodb_log_file_size | InnoDB日志文件的大小 |

**常见的mongo参数**

| 参数名 | 描述 |
|-------------------------|------------------------------------|
| storage.dbPath | 数据文件存放路径 |
| storage.journal.enabled | 启用日志 |
| net.port | 服务器端口 |
| net.bindIp | 绑定的IP地址 |

**常见的redis参数**

| 参数名 | 描述 |
|------------------------|-------------------------------------|
| maxclients | 最大客户端连接数 |
| maxmemory | 最大内存使用量 |
| maxmemory-policy | 内存淘汰策略 |
| appendonly | AOF持久化开关 |
| appendfsync | AOF文件刷新频率 |


4. **应用pg-config.yaml**

```bash
$ kubectl apply -f pg-config.yaml
```
![config_4](./imgs/config_4.png)

5. **检查pg-config.yaml是否应用成功**
```bash
# OpsRequest中对应的状态为Succeed且pod对应的状态为Running则说明配置应用成功
$ kubectl get OpsRequest
$ kubectl get pod
```
![config_5](./imgs/config_5.png)

6. **进入数据库查看配置是否生效**
```bash
$ show max_connections;
```
![config_6](./imgs/config_6.png)
![config_7](./imgs/config_7.png)

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72852aa

Please sign in to comment.