From ab6ce57d2358c1023575603fecfd24d788aab773 Mon Sep 17 00:00:00 2001
From: yuanyuan zhang <111744220+michelle-0808@users.noreply.github.com>
Date: Tue, 10 Dec 2024 10:22:19 +0800
Subject: [PATCH] docs: adjust en docs command format (#8613)
---
...nect-database-in-production-environment.md | 94 +--
...connect-database-in-testing-environment.md | 78 ++-
.../handle-a-cluster-exception.md | 16 +-
docs/user_docs/installation/install-addons.md | 2 +-
...e-and-connect-an-apecloud-mysql-cluster.md | 146 ++--
.../delete-mysql-cluster.md | 32 +-
.../cluster-management/expand-volume.md | 114 +--
.../restart-mysql-cluster.md | 56 +-
.../scale-for-apecloud-mysql.md | 254 ++++---
.../stop-start-a-cluster.md | 102 ++-
.../cluster-management/switchover.md | 70 +-
.../configuration/configuration.md | 314 ++++-----
.../high-availability/high-availability.md | 222 +++---
.../proxy/apecloud-mysql-proxy.md | 532 +++++++-------
.../manage-elasticsearch.md | 572 ++++++++-------
.../connect-to-a-cluster.md | 36 +-
.../create-a-kafka-cluster.md | 80 +--
.../delete-kafka-cluster.md | 34 +-
.../cluster-management/expand-volume.md | 106 +--
.../restart-a-kafka-cluster.md | 60 +-
.../cluster-management/scale.md | 250 ++++---
.../start-stop-a-cluster.md | 106 ++-
.../configuration/configuration.md | 228 +++---
.../kubeblocks-for-milvus/manage-milvus.md | 541 +++++++-------
...create-and-connect-to-a-mongodb-cluster.md | 112 +--
.../delete-mongodb-cluster.md | 32 +-
.../cluster-management/expand-volume.md | 108 +--
.../restart-mongodb-cluster.md | 56 +-
.../cluster-management/scale-for-mongodb.md | 258 ++++---
.../start-stop-a-cluster.md | 52 +-
.../cluster-management/switchover.md | 54 +-
.../configuration/configuration.md | 234 +++----
.../create-and-connect-a-mysql-cluster.md | 122 ++--
.../delete-mysql-cluster.md | 34 +-
.../cluster-management/expand-volume.md | 109 +--
.../restart-mysql-cluster.md | 56 +-
.../cluster-management/scale-for-mysql.md | 256 ++++---
.../stop-start-a-cluster.md | 80 +--
.../cluster-management/switchover.md | 42 +-
.../configuration/configuration.md | 316 ++++-----
.../high-availability/high-availability.md | 140 ++--
...create-and-connect-a-postgresql-cluster.md | 136 ++--
.../delete-a-postgresql-cluster.md | 34 +-
.../cluster-management/expand-volume.md | 108 +--
.../restart-a-postgresql-cluster.md | 56 +-
.../scale-for-a-postgresql-cluster.md | 237 ++++---
.../start-stop-a-cluster.md | 85 +--
.../cluster-management/switchover.md | 58 +-
.../configuration/configuration.md | 312 ++++-----
.../high-availability/high-availability.md | 126 ++--
.../postgresql-connection-pool.md | 90 +--
.../create-pulsar-cluster-on-kubeblocks.md | 20 +-
.../delete-a-pulsar-cluster.md | 34 +-
.../cluster-management/expand-volume.md | 118 ++--
.../restart-a-pulsar-cluster.md | 56 +-
.../cluster-management/scale-for-pulsar.md | 227 +++---
.../stop-start-a-pulsar-cluster.md | 76 +-
.../configuration/configuration.md | 192 ++---
.../kubeblocks-for-qdrant/manage-qdrant.md | 662 +++++++++---------
.../manage-rabbitmq.md | 50 +-
.../create-and-connect-a-redis-cluster.md | 128 ++--
.../delete-a-redis-cluster.md | 36 +-
.../cluster-management/expand-volume.md | 126 ++--
.../restart-a-redis-cluster.md | 60 +-
.../scale-for-a-redis-cluster.md | 270 ++++---
.../stop-start-a-redis-cluster.md | 86 +--
.../configuration/configuration.md | 290 ++++----
.../high-availability/high-availability.md | 120 ++--
.../manage-starrocks.md | 635 ++++++++---------
.../backup-and-restore/backup/backup-repo.md | 338 ++++-----
.../backup/configure-backuppolicy.md | 36 +-
.../backup/on-demand-backup.md | 64 +-
.../backup/scheduled-backup.md | 40 +-
.../backup-and-restore/restore/pitr.md | 62 +-
.../restore/restore-data-from-backup-set.md | 54 +-
.../resource-scheduling.md | 220 +++---
.../maintenance/scale/horizontal-scale.md | 10 +-
.../maintenance/scale/vertical-scale.md | 23 +-
.../observability/monitor-database.md | 200 +++---
...nect-to-database-in-testing-environment.md | 2 +-
.../user-docs/installation/install-addons.md | 2 +-
.../scale-for-apecloud-mysql.md | 26 +-
.../stop-start-a-cluster.md | 46 +-
.../manage-elasticsearch.md | 46 +-
.../cluster-management/expand-volume.md | 4 +-
.../cluster-management/scale.md | 32 +-
.../stop-start-a-cluster.md | 25 +-
.../kubeblocks-for-milvus/manage-milvus.md | 39 +-
.../cluster-management/expand-volume.md | 4 +-
.../scale-for-a-mongodb-cluster.md | 39 +-
.../cluster-management/expand-volume.md | 4 +-
.../cluster-management/scale-for-mysql.md | 48 +-
.../stop-start-a-cluster.md | 28 +-
.../cluster-management/expand-volume.md | 4 +-
.../scale-for-a-postgresql-cluster.md | 41 +-
.../start-stop-a-cluster.md | 29 +-
.../scale-for-a-pulsar-cluster.md | 30 +-
.../stop-start-a-pulsar-cluster.md | 28 +-
.../kubeblocks-for-qdrant/manage-qdrant.md | 67 +-
.../cluster-management/expand-volume.md | 4 +-
.../scale-for-a-redis-cluster.md | 48 +-
.../stop-start-a-redis-cluster.md | 30 +-
.../manage-starrocks.md | 29 +-
.../backup/scheduled-backup.md | 6 +-
.../resource-scheduling.md | 9 +-
.../maintenance/scale/horizontal-scale.md | 8 +-
.../maintenance/scale/vertical-scale.md | 24 +-
.../observability/monitor-database.md | 30 +-
108 files changed, 6096 insertions(+), 6217 deletions(-)
diff --git a/docs/user_docs/connect_database/connect-database-in-production-environment.md b/docs/user_docs/connect_database/connect-database-in-production-environment.md
index 6849bba2efe..1f686dd16d2 100644
--- a/docs/user_docs/connect_database/connect-database-in-production-environment.md
+++ b/docs/user_docs/connect_database/connect-database-in-production-environment.md
@@ -27,7 +27,17 @@ You can connect with the database ClusterIP or domain name.
-
+
+
+To check the database endpoint, use `kubectl get service -`.
+
+```bash
+kubectl get service mycluster-mysql
+```
+
+
+
+
To check the database endpoint, use `kbcli cluster describe ${cluster-name}`.
@@ -60,16 +70,6 @@ TIME TYPE REASON OBJECT MESSAGE
-
-
-To check the database endpoint, use `kubectl get service -`.
-
-```bash
-kubectl get service mycluster-mysql
-```
-
-
-
## Scenario 2. Client outside the Kubernetes cluster but in the same VPC as the Kubernetes cluster
@@ -84,15 +84,7 @@ The following command creates a LoadBalancer instance for the database instance,
-
-
-```bash
-kbcli cluster expose ${cluster-name} --type vpc --enable=true
-```
-
-
-
-
+
This example uses a MySQL cluster to demonstrate how to expose a VPC address on Alibaba Cloud.
@@ -118,6 +110,14 @@ spec:
+
+
+```bash
+kbcli cluster expose ${cluster-name} --type vpc --enable=true
+```
+
+
+
To disable the LoadBalancer instance, execute the following command.
@@ -130,15 +130,7 @@ Once disabled, the instance is not accessible.
-
-
-```bash
-kbcli cluster expose ${cluster-name} --type vpc --enable=false
-```
-
-
-
-
+
```yaml
kubectl apply -f - <
+
+
+```bash
+kbcli cluster expose ${cluster-name} --type vpc --enable=false
+```
+
+
+
## Scenario 3. Connect database with clients in other VPCs or public networks
@@ -176,15 +176,7 @@ The following command creates a LoadBalancer instance for the database instance,
-
-
-```bash
-kbcli cluster expose ${cluster-name} --type internet --enable=true
-```
-
-
-
-
+
The example uses MySQL to demonstrate how to expose the public address on Alibaba Cloud.
@@ -210,21 +202,21 @@ spec:
-
-
-To disable the LoadBalancer instance, execute the following command.
-
-
-
-
+
```bash
-kbcli cluster expose ${cluster-name} --type internet --enable=false
+kbcli cluster expose ${cluster-name} --type internet --enable=true
```
-
+
+
+To disable the LoadBalancer instance, execute the following command.
+
+
+
+
```yaml
kubectl apply -f - <
+
+
+```bash
+kbcli cluster expose ${cluster-name} --type internet --enable=false
+```
+
+
+
:::note
diff --git a/docs/user_docs/connect_database/connect-database-in-testing-environment.md b/docs/user_docs/connect_database/connect-database-in-testing-environment.md
index 73b008c1fa5..e2253835c7c 100644
--- a/docs/user_docs/connect_database/connect-database-in-testing-environment.md
+++ b/docs/user_docs/connect_database/connect-database-in-testing-environment.md
@@ -12,43 +12,8 @@ import TabItem from '@theme/TabItem';
# Connect database in testing environment
-
-## Option 1. Use kbcli cluster connect command
-
-You can use the `kbcli cluster connect` command and specify the cluster name to be connected.
-
-```bash
-kbcli cluster connect ${cluster-name}
-```
-
-The lower-level command is actually `kubectl exec`. The command is functional as long as the K8s API server is accessible.
-
-## Option 2. Connect database with CLI or SDK client
-
-Execute the following command to get the network information of the targeted database and connect it with the printed IP address.
-
-```bash
-kbcli cluster connect --show-example --show-password ${cluster-name}
-```
-
-Information printed includes database addresses, port No., username, password. The figure below is an example of MySQL database network information.
-
-- Address: -h specifies the server address. In the example below it is 127.0.0.1
-- Port: -P specifies port No. , In the example below it is 3306.
-- User: -u is the user name.
-- Password: -p shows the password. In the example below, it is hQBCKZLI.
-
-:::note
-
-The password does not include -p.
-
-:::
-
-![Example](./../../img/connect_database_with_CLI_or_SDK_client.png)
-
-
-
+
## Step 1. Retrieve Database Credentials
@@ -62,7 +27,7 @@ Before connecting to the MySQL database running inside your Kubernetes cluster,
kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
>
root
- ```
+ ```
- Replace "mycluster" with the actual name of your database cluster.
- Replace "demo" with the actual namespace of your database cluster.
@@ -149,5 +114,42 @@ Here is an example of using CLI to connect to the cluster on the local host.
```
-
+
+
+## Option 1. Use kbcli cluster connect command
+
+You can use the `kbcli cluster connect` command and specify the cluster name to be connected.
+
+```bash
+kbcli cluster connect ${cluster-name}
+```
+
+The lower-level command is actually `kubectl exec`. The command is functional as long as the K8s API server is accessible.
+
+## Option 2. Connect database with CLI or SDK client
+
+Execute the following command to get the network information of the targeted database and connect it with the printed IP address.
+
+```bash
+kbcli cluster connect --show-example --show-password ${cluster-name}
+```
+
+Information printed includes database addresses, port No., username, password. The figure below is an example of MySQL database network information.
+
+- Address: -h specifies the server address. In the example below it is 127.0.0.1
+- Port: -P specifies port No. , In the example below it is 3306.
+- User: -u is the user name.
+- Password: -p shows the password. In the example below, it is `hQBCKZLI`.
+
+:::note
+
+The password does not include -p.
+
+:::
+
+![Example](./../../img/connect_database_with_CLI_or_SDK_client.png)
+
+
+
+
diff --git a/docs/user_docs/handle-an-exception/handle-a-cluster-exception.md b/docs/user_docs/handle-an-exception/handle-a-cluster-exception.md
index 481fd8b1951..7f5d3afbe93 100644
--- a/docs/user_docs/handle-an-exception/handle-a-cluster-exception.md
+++ b/docs/user_docs/handle-an-exception/handle-a-cluster-exception.md
@@ -19,19 +19,19 @@ When an exception occurs during your operation, you can perform the following st
-
+
- ```bash
- kbcli cluster list mycluster
- ```
+ ```bash
+ kubectl describe cluster mycluster
+ ```
-
+
- ```bash
- kubectl describe cluster mycluster
- ```
+ ```bash
+ kbcli cluster list mycluster
+ ```
diff --git a/docs/user_docs/installation/install-addons.md b/docs/user_docs/installation/install-addons.md
index 57dca437511..8fcb3a72220 100644
--- a/docs/user_docs/installation/install-addons.md
+++ b/docs/user_docs/installation/install-addons.md
@@ -56,7 +56,7 @@ For example, you can install an Addon v0.9.0 with KubeBlocks v0.9.2, but using m
helm list -A
>
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
- ......
+ ...
kb-addon-es kb-system 1 2024-11-27 10:04:59.730127 +0800 CST deployed elasticsearch-0.9.0 8.8.2
```
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/create-and-connect-an-apecloud-mysql-cluster.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/create-and-connect-an-apecloud-mysql-cluster.md
index 0a07921c19c..fa35d59de86 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/create-and-connect-an-apecloud-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/create-and-connect-an-apecloud-mysql-cluster.md
@@ -23,26 +23,26 @@ This tutorial shows how to create and connect to an ApeCloud MySQL cluster.
-
-
+
+
```bash
- kbcli addon list
+ kubectl get addons.extensions.kubeblocks.io apecloud-mysql
>
- NAME VERSION PROVIDER STATUS AUTO-INSTALL
- ...
- apecloud-mysql 0.9.0 apecloud Enabled true
- ...
+ NAME TYPE VERSION PROVIDER STATUS AGE
+ apecloud-mysql Helm Enabled 61m
```
-
-
+
+
```bash
- kubectl get addons.extensions.kubeblocks.io apecloud-mysql
+ kbcli addon list
>
- NAME TYPE VERSION PROVIDER STATUS AGE
- apecloud-mysql Helm Enabled 61m
+ NAME VERSION PROVIDER STATUS AUTO-INSTALL
+ ...
+ apecloud-mysql 0.9.0 apecloud Enabled true
+ ...
```
@@ -53,17 +53,7 @@ This tutorial shows how to create and connect to an ApeCloud MySQL cluster.
-
-
- ```bash
- kbcli clusterdefinition list
-
- kbcli clusterversion list
- ```
-
-
-
-
+
Make sure the `apecloud-mysql` cluster definition is installed.
@@ -85,6 +75,16 @@ This tutorial shows how to create and connect to an ApeCloud MySQL cluster.
+
+
+ ```bash
+ kbcli clusterdefinition list
+
+ kbcli clusterversion list
+ ```
+
+
+
* To keep things isolated, create a separate namespace called `demo` throughout this tutorial.
@@ -99,48 +99,7 @@ KubeBlocks supports creating two types of ApeCloud MySQL clusters: Standalone an
-
-
-1. Create an ApeCloud MySQL cluster.
-
- Below are some common examples to create a cluster with default settings. If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create apecloud-mysql --help
-
- kbcli cluster create apecloud-mysql -h
- ```
-
- Create a Standalone.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition apecloud-mysql --namespace demo
- ```
-
- Create a RaftGroup Cluster.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition apecloud-mysql --set replicas=3 --namespace demo
- ```
-
- If you only have one node for deploying a RaftGroup Cluster, set the `topology-keys` as `null` when creating a RaftGroup Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition apecloud-mysql --set replicas=3 --topology-keys null --namespace demo
- ```
-
-2. Verify whether this cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
- ```
-
-
-
-
+
1. Create an ApeCloud MySQL cluster.
@@ -235,21 +194,54 @@ KubeBlocks supports creating two types of ApeCloud MySQL clusters: Standalone an
-
+
-## Connect to an ApeCloud MySQL Cluster
+1. Create an ApeCloud MySQL cluster.
-
+ Below are some common examples to create a cluster with default settings. If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
+
+ ```bash
+ kbcli cluster create apecloud-mysql --help
-
+ kbcli cluster create apecloud-mysql -h
+ ```
-```bash
-kbcli cluster connect mycluster -n demo
-```
+ Create a Standalone.
+
+ ```bash
+ kbcli cluster create mycluster --cluster-definition apecloud-mysql --namespace demo
+ ```
+
+ Create a RaftGroup Cluster.
+
+ ```bash
+ kbcli cluster create mycluster --cluster-definition apecloud-mysql --set replicas=3 --namespace demo
+ ```
+
+ If you only have one node for deploying a RaftGroup Cluster, set the `topology-keys` as `null` when creating a RaftGroup Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
+
+ ```bash
+ kbcli cluster create mycluster --cluster-definition apecloud-mysql --set replicas=3 --topology-keys null --namespace demo
+ ```
+
+2. Verify whether this cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+ ```
-
+
+
+## Connect to an ApeCloud MySQL Cluster
+
+
+
+
You can use `kubectl exec` to exec into a Pod and connect to a database.
@@ -301,6 +293,14 @@ You can also port forward the service to connect to a database from your local m
+
+
+```bash
+kbcli cluster connect mycluster -n demo
+```
+
+
+
For the detailed database connection guide, refer to [Connect database](./../../connect_database/overview-of-database-connection.md).
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/delete-mysql-cluster.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/delete-mysql-cluster.md
index 3777875c682..b8e813ae0c3 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/delete-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/delete-mysql-cluster.md
@@ -30,24 +30,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
```
@@ -60,22 +60,22 @@ Run the command below to delete a specified cluster.
-
+
+
+If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
```bash
-kbcli cluster delete mycluster -n demo
+kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
+
+kubectl delete -n demo cluster mycluster
```
-
-
-If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
+
```bash
-kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
-
-kubectl delete -n demo cluster mycluster
+kbcli cluster delete mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/expand-volume.md
index 5647962a674..20a5f595300 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/expand-volume.md
@@ -24,24 +24,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
```
@@ -52,51 +52,7 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
-
-
-1. Change configuration.
-
- Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster --components="mysql" --volume-claim-templates="data" --storage="40Gi" -n demo
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Updating Sep 19,2024 16:01 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -143,6 +99,12 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
`spec.componentSpecs.volumeClaimTemplates.spec.resources` is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Edit the value of `spec.componentSpecs.volumeClaimTemplates.spec.resources`.
+
```yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
@@ -163,7 +125,7 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -177,4 +139,48 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
+
+
+1. Change configuration.
+
+ Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster --components="mysql" --volume-claim-templates="data" --storage="40Gi" -n demo
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+2. Validate the volume expansion operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Updating Sep 19,2024 16:01 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/restart-mysql-cluster.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/restart-mysql-cluster.md
index 1df2d4e8b76..0f760be1b07 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/restart-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/restart-mysql-cluster.md
@@ -17,34 +17,7 @@ You can restart all pods of the cluster. When an exception occurs in a database,
-
-
-1. Restart a cluster.
-
- Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster --components="mysql" --ttlSecondsAfterSucceed=30 -n demo
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Check the cluster status to validate the restarting.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
- ```
-
- - STATUS=Updating: it means the cluster restart is in progress.
- - STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Create an OpsRequest to restart a cluster.
@@ -88,4 +61,31 @@ You can restart all pods of the cluster. When an exception occurs in a database,
+
+
+1. Restart a cluster.
+
+ Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster --components="mysql" --ttlSecondsAfterSucceed=30 -n demo
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Check the cluster status to validate the restarting.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the cluster restart is in progress.
+ - STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md
index 357092c1c47..ee4027552eb 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md
@@ -28,24 +28,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
```
@@ -56,52 +56,7 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu`.
-
- ```bash
- kbcli cluster vscale mycluster --components="mysql" --memory="4Gi" --cpu="2" -n demo
- ```
-
- - `--components` describes the component name ready for vertical scaling.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Updating Sep 26,2024 16:01 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
-
- To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -149,14 +104,14 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
1. Change the configuration of `spec.componentSpecs.resources` in the YAML file. `spec.componentSpecs.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: apecloud-mysql
clusterVersionRef: ac-mysql-8.0.30
@@ -164,22 +119,14 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
- name: mysql
componentDefRef: mysql
replicas: 3
- resources: # Change the values of resources.
+ resources: # Change the values of resources
requests:
memory: "2Gi"
cpu: "1"
limits:
memory: "4Gi"
cpu: "2"
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- terminationPolicy: Delete
+ ...
```
2. Check whether the cluster is running again and corresponding resources change.
@@ -190,6 +137,51 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu`.
+
+ ```bash
+ kbcli cluster vscale mycluster --components="mysql" --memory="4Gi" --cpu="2" -n demo
+ ```
+
+ - `--components` describes the component name ready for vertical scaling.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Updating Sep 26,2024 16:01 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+
+ To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -204,24 +196,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
```
@@ -232,45 +224,7 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
-
-
-1. Configure the parameters `--components` and `--replicas`.
-
- ```bash
- kbcli cluster hscale mycluster --components="mysql" --replicas=3 -n demo
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -339,30 +293,22 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
`spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: apecloud-mysql
clusterVersionRef: ac-mysql-8.0.30
componentSpecs:
- name: mysql
componentDefRef: mysql
- replicas: 1 # Change the amount
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- terminationPolicy: Delete
+ replicas: 1 # Change the value
+ ...
```
2. Check whether the corresponding cluster is running and whether resources change.
@@ -375,6 +321,44 @@ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running
+
+
+1. Configure the parameters `--components` and `--replicas`.
+
+ ```bash
+ kbcli cluster hscale mycluster --components="mysql" --replicas=3 -n demo
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md
index d66936025cb..a0032bf5e67 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md
@@ -19,15 +19,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
```bash
kubectl apply -f - <
- Configure replicas as 0 to delete pods.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Configure the value of `spec.componentSpecs.replicas` as 0 to delete pods.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
+ ...
spec:
clusterDefinitionRef: apecloud-mysql
clusterVersionRef: ac-mysql-8.0.30
@@ -63,16 +54,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: mysql
componentDefRef: mysql
disableExporter: true
- replicas: 0
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -82,18 +73,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -106,15 +97,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
```bash
kubectl apply -f - <
- Change replicas back to the original amount to start this cluster again.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Change the value of `spec.componentSpecs.replicas` back to the original amount to start this cluster again.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
+ ...
spec:
clusterDefinitionRef: apecloud-mysql
clusterVersionRef: ac-mysql-8.0.30
@@ -150,16 +132,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: mysql
componentDefRef: mysql
disableExporter: true
- replicas: 3
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
+ replicas: 3 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -170,18 +152,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/switchover.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/switchover.md
index ef2cefc3d13..7303199285b 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/switchover.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/cluster-management/switchover.md
@@ -19,24 +19,24 @@ You can initiate a switchover for an ApeCloud MySQL RaftGroup by executing the k
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
>
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
+ NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+ mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
>
- NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
- mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
```
@@ -60,29 +60,7 @@ You can switch over a follower of an ApeCloud MySQL RaftGroup to the leader role
-
-
-* Initiate a switchover with no leader instance specified.
-
- ```bash
- kbcli cluster promote mycluster -n demo
- ```
-
-* Initiate a switchover with a specified new leader instance.
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mysql-2' -n demo
- ```
-
-* If there are multiple components, you can use `--components` to specify a component.
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mysql-2' --components='apecloud-mysql' -n demo
- ```
-
-
-
-
+
The value of `instanceName` decides whether a new leader instance is specified for the switchover.
@@ -124,6 +102,28 @@ The value of `instanceName` decides whether a new leader instance is specified f
+
+
+* Initiate a switchover with no leader instance specified.
+
+ ```bash
+ kbcli cluster promote mycluster -n demo
+ ```
+
+* Initiate a switchover with a specified new leader instance.
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mysql-2' -n demo
+ ```
+
+* If there are multiple components, you can use `--components` to specify a component.
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mysql-2' --components='apecloud-mysql' -n demo
+ ```
+
+
+
## Verify the switchover
@@ -132,18 +132,18 @@ Check the instance status to verify whether the switchover is performed successf
-
+
```bash
-kbcli cluster list-instances -n demo
+kubectl get pods -n demo
```
-
+
```bash
-kubectl get pods -n demo
+kbcli cluster list-instances -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/configuration/configuration.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/configuration/configuration.md
index d78bb53d79b..24ef32ae3a4 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/configuration/configuration.md
@@ -21,7 +21,163 @@ But it's also important to note that the dynamic parameter configuration doesn't
-
+
+
+KubeBlocks supports configuring cluster parameters by editing the configuration file.
+
+1. Get the configuration file of this cluster.
+
+ ```bash
+ kubectl edit configurations.apps.kubeblocks.io mycluster-mysql -n demo
+ ```
+
+2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
+
+ ```yaml
+ spec:
+ clusterRef: mycluster
+ componentName: mysql
+ configItemDetails:
+ - configFileParams:
+ my.cnf:
+ parameters:
+ max_connections: "600"
+ configSpec:
+ constraintRef: mysql8.0-config-constraints
+ name: mysql-consensusset-config
+ namespace: kb-system
+ templateRef: mysql8.0-config-template
+ volumeName: mysql-config
+ name: mysql-consensusset-config
+ - configSpec:
+ defaultMode: 292
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ root
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ 2gvztbvz
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mysql-0 -- bash
+
+ mysql -uroot -p2gvztbvz
+ >
+ mysql> show variables like 'max_connections';
+ +-----------------+-------+
+ | Variable_name | Value |
+ +-----------------+-------+
+ | max_connections | 600 |
+ +-----------------+-------+
+ 1 row in set (0.00 sec)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+KubeBlocks supports configuring cluster parameters with an OpsRequest.
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a YAML file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
+
+ ```bash
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: mysql
+ configurations:
+ - keys:
+ - key: my.cnf
+ parameters:
+ - key: max_connections
+ value: "600"
+ name: mysql-consensusset-configuration
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply the configuration opsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ root
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ 2gvztbvz
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mysql-0 -- bash
+
+ mysql -uroot -p2gvztbvz
+ >
+ mysql> show variables like 'max_connections';
+ +-----------------+-------+
+ | Variable_name | Value |
+ +-----------------+-------+
+ | max_connections | 600 |
+ +-----------------+-------+
+ 1 row in set (0.00 sec)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -282,160 +438,4 @@ innodb_buffer_pool_size 512M 512M
-
-
-KubeBlocks supports configuring cluster parameters by editing the configuration file.
-
-1. Get the configuration file of this cluster.
-
- ```bash
- kubectl edit configurations.apps.kubeblocks.io mycluster-mysql -n demo
- ```
-
-2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
-
- ```yaml
- spec:
- clusterRef: mycluster
- componentName: mysql
- configItemDetails:
- - configFileParams:
- my.cnf:
- parameters:
- max_connections: "600"
- configSpec:
- constraintRef: mysql8.0-config-constraints
- name: mysql-consensusset-config
- namespace: kb-system
- templateRef: mysql8.0-config-template
- volumeName: mysql-config
- name: mysql-consensusset-config
- - configSpec:
- defaultMode: 292
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- root
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- 2gvztbvz
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mysql-0 -- bash
-
- mysql -uroot -p2gvztbvz
- >
- mysql> show variables like 'max_connections';
- +-----------------+-------+
- | Variable_name | Value |
- +-----------------+-------+
- | max_connections | 600 |
- +-----------------+-------+
- 1 row in set (0.00 sec)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-KubeBlocks supports configuring cluster parameters with an OpsRequest.
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a YAML file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
-
- ```bash
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: mysql
- configurations:
- - keys:
- - key: my.cnf
- parameters:
- - key: max_connections
- value: "600"
- name: mysql-consensusset-configuration
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply the configuration opsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- root
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- 2gvztbvz
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mysql-0 -- bash
-
- mysql -uroot -p2gvztbvz
- >
- mysql> show variables like 'max_connections';
- +-----------------+-------+
- | Variable_name | Value |
- +-----------------+-------+
- | max_connections | 600 |
- +-----------------+-------+
- 1 row in set (0.00 sec)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/high-availability/high-availability.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/high-availability/high-availability.md
index 3fcb4b4d728..31058260d1e 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/high-availability/high-availability.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/high-availability/high-availability.md
@@ -42,48 +42,7 @@ The faults here are all simulated by deleting a pod. When there are sufficient r
-
-
-1. View the ApeCloud MySQL RaftGroup information. View the leader pod name in `Topology`. In this example, the leader pod's name is `mycluster-mysql-2`.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
- ![describe_cluster](./../../../img/failure_simulation_describe_cluster.png)
-2. Delete the leader pod `mycluster-mysql-2` to simulate a pod fault.
-
- ```bash
- kubectl delete pod mycluster-mysql-2 -n demo
- ```
-
- ![delete_pod](./../../../img/failure_simulation_delete_pod.png)
-3. Run `kbcli cluster describe` and `kbcli cluster connect` to check the status of the pods and RaftGroup connection.
-
- ***Results***
-
- The following example shows that the roles of pods have changed after the old leader pod was deleted and `mycluster-mysql-1` is elected as the new leader pod.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
- ![describe_cluster_after](./../../../img/failure_simulation_describe_cluster_after.png)
- It shows that this ApeCloud MySQL RaftGroup can be connected within seconds.
-
- ```bash
- kbcli cluster connect mycluster -n demo
- ```
-
- ![connect_cluster_after](./../../../img/failure_simulation_connect_cluster_after.png)
-
-***How the automatic recovery works***
-
-After the leader pod is deleted, the ApeCloud MySQL RaftGroup Cluster elects a new leader. In this example, `mycluster-mysql-1` is elected as the new leader. KubeBlocks detects that the leader has changed, and sends a notification to update the access link. The original exception node automatically rebuilds and recovers to the normal RaftGroup Cluster state. It normally takes 30 seconds from exception to recovery.
-
-
-
-
+
1. View the pod role of the ApeCloud MySQL RaftGroup Cluster. In this example, the leader pod's name is `mycluster-mysql-1`.
@@ -133,48 +92,56 @@ After the leader pod is deleted, the ApeCloud MySQL RaftGroup Cluster elects a n
-
-
-### Single follower pod exception
+
-***Steps:***
-
-
-
-
-
-1. View the ApeCloud MySQL RaftGroup information and view the follower pod name in `Topology`. In this example, the follower pods are `mycluster-mysql-0` and m`mycluster-mysql-2`.
+1. View the ApeCloud MySQL RaftGroup information. View the leader pod name in `Topology`. In this example, the leader pod's name is `mycluster-mysql-2`.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_cluster](./../../../img/failure_simulation_describe_cluster_after.png)
-2. Delete the follower pod `mycluster-mysql-0`.
+ ![describe_cluster](./../../../img/failure_simulation_describe_cluster.png)
+2. Delete the leader pod `mycluster-mysql-2` to simulate a pod fault.
```bash
- kubectl delete pod mycluster-mysql-0 -n demo
+ kubectl delete pod mycluster-mysql-2 -n demo
```
- ![delete_follower_pod](./../../../img/failure_simulation_delete_follower_pod.png)
-3. View the RaftGroup status and you can find the follower pod is being terminated.
+ ![delete_pod](./../../../img/failure_simulation_delete_pod.png)
+3. Run `kbcli cluster describe` and `kbcli cluster connect` to check the status of the pods and RaftGroup connection.
+
+ ***Results***
+
+ The following example shows that the roles of pods have changed after the old leader pod was deleted and `mycluster-mysql-1` is elected as the new leader pod.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_cluster_follower](./../../../img/failure_simulation_describe_cluster_follower.png)
-4. Connect to the RaftGroup and you can find this single follower exception doesn't affect the R/W of the cluster.
+ ![describe_cluster_after](./../../../img/failure_simulation_describe_cluster_after.png)
+ It shows that this ApeCloud MySQL RaftGroup can be connected within seconds.
```bash
kbcli cluster connect mycluster -n demo
```
- ![connect_cluster_follower](./../../../img/failure_simulation_connect_cluster_follower.png)
+ ![connect_cluster_after](./../../../img/failure_simulation_connect_cluster_after.png)
+
+***How the automatic recovery works***
+
+After the leader pod is deleted, the ApeCloud MySQL RaftGroup Cluster elects a new leader. In this example, `mycluster-mysql-1` is elected as the new leader. KubeBlocks detects that the leader has changed, and sends a notification to update the access link. The original exception node automatically rebuilds and recovers to the normal RaftGroup Cluster state. It normally takes 30 seconds from exception to recovery.
-
+
+
+### Single follower pod exception
+
+***Steps:***
+
+
+
+
1. View the pod role again and in this example, the follower pods are `mycluster-mysql-1` and `mycluster-mysql-2`.
@@ -214,56 +181,56 @@ After the leader pod is deleted, the ApeCloud MySQL RaftGroup Cluster elects a n
-
-
-***How the automatic recovery works***
-
-One follower exception doesn't trigger re-electing of the leader or access link switch, so the R/W of the cluster is not affected. Follower exception triggers recreation and recovery. The process takes no more than 30 seconds.
-
-### Two pods exception
-
-The availability of the cluster generally requires the majority of pods to be in a normal state. When most pods are exceptional, the original leader will be automatically downgraded to a follower. Therefore, any two exceptional pods result in only one follower pod remaining.
+
-In this way, whether exceptions occur to one leader and one follower or two followers, failure performance and automatic recovery are the same.
-
-***Steps:***
-
-
-
-
-
-1. View the ApeCloud MySQL RaftGroup information and view the follower pod name in `Topology`. In this example, the follower pods are `mycluster-mysql-0` and `mycluster-mysql-2`.
+1. View the ApeCloud MySQL RaftGroup information and view the follower pod name in `Topology`. In this example, the follower pods are `mycluster-mysql-0` and m`mycluster-mysql-2`.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_cluster](./../../../img/failure_simulation_describe_cluster_2.png)
-2. Delete these two follower pods.
+ ![describe_cluster](./../../../img/failure_simulation_describe_cluster_after.png)
+2. Delete the follower pod `mycluster-mysql-0`.
```bash
- kubectl delete pod mycluster-mysql-0 mycluster-mysql-2 -n demo
+ kubectl delete pod mycluster-mysql-0 -n demo
```
- ![delete_two_pods](./../../../img/failure_simulation_delete_two_pods.png)
-3. View the RaftGroup status and you can find the follower pods are pending and a new leader pod is selected.
+ ![delete_follower_pod](./../../../img/failure_simulation_delete_follower_pod.png)
+3. View the RaftGroup status and you can find the follower pod is being terminated.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_two_pods](./../../../img/failure_simulation_describe_two_pods.png)
-4. Run `kbcli cluster connect mycluster` again after a few seconds and you can find the pods in the RaftGroup work normally again.
+ ![describe_cluster_follower](./../../../img/failure_simulation_describe_cluster_follower.png)
+4. Connect to the RaftGroup and you can find this single follower exception doesn't affect the R/W of the cluster.
```bash
kbcli cluster connect mycluster -n demo
```
- ![connect_two_pods](./../../../img/failure_simulation_connect_two_pods.png)
+ ![connect_cluster_follower](./../../../img/failure_simulation_connect_cluster_follower.png)
-
+
+
+***How the automatic recovery works***
+
+One follower exception doesn't trigger re-electing of the leader or access link switch, so the R/W of the cluster is not affected. Follower exception triggers recreation and recovery. The process takes no more than 30 seconds.
+
+### Two pods exception
+
+The availability of the cluster generally requires the majority of pods to be in a normal state. When most pods are exceptional, the original leader will be automatically downgraded to a follower. Therefore, any two exceptional pods result in only one follower pod remaining.
+
+In this way, whether exceptions occur to one leader and one follower or two followers, failure performance and automatic recovery are the same.
+
+***Steps:***
+
+
+
+
1. View the pod role again. In this example, the follower pods are `mycluster-mysql-1` and `mycluster-mysql-2`.
@@ -307,52 +274,52 @@ In this way, whether exceptions occur to one leader and one follower or two foll
-
-
-***How the automatic recovery works***
-
-When two pods of the ApeCloud MySQL RaftGroup are exceptional, pods are unavailable and cluster R/W is unavailable. After the recreation of pods, a new leader is elected to recover to R/W status. The process takes less than 30 seconds.
-
-### All pods exception
-
-***Steps:***
-
-
-
-
+
-1. Run the command below to view the ApeCloud MySQL RaftGroup information and view the pods' names in `Topology`.
+1. View the ApeCloud MySQL RaftGroup information and view the follower pod name in `Topology`. In this example, the follower pods are `mycluster-mysql-0` and `mycluster-mysql-2`.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_cluster](./../../../img/failure_simulation_describe_two_pods.png)
-2. Delete all pods.
+ ![describe_cluster](./../../../img/failure_simulation_describe_cluster_2.png)
+2. Delete these two follower pods.
```bash
- kubectl delete pod mycluster-mysql-1 mycluster-mysql-0 mycluster-mysql-2 -n demo
+ kubectl delete pod mycluster-mysql-0 mycluster-mysql-2 -n demo
```
- ![delete_three_pods](./../../../img/failure_simulation_delete_three_pods.png)
-3. Run the command below to view the cluster and pod status. After a few seconds, you can find all pods are running again and a new leader is selected.
+ ![delete_two_pods](./../../../img/failure_simulation_delete_two_pods.png)
+3. View the RaftGroup status and you can find the follower pods are pending and a new leader pod is selected.
```bash
kbcli cluster describe mycluster -n demo
```
- ![describe_three_clusters](./../../../img/failure_simulation_describe_three_pods.png)
-4. Connect to the cluster and the connection works normally again.
+ ![describe_two_pods](./../../../img/failure_simulation_describe_two_pods.png)
+4. Run `kbcli cluster connect mycluster` again after a few seconds and you can find the pods in the RaftGroup work normally again.
```bash
kbcli cluster connect mycluster -n demo
```
- ![connect_three_clusters](./../../../img/failure_simulation_connect_three_pods.png)
+ ![connect_two_pods](./../../../img/failure_simulation_connect_two_pods.png)
-
+
+
+***How the automatic recovery works***
+
+When two pods of the ApeCloud MySQL RaftGroup are exceptional, pods are unavailable and cluster R/W is unavailable. After the recreation of pods, a new leader is elected to recover to R/W status. The process takes less than 30 seconds.
+
+### All pods exception
+
+***Steps:***
+
+
+
+
1. View the role of pods.
@@ -394,6 +361,39 @@ When two pods of the ApeCloud MySQL RaftGroup are exceptional, pods are unavaila
+
+
+1. Run the command below to view the ApeCloud MySQL RaftGroup information and view the pods' names in `Topology`.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+ ![describe_cluster](./../../../img/failure_simulation_describe_two_pods.png)
+2. Delete all pods.
+
+ ```bash
+ kubectl delete pod mycluster-mysql-1 mycluster-mysql-0 mycluster-mysql-2 -n demo
+ ```
+
+ ![delete_three_pods](./../../../img/failure_simulation_delete_three_pods.png)
+3. Run the command below to view the cluster and pod status. After a few seconds, you can find all pods are running again and a new leader is selected.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+ ![describe_three_clusters](./../../../img/failure_simulation_describe_three_pods.png)
+4. Connect to the cluster and the connection works normally again.
+
+ ```bash
+ kbcli cluster connect mycluster -n demo
+ ```
+
+ ![connect_three_clusters](./../../../img/failure_simulation_connect_three_pods.png)
+
+
+
***How the automatic recovery works***
diff --git a/docs/user_docs/kubeblocks-for-apecloud-mysql/proxy/apecloud-mysql-proxy.md b/docs/user_docs/kubeblocks-for-apecloud-mysql/proxy/apecloud-mysql-proxy.md
index 2e5a8dd386d..a17429109bc 100644
--- a/docs/user_docs/kubeblocks-for-apecloud-mysql/proxy/apecloud-mysql-proxy.md
+++ b/docs/user_docs/kubeblocks-for-apecloud-mysql/proxy/apecloud-mysql-proxy.md
@@ -35,80 +35,7 @@ It is recommended to use kbcli to create an ApeCloud MySQL Proxy Cluster.
-
-
-1. Enable the etcd Addon and create an etcd cluster.
-
- 1. Install and enable the etcd Addon. You need to install the etcd Addon first since the etcd Addon is not installed by default. Refer to [Addons installation tutorial](./../../installation/install-with-kbcli/install-addons.md) for details.
-
- ```bash
- # 1. Check whether the KubeBlocks Addon index is added
- kbcli addon index list
-
- # If the list is empty, add the index
- kbcli addon index add kubeblocks https://github.com/apecloud/block-index.git
-
- # 2. Search the etcd Addon
- kbcli addon search etcd
-
- # 3. Install the etcd Addon
- kbcli addon install etcd --index kubeblocks --version 0.9.0
-
- # 4. Enable the etcd Addon
- kbcli addon enable etcd
-
- # 5. Check whether the etcd Addon is enabled.
- kbcli addon list
- ```
-
- 2. Create an etcd cluster.
-
- ```bash
- kbcli cluster create myetcd --cluster-definition etcd
- ```
-
- 3. Check the status of the etcd service
-
- ```bash
- kbcli cluster list myetcd
- ```
-
-2. View the etcd service address or the etcd pod address.
-
- ```bash
- kubectl get service
- >
- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
- kubernetes ClusterIP 10.96.0.1 443/TCP 85d
- myetcd-etcd ClusterIP 10.101.227.143 2379/TCP 111s
- myetcd-etcd-headless ClusterIP None 2379/TCP,2380/TCP,3501/TCP,50001/TCP 111s
- ```
-
-3. Create an ApeCloud MySQL Proxy cluster.
-
- ```bash
- helm repo add kubeblocks https://apecloud.github.io/helm-charts
-
- helm install myproxy kubeblocks/apecloud-mysql-cluster --set mode=raftGroup,proxyEnabled=true,etcd.serviceReference.endpoint="etcd-cluster-etcd.default.svc.cluster.local:2379"
- ```
-
-4. Check the status of the clusters.
-
- ```bash
- kbcli get cluster
-
- kbcli get pods
- ```
-
- You can also enter the etcd container or wesql-scale container to view the configuration of wesql-scale or to check the availability of the etcd service.
-
- ```bash
- etcdctl --endpoints=http://etcd-cluster-etcd.default.svc.cluster.local:2379 get /vitess --prefix --keys-only
- ```
-
-
-
-
+
1. Add the KubeBlocks repository.
@@ -221,6 +148,79 @@ helm install myproxy kubeblocks/apecloud-mysql-cluster --version=v0.9.0 --set mo
+
+
+1. Enable the etcd Addon and create an etcd cluster.
+
+ 1. Install and enable the etcd Addon. You need to install the etcd Addon first since the etcd Addon is not installed by default. Refer to [Addons installation tutorial](./../../installation/install-addons.md) for details.
+
+ ```bash
+ # 1. Check whether the KubeBlocks Addon index is added
+ kbcli addon index list
+
+ # If the list is empty, add the index
+ kbcli addon index add kubeblocks https://github.com/apecloud/block-index.git
+
+ # 2. Search the etcd Addon
+ kbcli addon search etcd
+
+ # 3. Install the etcd Addon
+ kbcli addon install etcd --index kubeblocks --version 0.9.2
+
+ # 4. Enable the etcd Addon
+ kbcli addon enable etcd
+
+ # 5. Check whether the etcd Addon is enabled.
+ kbcli addon list
+ ```
+
+ 2. Create an etcd cluster.
+
+ ```bash
+ kbcli cluster create myetcd --cluster-definition etcd
+ ```
+
+ 3. Check the status of the etcd service
+
+ ```bash
+ kbcli cluster list myetcd
+ ```
+
+2. View the etcd service address or the etcd pod address.
+
+ ```bash
+ kubectl get service
+ >
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
+ kubernetes ClusterIP 10.96.0.1 443/TCP 85d
+ myetcd-etcd ClusterIP 10.101.227.143 2379/TCP 111s
+ myetcd-etcd-headless ClusterIP None 2379/TCP,2380/TCP,3501/TCP,50001/TCP 111s
+ ```
+
+3. Create an ApeCloud MySQL Proxy cluster.
+
+ ```bash
+ helm repo add kubeblocks https://apecloud.github.io/helm-charts
+
+ helm install myproxy kubeblocks/apecloud-mysql-cluster --set mode=raftGroup,proxyEnabled=true,etcd.serviceReference.endpoint="etcd-cluster-etcd.default.svc.cluster.local:2379"
+ ```
+
+4. Check the status of the clusters.
+
+ ```bash
+ kbcli get cluster
+
+ kbcli get pods
+ ```
+
+ You can also enter the etcd container or wesql-scale container to view the configuration of wesql-scale or to check the availability of the etcd service.
+
+ ```bash
+ etcdctl --endpoints=http://etcd-cluster-etcd.default.svc.cluster.local:2379 get /vitess --prefix --keys-only
+ ```
+
+
+
## Enable/Disable Proxy dynamically
@@ -245,17 +245,7 @@ ApeCloud MySQL Proxy is routed through the `vtgate` component, and the way the M
-
-
-Run the command below to connect to the Proxy Cluster.
-
-```bash
-kbcli cluster connect myproxy --components vtgate
-```
-
-
-
-
+
1. Expose the port of VTGate to the localhost so that the localhost can access the Proxy.
@@ -271,23 +261,23 @@ kbcli cluster connect myproxy --components vtgate
-
-
-### Connect Proxy Cluster by MySQL Server
-
-
-
-
+
-Run the command below to connect to the MySQL Server.
+Run the command below to connect to the Proxy Cluster.
```bash
-kbcli cluster connect myproxy
+kbcli cluster connect myproxy --components vtgate
```
-
+
+
+### Connect Proxy Cluster by MySQL Server
+
+
+
+
1. Expose the port of the MySQL Server to the localhost so that the localhost can access the MySQL Server.
@@ -303,6 +293,16 @@ kbcli cluster connect myproxy
+
+
+Run the command below to connect to the MySQL Server.
+
+```bash
+kbcli cluster connect myproxy
+```
+
+
+
:::note
@@ -327,102 +327,7 @@ while true; do date; kubectl port-forward svc/vt-mysql 3306:3306; sleep 0.5; don
-
-
-VTGate, VTConsensus, and VTTablet support parameter configuration. You can configure VTGate and VTConsensus by using `--components` to specify a component and configure VTTablet by using `--components=mysql --config-specs=vttablet-config` to specify both a component and a configuration file template since VTTablet is the sidecar of the MySQL component.
-
-### View parameter details
-
-* View the details of the current configuration file.
-
- ```bash
- # vtgate
- kbcli cluster describe-config myproxy --components vtgate --show-detail
-
- # vtcontroller
- kbcli cluster describe-config myproxy --components vtcontroller --show-detail
-
- # vttablet
- kbcli cluster describe-config myproxy --components mysql --show-detail --config-specs vttablet-config
- ```
-
-* View the parameter descriptions.
-
- ```bash
- # vtgate
- kbcli cluster explain-config myproxy --components vtgate
-
- # vttablet
- kbcli cluster explain-config myproxy --components mysql --config-specs=vttablet-config
- ```
-
-* View the definition of a specified parameter.
-
- ```bash
- kbcli cluster explain-config myproxy --components vtgate --param=healthcheck_timeout
- ```
-
-### Reconfigure parameters
-
-1. View the current values in the MySQL Server.
-
- ```bash
- kbcli cluster connect myproxy --components=vtgate
- ```
-
- ```bash
- mysql> show variables like '%healthcheck_timeout%';
- ```
-
- ```bash
- mysql> show variables like '%health_check_interval%';
- ```
-
-2. Configure the `healthcheck_timeout` for VTGate and the `health_check_interval` for VTTablet.
-
- You can use `--set` flag or edit the parameter configuration file to edit values.
-
- * By using `--set` flag
-
- ```bash
- # vtgate
- kbcli cluster configure myproxy --components vtgate --set=healthcheck_timeout=2s
-
- # vttablet
- kbcli cluster configure myproxy --set=health_check_interval=4s --components=mysql --config-spec=vttablet-config
- ```
-
- * By editing the parameter configuration file
-
- ```bash
- kbcli cluster edit-config myproxy --components vtgate
- ```
-
- :::note
-
- After the `vtgate` parameter values configuration command is executed, a new vtgate Pod is started and the old vtgate Pod is terminated. You can run the command below to monitor whether the old Pod is terminated.
-
- ```bash
- kubectl get pod -w
- ```
-
- :::
-
-3. Use the output command to view the configuration status. For example,
-
- ```bash
- kbcli cluster describe-ops myproxy -reconfiguring-lth8d -n default
- ```
-
- :::note
-
- For more information about parameter configuration, refer to [Configuration](./../configuration/configuration.md).
-
- :::
-
-
-
-
+
1. Get the configuration file of this cluster.
@@ -530,40 +435,110 @@ Apply an OpsRequest to the specified cluster. Configure the parameters according
-
+
-## Log
+VTGate, VTConsensus, and VTTablet support parameter configuration. You can configure VTGate and VTConsensus by using `--components` to specify a component and configure VTTablet by using `--components=mysql --config-specs=vttablet-config` to specify both a component and a configuration file template since VTTablet is the sidecar of the MySQL component.
-You can view the log files of components, Pods, and containers by both kbcli and kubectl.
+### View parameter details
-
+* View the details of the current configuration file.
-
+ ```bash
+ # vtgate
+ kbcli cluster describe-config myproxy --components vtgate --show-detail
+
+ # vtcontroller
+ kbcli cluster describe-config myproxy --components vtcontroller --show-detail
+
+ # vttablet
+ kbcli cluster describe-config myproxy --components mysql --show-detail --config-specs vttablet-config
+ ```
-View the log of different components.
+* View the parameter descriptions.
-```bash
-kbcli cluster list-logs myproxy
-kbcli cluster list-logs myproxy --components vtgate
-kbcli cluster list-logs myproxy --components vtcontroller
-kbcli cluster list-logs myproxy --components mysql
-```
+ ```bash
+ # vtgate
+ kbcli cluster explain-config myproxy --components vtgate
-View the log of a Pod.
+ # vttablet
+ kbcli cluster explain-config myproxy --components mysql --config-specs=vttablet-config
+ ```
-```bash
-kbcli cluster logs myproxy --instance myproxy-vtgate-85bdcf99df-wbmnl
-```
+* View the definition of a specified parameter.
-View the log of a container in a Pod.
+ ```bash
+ kbcli cluster explain-config myproxy --components vtgate --param=healthcheck_timeout
+ ```
-```bash
-kbcli cluster logs myproxy --instance myproxy-mysql-0 -c vttablet
-```
+### Reconfigure parameters
+
+1. View the current values in the MySQL Server.
+
+ ```bash
+ kbcli cluster connect myproxy --components=vtgate
+ ```
+
+ ```bash
+ mysql> show variables like '%healthcheck_timeout%';
+ ```
+
+ ```bash
+ mysql> show variables like '%health_check_interval%';
+ ```
+
+2. Configure the `healthcheck_timeout` for VTGate and the `health_check_interval` for VTTablet.
+
+ You can use `--set` flag or edit the parameter configuration file to edit values.
+
+ * By using `--set` flag
+
+ ```bash
+ # vtgate
+ kbcli cluster configure myproxy --components vtgate --set=healthcheck_timeout=2s
+
+ # vttablet
+ kbcli cluster configure myproxy --set=health_check_interval=4s --components=mysql --config-spec=vttablet-config
+ ```
+
+ * By editing the parameter configuration file
+
+ ```bash
+ kbcli cluster edit-config myproxy --components vtgate
+ ```
+
+ :::note
+
+ After the `vtgate` parameter values configuration command is executed, a new vtgate Pod is started and the old vtgate Pod is terminated. You can run the command below to monitor whether the old Pod is terminated.
+
+ ```bash
+ kubectl get pod -w
+ ```
+
+ :::
+
+3. Use the output command to view the configuration status. For example,
+
+ ```bash
+ kbcli cluster describe-ops myproxy -reconfiguring-lth8d -n default
+ ```
+
+ :::note
+
+ For more information about parameter configuration, refer to [Configuration](./../configuration/configuration.md).
+
+ :::
-
+
+
+## Log
+
+You can view the log files of components, Pods, and containers by both kbcli and kubectl.
+
+
+
+
View the log of VTGate.
@@ -593,49 +568,44 @@ ls /vtdataroot
-
-
-## Monitoring
-
-:::note
+
-In the production environment, all monitoring Addons are disabled by default when installing KubeBlocks. You can enable these Addons but it is highly recommended to build your monitoring system or purchase a third-party monitoring service. For details, refer to [Monitoring](./../../observability/monitor-database.md).
+View the log of different components.
-:::
+```bash
+kbcli cluster list-logs myproxy
+kbcli cluster list-logs myproxy --components vtgate
+kbcli cluster list-logs myproxy --components vtcontroller
+kbcli cluster list-logs myproxy --components mysql
+```
-
+View the log of a Pod.
-
+```bash
+kbcli cluster logs myproxy --instance myproxy-vtgate-85bdcf99df-wbmnl
+```
-1. Enable the monitoring function.
+View the log of a container in a Pod.
- ```bash
- kbcli cluster update myproxy --disable-exporter=false
- ```
+```bash
+kbcli cluster logs myproxy --instance myproxy-mysql-0 -c vttablet
+```
-2. View the Addon list and enable the Grafana Addon.
+
- ```bash
- kbcli addon list
-
- kbcli addon enable grafana
- ```
+
-3. View the dashboard list.
+## Monitoring
- ```bash
- kbcli dashboard list
- ```
+:::note
-4. Open the Grafana dashboard.
+In the production environment, all monitoring Addons are disabled by default when installing KubeBlocks. You can enable these Addons but it is highly recommended to build your monitoring system or purchase a third-party monitoring service. For details, refer to [Monitoring](./../../observability/monitor-database.md).
- ```bash
- kbcli dashboard open kubeblocks-grafana
- ```
+:::
-
+
-
+
1. Enable the monitoring Addons.
@@ -695,35 +665,45 @@ In the production environment, all monitoring Addons are disabled by default whe
-
+
-## Read-write splitting
-
-You can enable the read-write splitting function.
+1. Enable the monitoring function.
-
+ ```bash
+ kbcli cluster update myproxy --disable-exporter=false
+ ```
-
+2. View the Addon list and enable the Grafana Addon.
-```bash
-kbcli cluster configure myproxy --components vtgate --set=read_write_splitting_policy=random
-```
+ ```bash
+ kbcli addon list
+
+ kbcli addon enable grafana
+ ```
-You can also set the ratio for read-write splitting and here is an example of directing 70% flow to the read-only node.
+3. View the dashboard list.
-```bash
-kbcli cluster configure myproxy --components vtgate --set=read_write_splitting_ratio=70
-```
+ ```bash
+ kbcli dashboard list
+ ```
-Moreover, you can [use Grafana](#monitoring) or run `show workload` in the VTGate terminal to view the flow distribution.
+4. Open the Grafana dashboard.
-```bash
-show workload;
-```
+ ```bash
+ kbcli dashboard open kubeblocks-grafana
+ ```
-
+
+
+## Read-write splitting
+
+You can enable the read-write splitting function.
+
+
+
+
1. Get the configuration file of this cluster.
@@ -775,23 +755,33 @@ spec:
-
+
-## Transparent failover
+```bash
+kbcli cluster configure myproxy --components vtgate --set=read_write_splitting_policy=random
+```
-
+You can also set the ratio for read-write splitting and here is an example of directing 70% flow to the read-only node.
-
+```bash
+kbcli cluster configure myproxy --components vtgate --set=read_write_splitting_ratio=70
+```
-Run the command below to implement transparent failover.
+Moreover, you can [use Grafana](#monitoring) or run `show workload` in the VTGate terminal to view the flow distribution.
```bash
-kbcli cluster configure myproxy --components vtgate --set=enable_buffer=true
+show workload;
```
-
+
+
+## Transparent failover
+
+
+
+
1. Get the configuration file of this cluster.
@@ -822,4 +812,14 @@ kbcli cluster configure myproxy --components vtgate --set=enable_buffer=true
+
+
+Run the command below to implement transparent failover.
+
+```bash
+kbcli cluster configure myproxy --components vtgate --set=enable_buffer=true
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md b/docs/user_docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md
index 06b22d98620..362b7b328a6 100644
--- a/docs/user_docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md
+++ b/docs/user_docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md
@@ -30,46 +30,7 @@ KubeBlocks supports the management of Elasticsearch. This tutorial illustrates h
-
-
-***Steps***
-
-1. Execute the following command to create an Elasticsearch cluster.
-
- ```bash
- kbcli cluster create elasticsearch mycluster -n demo
- ```
-
-:::note
-
-If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
-```bash
-kbcli cluster create elasticsearch --help
-
-kbcli cluster create elasticsearch -h
-```
-
-:::
-
-2. Check whether the cluster is created.
-
- ```bash
- kbcli cluster list
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo Delete Creating Sep 27,2024 11:42 UTC+0800
- ```
-
-3. Check the cluster details.
-
- ```bash
- kbcli cluster describe elasticsearch -n demo
- ```
-
-
-
-
+
KubeBlocks implements a `Cluster` CRD to define a cluster. Here is an example of creating an Elasticsearch cluster.
@@ -147,6 +108,45 @@ kubectl get cluster mycluster -n demo -o yaml
+
+
+***Steps***
+
+1. Execute the following command to create an Elasticsearch cluster.
+
+ ```bash
+ kbcli cluster create elasticsearch mycluster -n demo
+ ```
+
+:::note
+
+If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
+
+```bash
+kbcli cluster create elasticsearch --help
+
+kbcli cluster create elasticsearch -h
+```
+
+:::
+
+2. Check whether the cluster is created.
+
+ ```bash
+ kbcli cluster list
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo Delete Creating Sep 27,2024 11:42 UTC+0800
+ ```
+
+3. Check the cluster details.
+
+ ```bash
+ kbcli cluster describe elasticsearch -n demo
+ ```
+
+
+
## Connect to the Elasticsearch cluster
@@ -171,24 +171,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster Delete Running 4m29s
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster Delete Running 4m29s
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
```
@@ -202,51 +202,8 @@ Horizontal scaling changes the amount of pods. For example, you can scale out re
From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out instances, refer to the [Horizontal Scale tutorial](./../maintenance/scale/horizontal-scale.md) for more details and examples.
-
-
-
-1. Set the `--replicas` value according to your needs and perform the horizontal scaling.
-
- ```bash
- kbcli cluster hscale mycluster --replicas=2 --components=elasticsearch -n demo
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
- Please wait a few seconds until the scaling process is over.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-xpdwz -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo Delete Updating Sep 27,2024 10:01 UTC+0800
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -315,28 +272,20 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
1. Change the configuration of `spec.componentSpecs.replicas` in the YAML file. `spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
componentSpecs:
- name: mdit
componentDefRef: elasticsearch
- replicas: 1 # Change the amount
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 1Gi
- terminationPolicy: Delete
+ replicas: 1 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -347,33 +296,30 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
-
-
-### Scale vertically
-
-
-
-
+
-1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
+1. Set the `--replicas` value according to your needs and perform the horizontal scaling.
```bash
- kbcli cluster vscale mycluster --cpu=2 --memory=3Gi --components=elasticsearch -n demo
+ kbcli cluster hscale mycluster --replicas=2 --components=elasticsearch -n demo
```
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
Please wait a few seconds until the scaling process is over.
-2. Validate the vertical scaling operation.
+2. Validate the horizontal scaling operation.
- View the OpsRequest progress.
KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
```bash
- kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
+ kbcli cluster describe-ops mycluster-horizontalscaling-xpdwz -n demo
```
- - Check the cluster status.
+ - View the cluster status.
```bash
kbcli cluster list mycluster -n demo
@@ -382,11 +328,8 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
mycluster demo Delete Updating Sep 27,2024 10:01 UTC+0800
```
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
-
- To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
@@ -395,8 +338,14 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
```
+
+
+
+### Scale vertically
+
+
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -444,12 +393,12 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
```yaml
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
terminationPolicy: Delete
affinity:
@@ -468,13 +417,14 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
serviceAccountName: null
disableExporter: true
replicas: 1
- resources:
+ resources: # Change the values of resources
limits:
cpu: '1'
memory: 4Gi
requests:
cpu: '1'
memory: 4Gi
+ ...
```
2. Check whether the corresponding resources change.
@@ -485,6 +435,49 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
+
+
+1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
+
+ ```bash
+ kbcli cluster vscale mycluster --cpu=2 --memory=3Gi --components=elasticsearch -n demo
+ ```
+
+ Please wait a few seconds until the scaling process is over.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo Delete Updating Sep 27,2024 10:01 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+
+ To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Volume Expansion
@@ -495,24 +488,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster Delete Running 4m29s
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster Delete Running 4m29s
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
```
@@ -523,47 +516,7 @@ mycluster Delete R
-
-
-1. Set the `--storage` value according to your need and run the command to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster --storage=40Gi --components=elasticsearch -t data -n demo
- ```
-
- The volume expansion may take a few minutes.
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo Delete Updating Sep 27,2024 10:01 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -610,13 +563,14 @@ mycluster Delete R
`spec.componentSpecs.volumeClaimTemplates.spec.resources` is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the values of `spec.componentSpecs.volumeClaimTemplates.spec.resources`.
+
+ ```yaml
+ ...
spec:
componentSpecs:
- name: mdit
@@ -629,8 +583,8 @@ mycluster Delete R
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
- terminationPolicy: Delete
+ storage: 40Gi # Change the volume storage size
+ ...
```
2. Check whether the corresponding cluster resources change.
@@ -641,6 +595,46 @@ mycluster Delete R
+
+
+1. Set the `--storage` value according to your need and run the command to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster --storage=40Gi --components=elasticsearch -t data -n demo
+ ```
+
+ The volume expansion may take a few minutes.
+
+2. Validate the volume expansion operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo Delete Updating Sep 27,2024 10:01 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Stop/Start a cluster
@@ -653,15 +647,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Configure replicas as 0 to delete pods.
@@ -682,32 +668,30 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- Edit the cluster YAML file and configure replicas as 0 to delete pods.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Configure the value of `spec.componentSpecs.replicas` as 0 to delete pods.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
terminationPolicy: Delete
componentSpecs:
- name: mdit
componentDefRef: elasticsearch
disableExporter: true
- replicas: 0
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -718,18 +702,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -742,15 +726,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Run the command below to start a cluster.
@@ -771,32 +747,30 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- Change replicas back to the original amount to start this cluster again.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Change the value of `spec.componentSpecs.replicas` back to the original amount to start this cluster again.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
terminationPolicy: Delete
componentSpecs:
- name: mdit
componentDefRef: elasticsearch
disableExporter: true
- replicas: 1
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
+ replicas: 1 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -807,18 +781,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -829,36 +803,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
-1. Restart a cluster.
-
- Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster -n demo --components="elasticsearch" --ttlSecondsAfterSucceed=30
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Validate the restarting.
-
- Run the command below to check the cluster status to check the restarting status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster Delete Running Jul 05,2024 17:51 UTC+0800
- ```
-
- * STATUS=Updating: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Restart a cluster.
@@ -892,6 +837,35 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+
+
+1. Restart a cluster.
+
+ Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="elasticsearch" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster Delete Running Jul 05,2024 17:51 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
## Delete a cluster
@@ -915,24 +889,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mydemo Delete Creating 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mydemo Delete Creating 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
```
@@ -945,22 +919,22 @@ Run the command below to delete a specified cluster.
-
+
+
+If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
```bash
-kbcli cluster delete mycluster -n demo
+kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
+
+kubectl delete -n demo cluster mycluster
```
-
-
-If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
+
```bash
-kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
-
-kubectl delete -n demo cluster mycluster
+kbcli cluster delete mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/connect-to-a-cluster.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/connect-to-a-cluster.md
index 91928b41e75..4c00fc5b1bc 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/connect-to-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/connect-to-a-cluster.md
@@ -90,15 +90,7 @@ If you use AWS EKS, you may want to access to the Kafka cluster from EC2 instanc
-
-
- ```bash
- kbcli cluster create kafka mycluster --host-network-accessible=true -n demo
- ```
-
-
-
-
+
```bash
kubectl apply -f - <
+
+
+ ```bash
+ kbcli cluster create kafka mycluster --host-network-accessible=true -n demo
+ ```
+
+
+
2. Get the corresponding ELB address.
@@ -176,15 +176,7 @@ The current version only supports Kafka broker with a single replica (combined:
-
-
- ```bash
- kbcli cluster create kafka mycluster --publicly-accessible=true -n demo
- ```
-
-
-
-
+
```bash
kubectl apply -f - <
+
+
+ ```bash
+ kbcli cluster create kafka mycluster --publicly-accessible=true -n demo
+ ```
+
+
+
2. Get the corresponding ELB address.
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/create-a-kafka-cluster.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/create-a-kafka-cluster.md
index 2efeae8e80b..6549dcdacb5 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/create-a-kafka-cluster.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/create-a-kafka-cluster.md
@@ -21,26 +21,26 @@ This document shows how to create a Kafka cluster.
-
+
```bash
- kbcli addon list
+ kubectl get addons.extensions.kubeblocks.io kafka
>
- NAME TYPE STATUS EXTRAS AUTO-INSTALL
- ...
- kafka Helm Enabled true
- ...
+ NAME TYPE VERSION PROVIDER STATUS AGE
+ kafka Helm Enabled 13m
```
-
+
```bash
- kubectl get addons.extensions.kubeblocks.io kafka
+ kbcli addon list
>
- NAME TYPE VERSION PROVIDER STATUS AGE
- kafka Helm Enabled 13m
+ NAME TYPE STATUS EXTRAS AUTO-INSTALL
+ ...
+ kafka Helm Enabled true
+ ...
```
@@ -65,36 +65,7 @@ This document shows how to create a Kafka cluster.
-
-
-1. Create a Kafka cluster.
-
- The cluster creation command is simply `kbcli cluster create`. Further, you can customize your cluster resources as demanded by using the `--set` flag.
-
- ```bash
- kbcli cluster create kafka mycluster -n demo
- ```
-
- kbcli provides more options for creating a Kafka cluster, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create kafka --help
-
- kbcli cluster create kafka -h
- ```
-
-2. Verify whether this cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
- ```
-
-
-
-
+
1. Create a Kafka cluster. If you only have one node for deploying a cluster with multiple replicas, set `spec.affinity.topologyKeys` as `null`. But for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
@@ -306,4 +277,33 @@ This document shows how to create a Kafka cluster.
+
+
+1. Create a Kafka cluster.
+
+ The cluster creation command is simply `kbcli cluster create`. Further, you can customize your cluster resources as demanded by using the `--set` flag.
+
+ ```bash
+ kbcli cluster create kafka mycluster -n demo
+ ```
+
+ kbcli provides more options for creating a Kafka cluster, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
+
+ ```bash
+ kbcli cluster create kafka --help
+
+ kbcli cluster create kafka -h
+ ```
+
+2. Verify whether this cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/delete-kafka-cluster.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/delete-kafka-cluster.md
index 8060e3848b3..2f3a465b635 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/delete-kafka-cluster.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/delete-kafka-cluster.md
@@ -30,24 +30,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster kafka kafka-3.3.2 Delete Running 19m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster kafka kafka-3.3.2 Delete Running 19m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
```
@@ -60,15 +60,7 @@ Run the command below to delete a specified cluster.
-
-
-```bash
-kbcli cluster delete mycluster
-```
-
-
-
-
+
```bash
kubectl delete -n demo cluster mycluster
@@ -84,4 +76,12 @@ kubectl delete -n demo cluster mycluster
+
+
+```bash
+kbcli cluster delete mycluster
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/expand-volume.md
index 7cda92a4e24..0dca8a21257 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/expand-volume.md
@@ -19,24 +19,24 @@ Run the command below to check whether the cluster STATUS is `Running`. Otherwis
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster kafka kafka-3.3.2 Delete Running 19m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster kafka kafka-3.3.2 Delete Running 19m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
```
@@ -47,48 +47,7 @@ mycluster kafka kafka-3.3.2 Delete Running
-
-
-1. Configure the resources according to your needs and run the command to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster -n demo --storage=30Gi --components=kafka --volume-claim-templates=data
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
-2. Validate the volume expansion operation.
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo kafka kafka-3.3.2 Delete Updating Sep 27,2024 15:27 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -124,7 +83,7 @@ mycluster kafka kafka-3.3.2 Delete Running
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -162,7 +121,7 @@ mycluster kafka kafka-3.3.2 Delete Running
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -171,7 +130,7 @@ mycluster kafka kafka-3.3.2 Delete Running
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -184,4 +143,45 @@ mycluster kafka kafka-3.3.2 Delete Running
+
+
+1. Configure the resources according to your needs and run the command to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster -n demo --storage=30Gi --components=kafka --volume-claim-templates=data
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+2. Validate the volume expansion operation.
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo kafka kafka-3.3.2 Delete Updating Sep 27,2024 15:27 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/restart-a-kafka-cluster.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/restart-a-kafka-cluster.md
index abb1cd912f8..bce73489d9b 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/restart-a-kafka-cluster.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/restart-a-kafka-cluster.md
@@ -23,36 +23,7 @@ The pod role may change after the cluster restarts.
-
-
-1. Restart a cluster.
-
- Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster -n demo --components="kafka" --ttlSecondsAfterSucceed=30
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Validate the restarting.
-
- Run the command below to check the cluster status to check the restarting status.
-
- ```bash
- kbcli cluster list cluster-name
- >
- NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
- kafka kafka kafka-3.3.2 Delete Running 19m
- ```
-
- * STATUS=Restarting: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Create an OpsRequest to restart a cluster.
@@ -89,4 +60,33 @@ The pod role may change after the cluster restarts.
+
+
+1. Restart a cluster.
+
+ Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="kafka" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list cluster-name
+ >
+ NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+ kafka kafka kafka-3.3.2 Delete Running 19m
+ ```
+
+ * STATUS=Restarting: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/scale.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/scale.md
index 2b491ced85a..f83621154fa 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/scale.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/scale.md
@@ -23,24 +23,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster kafka kafka-3.3.2 Delete Running 19m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster kafka kafka-3.3.2 Delete Running 19m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
```
@@ -51,59 +51,7 @@ mycluster kafka kafka-3.3.2 Delete Running
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --components="broker" --memory="4Gi" --cpu="2"
- ```
-
- - `--components` value can be `broker` or `controller`.
- - broker: all nodes in the combined mode, or all the broker node in the separated node.
- - controller: all the corresponding nodes in the separated mode.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo kafka kafka-3.3.2 Delete Updating Sep 27,2024 15:15 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
- > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
-:::note
-
-Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
-
-:::
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -144,7 +92,7 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: kafka
Enabled Logs:
@@ -203,7 +151,7 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: kafka
Enabled Logs:
@@ -222,6 +170,58 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --components="broker" --memory="4Gi" --cpu="2"
+ ```
+
+ - `--components` value can be `broker` or `controller`.
+ - broker: all nodes in the combined mode, or all the broker node in the separated node.
+ - controller: all the corresponding nodes in the separated mode.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo kafka kafka-3.3.2 Delete Updating Sep 27,2024 15:15 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+ > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+:::note
+
+Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
+
+:::
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -235,24 +235,24 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
- Check whether the cluster STATUS is `Running`. Otherwise, the following operations may fail.
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl -n demo get cluster mycluster
>
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
+ NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+ mycluster kafka kafka-3.3.2 Delete Running 19m
```
-
+
```bash
- kubectl -n demo get cluster mycluster
+ kbcli cluster list mycluster -n demo
>
- NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
- mycluster kafka kafka-3.3.2 Delete Running 19m
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800
```
@@ -265,45 +265,7 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
-
-
-1. Configure the parameters `--components` and `--replicas`, and run the command.
-
- ```bash
- kbcli cluster hscale mycluster -n demo --components="broker" --replicas=3
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. Check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -363,7 +325,7 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: kafka
Enabled Logs:
@@ -386,30 +348,22 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
1. Change the configuration of `spec.componentSpecs.replicas` in the YAML file. `spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: kafka
clusterVersionRef: kafka-3.3.2
componentSpecs:
- name: broker
componentDefRef: broker
- replicas: 2 # Change the amount
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- terminationPolicy: Delete
+ replicas: 2 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -417,7 +371,7 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: kafka
Enabled Logs:
@@ -436,6 +390,44 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
+
+
+1. Configure the parameters `--components` and `--replicas`, and run the command.
+
+ ```bash
+ kbcli cluster hscale mycluster -n demo --components="broker" --replicas=3
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. Check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-kafka/cluster-management/start-stop-a-cluster.md b/docs/user_docs/kubeblocks-for-kafka/cluster-management/start-stop-a-cluster.md
index 3107e45a70a..6fdbac18d41 100644
--- a/docs/user_docs/kubeblocks-for-kafka/cluster-management/start-stop-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-kafka/cluster-management/start-stop-a-cluster.md
@@ -21,15 +21,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Run the command below to stop a cluster.
@@ -50,16 +42,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- Configure replicas as 0 to delete pods.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Configure the value of `spec.componentSpecs.replicas` as 0 to delete pods.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: kafka
clusterVersionRef: kafka-3.3.2
@@ -68,17 +58,17 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: kafka
componentDefRef: kafka
disableExporter: true
- replicas: 0
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- ```
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
+ ```
@@ -88,18 +78,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list -n demo
```
@@ -112,15 +102,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to start the cluster.
@@ -141,14 +123,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- Change replicas back to the original amount to start this cluster again.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Change the value of `spec.componentSpecs.replicas` back to the original amount to start this cluster again.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: kafka
clusterVersionRef: kafka-3.3.2
@@ -157,17 +139,17 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: kafka
componentDefRef: kafka
disableExporter: true
- replicas: 1
- volumeClaimTemplates:
- - name: data
- spec:
- storageClassName: standard
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- ```
+ replicas: 1 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
+ ```
@@ -177,18 +159,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-kafka/configuration/configuration.md b/docs/user_docs/kubeblocks-for-kafka/configuration/configuration.md
index 226f25b9256..e9e28517149 100644
--- a/docs/user_docs/kubeblocks-for-kafka/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-kafka/configuration/configuration.md
@@ -18,7 +18,120 @@ KubeBlocks also supports configuring a cluster by editing the configuration file
-
+
+
+KubeBlocks supports configuring cluster parameters by editing its configuration file.
+
+1. Get the configuration file of this cluster.
+
+ ```bash
+ kubectl get configurations.apps.kubeblocks.io -n demo
+
+ kubectl edit configurations.apps.kubeblocks.io mycluster-kafka-combine -n demo
+ ```
+
+2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `log.cleanup.policy`.
+
+ ```yaml
+ spec:
+ clusterRef: mycluster
+ componentName: kafka
+ configItemDetails:
+ - configFileParams:
+ server.properties:
+ parameters:
+ log.cleanup.policy: "compact"
+ configSpec:
+ constraintRef: kafka-cc
+ name: kafka-configuration-tpl
+ namespace: kb-system
+ templateRef: kafka-configuration-tpl
+ volumeName: kafka-config
+ name: kafka-configuration-tpl
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect as expected.
+
+ ```bash
+ kbcli cluster describe-config mycluster -n demo --show-detail | grep log.cleanup.policy
+ >
+ log.cleanup.policy = compact
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+KubeBlocks supports configuring cluster parameters with OpsRequest.
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `log.cleanup.policy` is configured as `compact`.
+
+ ```bash
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: kafka
+ configurations:
+ - keys:
+ - key: server.properties
+ parameters:
+ - key: log.cleanup.policy
+ value: "compact"
+ name: kafka-configuration-tpl
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ EOF
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply the configuration opsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml
+ ```
+
+3. Verify whether the configuration takes effect as expected.
+
+ ```bash
+ kbcli cluster describe-config mycluster -n demo --show-detail | grep log.cleanup.policy
+ >
+ log.cleanup.policy = compact
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the kbcli tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -220,117 +333,4 @@ log.retention.hours 168 200
-
-
-KubeBlocks supports configuring cluster parameters by editing its configuration file.
-
-1. Get the configuration file of this cluster.
-
- ```bash
- kubectl get configurations.apps.kubeblocks.io -n demo
-
- kubectl edit configurations.apps.kubeblocks.io mycluster-kafka-combine -n demo
- ```
-
-2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `log.cleanup.policy`.
-
- ```yaml
- spec:
- clusterRef: mycluster
- componentName: kafka
- configItemDetails:
- - configFileParams:
- server.properties:
- parameters:
- log.cleanup.policy: "compact"
- configSpec:
- constraintRef: kafka-cc
- name: kafka-configuration-tpl
- namespace: kb-system
- templateRef: kafka-configuration-tpl
- volumeName: kafka-config
- name: kafka-configuration-tpl
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect as expected.
-
- ```bash
- kbcli cluster describe-config mycluster -n demo --show-detail | grep log.cleanup.policy
- >
- log.cleanup.policy = compact
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-KubeBlocks supports configuring cluster parameters with OpsRequest.
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `log.cleanup.policy` is configured as `compact`.
-
- ```bash
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: kafka
- configurations:
- - keys:
- - key: server.properties
- parameters:
- - key: log.cleanup.policy
- value: "compact"
- name: kafka-configuration-tpl
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- EOF
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply the configuration opsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml
- ```
-
-3. Verify whether the configuration takes effect as expected.
-
- ```bash
- kbcli cluster describe-config mycluster -n demo --show-detail | grep log.cleanup.policy
- >
- log.cleanup.policy = compact
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the kbcli tab to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-milvus/manage-milvus.md b/docs/user_docs/kubeblocks-for-milvus/manage-milvus.md
index 5f0459478b2..3448d32a38a 100644
--- a/docs/user_docs/kubeblocks-for-milvus/manage-milvus.md
+++ b/docs/user_docs/kubeblocks-for-milvus/manage-milvus.md
@@ -32,92 +32,7 @@ This tutorial illustrates how to create and manage a Milvus cluster by `kbcli`,
-
-
-***Steps***
-
-1. Execute the following command to create a Milvus cluster.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition=milvus-2.3.2 -n demo
- ```
-
-:::note
-
-If you want to customize your cluster specifications, `kbcli` provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
-```bash
-kbcli cluster create milvus --help
-
-kbcli cluster create milvus -h
-```
-
-:::
-
-2. Check whether the cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
- ```
-
-2. Check the cluster information.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- >
- Name: milvus Created Time: Jul 05,2024 17:35 UTC+0800
- NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY
- demo milvus-2.3.2 Running Delete
-
- Endpoints:
- COMPONENT MODE INTERNAL EXTERNAL
- milvus ReadWrite milvus-milvus.default.svc.cluster.local:19530
- minio ReadWrite milvus-minio.default.svc.cluster.local:9000
- proxy ReadWrite milvus-proxy.default.svc.cluster.local:19530
- milvus-proxy.default.svc.cluster.local:9091
-
- Topology:
- COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME
- etcd milvus-etcd-0 Running Jul 05,2024 17:35 UTC+0800
- minio milvus-minio-0 Running Jul 05,2024 17:35 UTC+0800
- milvus milvus-milvus-0 Running Jul 05,2024 17:35 UTC+0800
- indexnode milvus-indexnode-0 Running Jul 05,2024 17:35 UTC+0800
- mixcoord milvus-mixcoord-0 Running Jul 05,2024 17:35 UTC+0800
- querynode milvus-querynode-0 Running Jul 05,2024 17:35 UTC+0800
- datanode milvus-datanode-0 Running Jul 05,2024 17:35 UTC+0800
- proxy milvus-proxy-0 Running Jul 05,2024 17:35 UTC+0800
-
- Resources Allocation:
- COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
- milvus false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- etcd false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- minio false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- proxy false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- mixcoord false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- datanode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- indexnode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
- querynode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
-
- Images:
- COMPONENT TYPE IMAGE
- milvus milvus milvusdb/milvus:v2.3.2
- etcd etcd docker.io/milvusdb/etcd:3.5.5-r2
- minio minio docker.io/minio/minio:RELEASE.2022-03-17T06-34-49Z
- proxy proxy milvusdb/milvus:v2.3.2
- mixcoord mixcoord milvusdb/milvus:v2.3.2
- datanode datanode milvusdb/milvus:v2.3.2
- indexnode indexnode milvusdb/milvus:v2.3.2
- querynode querynode milvusdb/milvus:v2.3.2
-
- Show cluster events: kbcli cluster list-events -n demo milvus
- ```
-
-
-
-
+
KubeBlocks implements a `Cluster` CRD to define a cluster. Here is an example of creating a Milvus cluster.
@@ -335,6 +250,91 @@ kubectl get cluster mycluster -n demo -o yaml
+
+
+***Steps***
+
+1. Execute the following command to create a Milvus cluster.
+
+ ```bash
+ kbcli cluster create mycluster --cluster-definition=milvus-2.3.2 -n demo
+ ```
+
+:::note
+
+If you want to customize your cluster specifications, `kbcli` provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
+
+```bash
+kbcli cluster create milvus --help
+
+kbcli cluster create milvus -h
+```
+
+:::
+
+2. Check whether the cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
+ ```
+
+3. Check the cluster information.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ >
+ Name: milvus Created Time: Jul 05,2024 17:35 UTC+0800
+ NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY
+ demo milvus-2.3.2 Running Delete
+
+ Endpoints:
+ COMPONENT MODE INTERNAL EXTERNAL
+ milvus ReadWrite milvus-milvus.default.svc.cluster.local:19530
+ minio ReadWrite milvus-minio.default.svc.cluster.local:9000
+ proxy ReadWrite milvus-proxy.default.svc.cluster.local:19530
+ milvus-proxy.default.svc.cluster.local:9091
+
+ Topology:
+ COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME
+ etcd milvus-etcd-0 Running Jul 05,2024 17:35 UTC+0800
+ minio milvus-minio-0 Running Jul 05,2024 17:35 UTC+0800
+ milvus milvus-milvus-0 Running Jul 05,2024 17:35 UTC+0800
+ indexnode milvus-indexnode-0 Running Jul 05,2024 17:35 UTC+0800
+ mixcoord milvus-mixcoord-0 Running Jul 05,2024 17:35 UTC+0800
+ querynode milvus-querynode-0 Running Jul 05,2024 17:35 UTC+0800
+ datanode milvus-datanode-0 Running Jul 05,2024 17:35 UTC+0800
+ proxy milvus-proxy-0 Running Jul 05,2024 17:35 UTC+0800
+
+ Resources Allocation:
+ COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
+ milvus false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ etcd false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ minio false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ proxy false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ mixcoord false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ datanode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ indexnode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+ querynode false 1 / 1 1Gi / 1Gi data:20Gi csi-hostpath-sc
+
+ Images:
+ COMPONENT TYPE IMAGE
+ milvus milvus milvusdb/milvus:v2.3.2
+ etcd etcd docker.io/milvusdb/etcd:3.5.5-r2
+ minio minio docker.io/minio/minio:RELEASE.2022-03-17T06-34-49Z
+ proxy proxy milvusdb/milvus:v2.3.2
+ mixcoord mixcoord milvusdb/milvus:v2.3.2
+ datanode datanode milvusdb/milvus:v2.3.2
+ indexnode indexnode milvusdb/milvus:v2.3.2
+ querynode querynode milvusdb/milvus:v2.3.2
+
+ Show cluster events: kbcli cluster list-events -n demo milvus
+ ```
+
+
+
## Scale
@@ -347,24 +347,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster milvus-2.3.2 Delete Running 4m29s
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster milvus-2.3.2 Delete Running 4m29s
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
```
@@ -375,49 +375,7 @@ mycluster milvus-2.3.2 Delete R
-
-
-1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --cpu=1 --memory=1Gi --components=milvus
- ```
-
- Please wait a few seconds until the scaling process is over.
-
-2. Validate the vertical scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo Delete Updating Jul 05,2024 17:35 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
- > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -504,6 +462,48 @@ mycluster milvus-2.3.2 Delete R
+
+
+1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --cpu=1 --memory=1Gi --components=milvus
+ ```
+
+ Please wait a few seconds until the scaling process is over.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo Delete Updating Jul 05,2024 17:35 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+ > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Volume Expansion
@@ -514,24 +514,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster milvus-2.3.2 Delete Running 4m29s
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster milvus-2.3.2 Delete Running 4m29s
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
```
@@ -542,47 +542,7 @@ mycluster milvus-2.3.2 Delete R
-
-
-1. Set the `--storage` value according to your need and run the command to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster -n demo --storage=40Gi --components=milvus -t data
- ```
-
- The volume expansion may take a few minutes.
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -623,19 +583,20 @@ mycluster milvus-2.3.2 Delete R
-
+
1. Change the value of `spec.componentSpecs.volumeClaimTemplates.spec.resources` in the cluster YAML file.
`spec.componentSpecs.volumeClaimTemplates.spec.resources` is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.volumeClaimTemplates.spec.resources`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: milvus
clusterVersionRef: milvus-2.3.2
@@ -650,8 +611,8 @@ mycluster milvus-2.3.2 Delete R
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
- terminationPolicy: Delete
+ storage: 40Gi # Change the volume storage size
+ ...
```
2. Check whether the corresponding cluster resources change.
@@ -662,40 +623,53 @@ mycluster milvus-2.3.2 Delete R
-
+
-## Restart
+1. Set the `--storage` value according to your need and run the command to expand the volume.
-
+ ```bash
+ kbcli cluster volume-expand mycluster -n demo --storage=40Gi --components=milvus -t data
+ ```
-
+ The volume expansion may take a few minutes.
-1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+2. Validate the volume expansion operation.
- ```bash
- kbcli cluster restart mycluster -n demo --components="milvus" --ttlSecondsAfterSucceed=30
- ```
+ - View the OpsRequest progress.
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-2. Validate the restarting.
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
+ ```
- Run the command below to check the cluster status to check the restarting status.
+ - View the cluster status.
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- milvus demo milvus-2.3.2 Delete Running Jul 05,2024 18:35 UTC+0800
- ```
+ ```bash
+ kbcli cluster list mycluster
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
+ ```
- * STATUS=Updating: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
-
+
+
+## Restart
+
+
+
+
1. Restart a cluster.
@@ -729,6 +703,33 @@ mycluster milvus-2.3.2 Delete R
+
+
+1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="milvus" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ milvus demo milvus-2.3.2 Delete Running Jul 05,2024 18:35 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
## Stop/Start a cluster
@@ -741,15 +742,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to stop a cluster.
@@ -770,14 +763,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
Configure replicas as 0 to delete pods.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: milvus
clusterVersionRef: milvus-2.3.2
@@ -787,7 +780,15 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
componentDefRef: milvus
disableExporter: true
replicas: 0 # Change this value
- ......
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -798,18 +799,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -822,15 +823,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to start a cluster.
@@ -851,14 +844,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
Change replicas back to the original amount to start this cluster again.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: milvus
clusterVersionRef: milvus-2.3.2
@@ -868,7 +861,15 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
componentDefRef: milvus
disableExporter: true
replicas: 1 # Change this value
- ......
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -878,18 +879,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -917,24 +918,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster milvus-2.3.2 Delete Running 14m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster milvus-2.3.2 Delete Running 14m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo milvus-2.3.2 Delete Running Jul 05,2024 17:35 UTC+0800
```
@@ -947,22 +948,22 @@ Run the command below to delete a specified cluster.
-
+
+
+If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
```bash
-kbcli cluster delete mycluster -n demo
+kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
+
+kubectl delete -n demo cluster mycluster
```
-
-
-If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.
+
```bash
-kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
-
-kubectl delete -n demo cluster mycluster
+kbcli cluster delete mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/create-and-connect-to-a-mongodb-cluster.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/create-and-connect-to-a-mongodb-cluster.md
index 258199444f7..4b8b340a645 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/create-and-connect-to-a-mongodb-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/create-and-connect-to-a-mongodb-cluster.md
@@ -23,26 +23,26 @@ This tutorial shows how to create and connect to a MongoDB cluster.
-
+
```bash
- kbcli addon list
+ kubectl get addons.extensions.kubeblocks.io mongodb
>
- NAME TYPE STATUS EXTRAS AUTO-INSTALL
- ...
- mongodb Helm Enabled true
- ...
+ NAME TYPE VERSION PROVIDER STATUS AGE
+ mongodb Helm Enabled 23m
```
-
+
```bash
- kubectl get addons.extensions.kubeblocks.io mongodb
+ kbcli addon list
>
- NAME TYPE VERSION PROVIDER STATUS AGE
- mongodb Helm Enabled 23m
+ NAME TYPE STATUS EXTRAS AUTO-INSTALL
+ ...
+ mongodb Helm Enabled true
+ ...
```
@@ -53,17 +53,7 @@ This tutorial shows how to create and connect to a MongoDB cluster.
-
-
- ```bash
- kbcli clusterdefinition list
-
- kbcli clusterversion list
- ```
-
-
-
-
+
```bash
kubectl get clusterdefinition mongodb
@@ -78,6 +68,16 @@ This tutorial shows how to create and connect to a MongoDB cluster.
+
+
+ ```bash
+ kbcli clusterdefinition list
+
+ kbcli clusterversion list
+ ```
+
+
+
* To keep things isolated, create a separate namespace called `demo` throughout this tutorial.
@@ -94,33 +94,7 @@ KubeBlocks supports creating two types of MongoDB clusters: Standalone and Repli
-
-
-1. Create a MongoDB cluster.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition mongodb -n demo
- ```
-
- The commands above are some common examples to create a cluster with default settings. If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create mongodb --help
- kbcli cluster create mongodb -h
- ```
-
-2. Verify whether this cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mongodb mongodb-5.0 Delete Running Sep 20,2024 10:01 UTC+0800
- ```
-
-
-
-
+
1. Create a MongoDB Standalone.
@@ -201,21 +175,39 @@ KubeBlocks supports creating two types of MongoDB clusters: Standalone and Repli
-
+
-## Connect to a MongoDB Cluster
+1. Create a MongoDB cluster.
-
+ ```bash
+ kbcli cluster create mycluster --cluster-definition mongodb -n demo
+ ```
-
+ The commands above are some common examples to create a cluster with default settings. If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-```bash
-kbcli cluster connect mycluster -n demo
-```
+ ```bash
+ kbcli cluster create mongodb --help
+ kbcli cluster create mongodb -h
+ ```
+
+2. Verify whether this cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mongodb mongodb-5.0 Delete Running Sep 20,2024 10:01 UTC+0800
+ ```
-
+
+
+## Connect to a MongoDB Cluster
+
+
+
+
You can use `kubectl exec` to exec into a Pod and connect to a database.
@@ -267,6 +259,14 @@ You can also port forward the service to connect to the database from your local
+
+
+```bash
+kbcli cluster connect mycluster -n demo
+```
+
+
+
For the detailed database connection guide, refer to [Connect database](./../../../user_docs/connect_database/overview-of-database-connection.md).
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/delete-mongodb-cluster.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/delete-mongodb-cluster.md
index 5ab324f4641..74b8a95dc51 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/delete-mongodb-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/delete-mongodb-cluster.md
@@ -30,21 +30,21 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
+>
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mongodb mongodb-5.0 Delete Running 17m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
->
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mongodb mongodb-5.0 Delete Running 17m
+kbcli cluster list mycluster -n demo
```
@@ -57,15 +57,7 @@ Run the command below to delete a specified cluster.
-
-
-```bash
-kbcli cluster delete mycluster -n demo
-```
-
-
-
-
+
```bash
kubectl delete -n demo cluster mycluster
@@ -81,4 +73,12 @@ kubectl delete -n demo cluster mycluster
+
+
+```bash
+kbcli cluster delete mycluster -n demo
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md
index d674562775d..466353e7724 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md
@@ -19,24 +19,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mongodb mongodb-5.0 Delete Running Apr 10,2023 16:20 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mongodb mongodb-5.0 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mongodb mongodb-5.0 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mongodb mongodb-5.0 Delete Running Apr 10,2023 16:20 UTC+0800
```
@@ -47,49 +47,7 @@ mycluster mongodb mongodb-5.0 Delete Running 27
-
-
-1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster -n demo --components="mongodb" --volume-claim-templates="data" --storage="30Gi"
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mongodb mongodb-5.0 Delete Updating Apr 10,2023 16:27 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -125,7 +83,7 @@ mycluster mongodb mongodb-5.0 Delete Running 27
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -162,7 +120,7 @@ mycluster mongodb mongodb-5.0 Delete Running 27
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -171,7 +129,7 @@ mycluster mongodb mongodb-5.0 Delete Running 27
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -184,4 +142,46 @@ mycluster mongodb mongodb-5.0 Delete Running 27
+
+
+1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster -n demo --components="mongodb" --volume-claim-templates="data" --storage="30Gi"
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+2. Validate the volume expansion operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mongodb mongodb-5.0 Delete Updating Apr 10,2023 16:27 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/restart-mongodb-cluster.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/restart-mongodb-cluster.md
index e94053bf726..ed442cbe5ca 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/restart-mongodb-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/restart-mongodb-cluster.md
@@ -17,34 +17,7 @@ You can restart all pods of the cluster. When an exception occurs in a database,
-
-
-1. Restart a cluster with `kbcli cluster restart` command and enter the cluster name again.
-
- ```bash
- kbcli cluster restart mycluster -n demo
- >
- OpsRequest mongodb-cluster-restart-pzsbj created successfully, you can view the progress:
- kbcli cluster describe-ops mongodb-cluster-restart-pzsbj -n demo
- ```
-
-2. Validate the restart operation.
-
- Check the cluster status to identify the restart status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mongodb-cluster demo mongodb mongodb-5.0 Delete Running Apr 26,2023 12:50 UTC+0800
- ```
-
- - STATUS=Updating: it means the cluster restart is in progress.
- - STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Create an OpsRequest to restart a cluster.
@@ -84,4 +57,31 @@ You can restart all pods of the cluster. When an exception occurs in a database,
+
+
+1. Restart a cluster with `kbcli cluster restart` command and enter the cluster name again.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo
+ >
+ OpsRequest mongodb-cluster-restart-pzsbj created successfully, you can view the progress:
+ kbcli cluster describe-ops mongodb-cluster-restart-pzsbj -n demo
+ ```
+
+2. Validate the restart operation.
+
+ Check the cluster status to identify the restart status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mongodb-cluster demo mongodb mongodb-5.0 Delete Running Apr 26,2023 12:50 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the cluster restart is in progress.
+ - STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/scale-for-mongodb.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/scale-for-mongodb.md
index 84b29fcf2ba..80560cc30a3 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/scale-for-mongodb.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/scale-for-mongodb.md
@@ -23,24 +23,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mongodb mongodb-5.0 Delete Running Apr 10,2023 16:20 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mongodb mongodb-5.0 Delete Running 27m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mongodb mongodb-5.0 Delete Running 27m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mongodb mongodb-5.0 Delete Running Apr 10,2023 16:20 UTC+0800
```
@@ -51,57 +51,7 @@ mycluster mongodb mongodb-5.0 Delete Running 27
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --components=mongodb --cpu=500m --memory=500Mi
- ```
-
- - `--components` describes the component name ready for vertical scaling.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mongodb mongodb-5.0 Delete Running Apr 26,2023 11:50 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be the normal instances number is less than the total instance number or the leader instance is running properly while others are abnormal.
- > To solve the problem, you can check manually to see whether resources are sufficient. If AutoScaling is supported, the system recovers when there are enough resources, otherwise, you can create enough resources and check the result with kubectl describe command.
-
-:::note
-
-Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
-
-:::
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -142,7 +92,7 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: mongodb
Enabled Logs:
@@ -163,14 +113,18 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
-1. Change the configuration of `spec.components.resources` in the YAML file.
+1. Change the configuration of `spec.componentSpecs.resources` in the YAML file.
- `spec.components.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
+ `spec.componentSpecs.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- ......
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
affinity:
podAntiAffinity: Preferred
@@ -185,7 +139,7 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
disableExporter: true
name: mongodb
replicas: 2
- resources:
+ resources: # Change values of resources
limits:
cpu: "2"
memory: 4Gi
@@ -199,7 +153,7 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: mongodb
Enabled Logs:
@@ -218,6 +172,56 @@ Vertical scaling does not synchronize parameters related to CPU and memory and i
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --components=mongodb --cpu=500m --memory=500Mi
+ ```
+
+ - `--components` describes the component name ready for vertical scaling.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mongodb mongodb-5.0 Delete Running Apr 26,2023 11:50 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be the normal instances number is less than the total instance number or the leader instance is running properly while others are abnormal.
+ > To solve the problem, you can check manually to see whether resources are sufficient. If AutoScaling is supported, the system recovers when there are enough resources, otherwise, you can create enough resources and check the result with kubectl describe command.
+
+:::note
+
+Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
+
+:::
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -232,24 +236,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mongodb mongodb-5.0 Delete Running April 26,2023 12:00 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mongodb mongodb-5.0 Delete Running 47m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mongodb mongodb-5.0 Delete Running 47m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mongodb mongodb-5.0 Delete Running April 26,2023 12:00 UTC+0800
```
@@ -260,45 +264,7 @@ mycluster mongodb mongodb-5.0 Delete Running
-
-
-1. Configure the parameters `--components` and `--replicas`, and run the command.
-
- ```bash
- kbcli cluster hscale mycluster -n demo --components="mongodb" --replicas=2
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -365,30 +331,22 @@ mycluster mongodb mongodb-5.0 Delete Running
1. Change the configuration of `spec.componentSpecs.replicas` in the YAML file. `spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: mongo
clusterVersionRef: mongodb-5.0
componentSpecs:
- name: mongo
componentDefRef: mongo
- replicas: 4 # Change the amount
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 20Gi
- terminationPolicy: Delete
+ replicas: 4 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -399,6 +357,44 @@ mycluster mongodb mongodb-5.0 Delete Running
+
+
+1. Configure the parameters `--components` and `--replicas`, and run the command.
+
+ ```bash
+ kbcli cluster hscale mycluster -n demo --components="mongodb" --replicas=2
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/start-stop-a-cluster.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/start-stop-a-cluster.md
index e1bcf51906f..7c735ecc1a3 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/start-stop-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/start-stop-a-cluster.md
@@ -21,15 +21,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to stop a cluster.
@@ -80,24 +72,32 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
+ ```
+
+
+
2. Check the status of the cluster to see whether it is stopped.
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -110,15 +110,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to start a cluster.
@@ -169,24 +161,32 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
+ ```
+
+
+
2. Check the status of the cluster to see whether it is running again.
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/switchover.md b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/switchover.md
index c2bbba6143f..43e73221174 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/cluster-management/switchover.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/cluster-management/switchover.md
@@ -34,29 +34,7 @@ You can switch over a secondary of a MongoDB ReplicaSet to the primary role, and
-
-
-* Switchover with no primary instance specified
-
- ```bash
- kbcli cluster promote mycluster -n demo
- ```
-
-* Switchover with a specified new primary instance
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mongodb-2' -n demo
- ```
-
-* If there are multiple components, you can use `--components` to specify a component.
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mongodb-2' --components='mongodb' -n demo
- ```
-
-
-
-
+
The value of `instanceName` decides whether a new primary instance is specified for the switchover.
@@ -98,6 +76,28 @@ The value of `instanceName` decides whether a new primary instance is specified
+
+
+* Switchover with no primary instance specified
+
+ ```bash
+ kbcli cluster promote mycluster -n demo
+ ```
+
+* Switchover with a specified new primary instance
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mongodb-2' -n demo
+ ```
+
+* If there are multiple components, you can use `--components` to specify a component.
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mongodb-2' --components='mongodb' -n demo
+ ```
+
+
+
## Verify the switchover
@@ -106,18 +106,18 @@ Check the instance status to verify whether the switchover is performed successf
-
+
```bash
-kbcli cluster list-instances -n demo
+kubectl get pods -n demo
```
-
+
```bash
-kubectl get pods -n demo
+kbcli cluster list-instances -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-mongodb/configuration/configuration.md b/docs/user_docs/kubeblocks-for-mongodb/configuration/configuration.md
index b33b2cf6e36..cbd2e97f34d 100644
--- a/docs/user_docs/kubeblocks-for-mongodb/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-mongodb/configuration/configuration.md
@@ -16,7 +16,123 @@ From v0.6.0, KubeBlocks supports `kbcli cluster configure` and `kbcli cluster ed
-
+
+
+KubeBlocks supports configuring cluster parameters by editing its configuration file.
+
+1. Get the configuration file of this cluster.
+
+ ```bash
+ kubectl edit configurations.apps.kubeblocks.io mycluster-mongodb -n demo
+ ```
+
+2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `systemLog.verbosity`.
+
+ ```yaml
+ spec:
+ clusterRef: mycluster
+ componentName: mongodb
+ configItemDetails:
+ - configFileParams:
+ mongodb.cnf:
+ parameters:
+ systemLog.verbosity: "1"
+ configSpec:
+ constraintRef: mongodb-config-constraints
+ name: mongodb-configuration
+ namespace: kb-system
+ templateRef: mongodb5.0-config-template
+ volumeName: mongodb-config
+ name: mongodb-config
+ - configSpec:
+ defaultMode: 292
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mongodb-0 -- bash
+
+ root@mycluster-mongodb-0:/# cat etc/mongodb/mongodb.conf |grep verbosity
+ >
+ verbosity: 1
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+KubeBlocks supports configuring cluster parameters with OpsRequest.
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `systemLog.verbosity` is configured as `1`.
+
+ ```bash
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: mongodb
+ configurations:
+ - keys:
+ - key: mongodb.conf
+ parameters:
+ - key: systemLog.verbosity
+ value: "1"
+ name: mongodb-config
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply the configuration opsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mongodb-0 -- bash
+
+ root@mycluster-mongodb-0:/# cat etc/mongodb/mongodb.conf |grep verbosity
+ >
+ verbosity: 1
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -141,120 +257,4 @@ kbcli cluster diff-config mycluster-reconfiguring-q8ndn mycluster-reconfiguring-
-
-
-KubeBlocks supports configuring cluster parameters by editing its configuration file.
-
-1. Get the configuration file of this cluster.
-
- ```bash
- kubectl edit configurations.apps.kubeblocks.io mycluster-mongodb -n demo
- ```
-
-2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `systemLog.verbosity`.
-
- ```yaml
- spec:
- clusterRef: mycluster
- componentName: mongodb
- configItemDetails:
- - configFileParams:
- mongodb.cnf:
- parameters:
- systemLog.verbosity: "1"
- configSpec:
- constraintRef: mongodb-config-constraints
- name: mongodb-configuration
- namespace: kb-system
- templateRef: mongodb5.0-config-template
- volumeName: mongodb-config
- name: mongodb-config
- - configSpec:
- defaultMode: 292
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mongodb-0 -- bash
-
- root@mycluster-mongodb-0:/# cat etc/mongodb/mongodb.conf |grep verbosity
- >
- verbosity: 1
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-KubeBlocks supports configuring cluster parameters with OpsRequest.
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `systemLog.verbosity` is configured as `1`.
-
- ```bash
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: mongodb
- configurations:
- - keys:
- - key: mongodb.conf
- parameters:
- - key: systemLog.verbosity
- value: "1"
- name: mongodb-config
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply the configuration opsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mongodb-0 -- bash
-
- root@mycluster-mongodb-0:/# cat etc/mongodb/mongodb.conf |grep verbosity
- >
- verbosity: 1
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/create-and-connect-a-mysql-cluster.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/create-and-connect-a-mysql-cluster.md
index 2db1083e05b..22a3e2988df 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/create-and-connect-a-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/create-and-connect-a-mysql-cluster.md
@@ -23,26 +23,26 @@ This tutorial shows how to create and connect to a MySQL cluster.
-
+
```bash
- kbcli addon list
+ kubectl get addons.extensions.kubeblocks.io mysql
>
- NAME VERSION PROVIDER STATUS AUTO-INSTALL
- ...
- mysql 0.9.1 community Enabled true
- ...
+ NAME TYPE VERSION PROVIDER STATUS AGE
+ mysql Helm Enabled 27h
```
-
+
```bash
- kubectl get addons.extensions.kubeblocks.io mysql
+ kbcli addon list
>
- NAME TYPE VERSION PROVIDER STATUS AGE
- mysql Helm Enabled 27h
+ NAME VERSION PROVIDER STATUS AUTO-INSTALL
+ ...
+ mysql 0.9.1 community Enabled true
+ ...
```
@@ -53,16 +53,7 @@ This tutorial shows how to create and connect to a MySQL cluster.
-
-
- ```bash
- kbcli clusterdefinition list
- kbcli clusterversion list
- ```
-
-
-
-
+
Make sure the `mysql` cluster definition is installed.
@@ -86,6 +77,15 @@ This tutorial shows how to create and connect to a MySQL cluster.
+
+
+ ```bash
+ kbcli clusterdefinition list
+ kbcli clusterversion list
+ ```
+
+
+
* To keep things isolated, create a separate namespace called `demo` throughout this tutorial.
@@ -100,39 +100,7 @@ KubeBlocks supports creating two types of MySQL clusters: Standalone and Replica
-
-
-1. Create a MySQL cluster.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition mysql -n demo
- ```
-
- If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create mysql --help
- kbcli cluster create mysql -h
- ```
-
- If you only have one node for deploying a Replication Cluster, set the `--topology-keys` as `null` when creating a Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
-
- ```bash
- kbcli cluster create mycluster --cluster-definition mysql --topology-keys null -n demo
- ```
-
-2. Verify whether this cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mysql mysql-8.0.30 Delete Running Jul 05,2024 18:46 UTC+0800
- ```
-
-
-
-
+
1. Create a MySQL cluster.
@@ -222,21 +190,45 @@ KubeBlocks supports creating two types of MySQL clusters: Standalone and Replica
-
+
-## Connect to a MySQL Cluster
+1. Create a MySQL cluster.
-
+ ```bash
+ kbcli cluster create mycluster --cluster-definition mysql -n demo
+ ```
-
+ If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-```bash
-kbcli cluster connect mycluster --namespace demo
-```
+ ```bash
+ kbcli cluster create mysql --help
+ kbcli cluster create mysql -h
+ ```
+
+ If you only have one node for deploying a Replication Cluster, set the `--topology-keys` as `null` when creating a Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
+
+ ```bash
+ kbcli cluster create mycluster --cluster-definition mysql --topology-keys null -n demo
+ ```
+
+2. Verify whether this cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mysql mysql-8.0.30 Delete Running Jul 05,2024 18:46 UTC+0800
+ ```
-
+
+
+## Connect to a MySQL Cluster
+
+
+
+
You can use `kubectl exec` to exec into a Pod and connect to a database.
@@ -290,6 +282,14 @@ You can also port forward the service to connect to a database from your local m
+
+
+```bash
+kbcli cluster connect mycluster --namespace demo
+```
+
+
+
For the detailed database connection guide, refer to [Connect database](./../../connect_database/overview-of-database-connection.md).
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/delete-mysql-cluster.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/delete-mysql-cluster.md
index b8b727b40c1..5a61db861f1 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/delete-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/delete-mysql-cluster.md
@@ -30,24 +30,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mysql mysql-8.0.30 Delete Running 67m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mysql mysql-8.0.30 Delete Running 67m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
```
@@ -60,15 +60,7 @@ Run the command below to delete a specified cluster.
-
-
-```bash
-kbcli cluster delete mycluster -n demo
-```
-
-
-
-
+
```bash
kubectl delete cluster mycluster -n demo
@@ -84,4 +76,12 @@ kubectl delete -n demo cluster mycluster
+
+
+```bash
+kbcli cluster delete mycluster -n demo
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md
index addc4f3875b..1c549b6dbcd 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md
@@ -18,24 +18,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mysql mysql-8.0.33 Delete Running 4d18h
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mysql mysql-8.0.33 Delete Running 4d18h
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
```
@@ -46,49 +46,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4
-
-
-1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster -n demo --components="mysql" --volume-claim-templates="data" --storage="40Gi"
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
-2. Validate the volume expansion operation. There are two options.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -124,7 +82,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -133,6 +91,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4
Resources:
Requests:
Storage: 40Gi
+ ...
```
@@ -163,7 +122,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -172,7 +131,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -185,4 +144,46 @@ mycluster mysql mysql-8.0.33 Delete Running 4
+
+
+1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster -n demo --components="mysql" --volume-claim-templates="data" --storage="40Gi"
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+2. Validate the volume expansion operation. There are two options.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/restart-mysql-cluster.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/restart-mysql-cluster.md
index c6197eaf00f..4c1f9a28ea4 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/restart-mysql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/restart-mysql-cluster.md
@@ -23,34 +23,7 @@ The pod role may change after the cluster restarts.
-
-
-1. Restart a cluster.
-
- Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster -n demo --components="mysql" --ttlSecondsAfterSucceed=30
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Check the cluster status to validate the restarting.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:01 UTC+0800
- ```
-
- - STATUS=Updating: it means the cluster restart is in progress.
- - STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Restart a cluster.
@@ -91,4 +64,31 @@ The pod role may change after the cluster restarts.
+
+
+1. Restart a cluster.
+
+ Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="mysql" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Check the cluster status to validate the restarting.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:01 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the cluster restart is in progress.
+ - STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md
index 4b68ebf5613..ff5ac39c258 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md
@@ -29,24 +29,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mysql mysql-8.0.33 Delete Running 18m
```
-
+
```bash
-kubectl get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mysql mysql-8.0.33 Delete Running 18m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
```
@@ -57,52 +57,7 @@ mycluster mysql mysql-8.0.33 Delete Running 1
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --components="mysql" --memory="4Gi" --cpu="2"
- ```
-
- - `--components` describes the component name ready for vertical scaling.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling. There are two options.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:11 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
-
- > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -150,14 +105,14 @@ mycluster mysql mysql-8.0.33 Delete Running 1
1. Change the configuration of `spec.componentSpecs.resources` in the YAML file. `spec.componentSpecs.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: mysql
clusterVersionRef: mysql-8.0.30
@@ -165,22 +120,14 @@ mycluster mysql mysql-8.0.33 Delete Running 1
- name: mysql
componentDefRef: mysql
replicas: 2
- resources: # Change the values of resources.
+ resources: # Change the values of resources
requests:
memory: "2Gi"
cpu: "1"
limits:
memory: "4Gi"
cpu: "2"
- volumeClaimTemplates:
- - name: data
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 40Gi
- terminationPolicy: Delete
+ ...
```
2. Check whether the corresponding resources change.
@@ -191,6 +138,51 @@ mycluster mysql mysql-8.0.33 Delete Running 1
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --components="mysql" --memory="4Gi" --cpu="2"
+ ```
+
+ - `--components` describes the component name ready for vertical scaling.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling. There are two options.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:11 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+
+ > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -205,24 +197,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster mysql mysql-8.0.33 Delete Running 18m
```
-
+
```bash
-kubectl get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster mysql mysql-8.0.33 Delete Running 18m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo mysql mysql-8.0.33 Delete Running Jul 05,2024 18:46 UTC+0800
```
@@ -233,50 +225,7 @@ mycluster mysql mysql-8.0.33 Delete Running 1
-
-
-1. Change configuration.
-
- Configure the parameters `--components` and `--replicas`, and run the command.
-
- ```bash
- kbcli cluster hscale mycluster -n demo --components="mysql" --replicas=1
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation. There are two options.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:26 UTC+0800
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -343,22 +292,22 @@ mycluster mysql mysql-8.0.33 Delete Running 1
1. Change the configuration of `spec.componentSpecs.replicas` in the YAML file. `spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: mysql
clusterVersionRef: mysql-8.0.30
componentSpecs:
- name: mysql
componentDefRef: mysql
- replicas: 1 # Change the amount
- ......
+ replicas: 1 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -369,6 +318,49 @@ mycluster mysql mysql-8.0.33 Delete Running 1
+
+
+1. Change configuration.
+
+ Configure the parameters `--components` and `--replicas`, and run the command.
+
+ ```bash
+ kbcli cluster hscale mycluster -n demo --components="mysql" --replicas=1
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation. There are two options.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo mysql mysql-8.0.33 Delete Updating Jul 05,2024 19:26 UTC+0800
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md
index c6c15ec53c8..7c7bb23b45c 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md
@@ -19,15 +19,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to stop a cluster.
@@ -48,14 +40,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
Configure replicas as 0 to delete pods.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: mysql
clusterVersionRef: mysql-8.0.33
@@ -64,8 +56,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: mysql
componentDefRef: mysql
disableExporter: true
- replicas: 0
- ......
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -76,18 +76,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -100,15 +100,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to start a cluster.
@@ -129,14 +121,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
Change replicas back to the original amount to start this cluster again.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: mysql
clusterVersionRef: mysql-8.0.33
@@ -145,8 +137,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: mysql
componentDefRef: mysql
disableExporter: true
- replicas: 2
- ......
+ replicas: 2 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -157,18 +157,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/switchover.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/switchover.md
index a27c06898c2..30f46ae7a41 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/switchover.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/cluster-management/switchover.md
@@ -34,23 +34,7 @@ You can switch over a secondary of a MySQL Replication to the primary role, and
-
-
-* Initiate a switchover with a specified new primary instance.
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mysql-1' -n demo
- ```
-
-* If there are multiple components, you can use `--components` to specify a component.
-
- ```bash
- kbcli cluster promote mycluster --instance='mycluster-mysql-1' --components='apecloud-mysql' -n demo
- ```
-
-
-
-
+
The value of `instanceName` decides whether a new primary instance is specified for the switchover.
@@ -92,6 +76,22 @@ The value of `instanceName` decides whether a new primary instance is specified
+
+
+* Initiate a switchover with a specified new primary instance.
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mysql-1' -n demo
+ ```
+
+* If there are multiple components, you can use `--components` to specify a component.
+
+ ```bash
+ kbcli cluster promote mycluster --instance='mycluster-mysql-1' --components='apecloud-mysql' -n demo
+ ```
+
+
+
## Verify the switchover
@@ -100,18 +100,18 @@ Check the instance status to verify whether the switchover is performed successf
-
+
```bash
-kbcli cluster list-instances -n demo
+kubectl get pods -n demo
```
-
+
```bash
-kubectl get pods -n demo
+kbcli cluster list-instances -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/configuration/configuration.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/configuration/configuration.md
index 526f2a5d4b3..26078fb04f7 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/configuration/configuration.md
@@ -21,7 +21,164 @@ But it's also important to note that the dynamic parameter configuration doesn't
-
+
+
+KubeBlocks supports configuring cluster parameters by editing its configuration file.
+
+1. Get the configuration file of this cluster.
+
+ ```bash
+ kubectl edit configurations.apps.kubeblocks.io mycluster-mysql -n demo
+ ```
+
+2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
+
+ ```yaml
+ spec:
+ clusterRef: mycluster
+ componentName: mysql
+ configItemDetails:
+ - configFileParams:
+ my.cnf:
+ parameters:
+ max_connections: "600"
+ configSpec:
+ constraintRef: oracle-mysql8.0-config-constraints
+ name: mysql-replication-config
+ namespace: kb-system
+ templateRef: oracle-mysql8.0-config-template
+ volumeName: mysql-config
+ name: mysql-replication-config
+ - configSpec:
+ defaultMode: 292
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ root
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ 2gvztbvz
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mysql-0 -- bash
+
+ mysql -uroot -p2gvztbvz
+ >
+ mysql> show variables like 'max_connections';
+ +-----------------+-------+
+ | Variable_name | Value |
+ +-----------------+-------+
+ | max_connections | 600 |
+ +-----------------+-------+
+ 1 row in set (0.00 sec)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+KubeBlocks supports configuring cluster parameters with OpsRequest.
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
+
+ ```bash
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: mysql
+ configurations:
+ - keys:
+ - key: my.cnf
+ parameters:
+ - key: max_connections
+ value: "600"
+ name: mysql-replication-configuration
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ EOF
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply the configuration opsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml -n demo
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ root
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ 2gvztbvz
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-mysql-0 -- bash
+
+ mysql -uroot -p2gvztbvz
+ >
+ mysql> show variables like 'max_connections';
+ +-----------------+-------+
+ | Variable_name | Value |
+ +-----------------+-------+
+ | max_connections | 600 |
+ +-----------------+-------+
+ 1 row in set (0.00 sec)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -282,161 +439,4 @@ innodb_buffer_pool_size 512M 1G
-
-
-KubeBlocks supports configuring cluster parameters by editing its configuration file.
-
-1. Get the configuration file of this cluster.
-
- ```bash
- kubectl edit configurations.apps.kubeblocks.io mycluster-mysql -n demo
- ```
-
-2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
-
- ```yaml
- spec:
- clusterRef: mycluster
- componentName: mysql
- configItemDetails:
- - configFileParams:
- my.cnf:
- parameters:
- max_connections: "600"
- configSpec:
- constraintRef: oracle-mysql8.0-config-constraints
- name: mysql-replication-config
- namespace: kb-system
- templateRef: oracle-mysql8.0-config-template
- volumeName: mysql-config
- name: mysql-replication-config
- - configSpec:
- defaultMode: 292
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- root
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- 2gvztbvz
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mysql-0 -- bash
-
- mysql -uroot -p2gvztbvz
- >
- mysql> show variables like 'max_connections';
- +-----------------+-------+
- | Variable_name | Value |
- +-----------------+-------+
- | max_connections | 600 |
- +-----------------+-------+
- 1 row in set (0.00 sec)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-KubeBlocks supports configuring cluster parameters with OpsRequest.
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
-
- ```bash
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: mysql
- configurations:
- - keys:
- - key: my.cnf
- parameters:
- - key: max_connections
- value: "600"
- name: mysql-replication-configuration
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- EOF
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply the configuration opsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml -n demo
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- root
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- 2gvztbvz
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-mysql-0 -- bash
-
- mysql -uroot -p2gvztbvz
- >
- mysql> show variables like 'max_connections';
- +-----------------+-------+
- | Variable_name | Value |
- +-----------------+-------+
- | max_connections | 600 |
- +-----------------+-------+
- 1 row in set (0.00 sec)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-mysql-community-edition/high-availability/high-availability.md b/docs/user_docs/kubeblocks-for-mysql-community-edition/high-availability/high-availability.md
index 0502026718f..8551d31a2d4 100644
--- a/docs/user_docs/kubeblocks-for-mysql-community-edition/high-availability/high-availability.md
+++ b/docs/user_docs/kubeblocks-for-mysql-community-edition/high-availability/high-availability.md
@@ -42,63 +42,63 @@ The faults here are all simulated by deleting a pod. When there are sufficient r
-
+
-1. View the MySQL Replication Cluster information. View the primary pod name in `Topology`. In this example, the primary pod's name is `mycluster-mysql-0`.
+1. View the pod role of the MySQL Replication Cluster. In this example, the primary pod's name is `mycluster-mysql-0`.
```bash
- kbcli cluster describe mycluster
+ kubectl get pods --show-labels -n demo | grep role
```
- ![describe_cluster](./../../../img/ha-mysql-describe-cluster.png)
+ ![describe_pod](./../../../img/api-mysql-ha-grep-role.png)
2. Delete the primary pod `mycluster-mysql-0` to simulate a pod fault.
```bash
- kubectl delete pod mycluster-mysql-0
+ kubectl delete pod mycluster-mysql-0 -n demo
```
- ![delete_pod](./../../../img/ha-mysql-delete-primary-pod.png)
-3. Run `kbcli cluster describe` to check the status of the pods and Replication Cluster connection.
-
- ***Results***
+ ![delete_pod](./../../../img/api-mysql-ha-delete-primary-pod.png)
+3. Check the status of the pods and Replication Cluster connection.
The following example shows that the roles of pods have changed after the old primary pod was deleted and `mycluster-mysql-1` is elected as the new primary pod.
```bash
- kbcli cluster describe mycluster
+ kubectl get pods --show-labels -n demo | grep role
```
- ![describe_cluster_after](./../../../img/ha-mysql-primary-pod-describe-after.png)
-
- It shows that this MySQL Replication Cluster can be connected within seconds.
+ ![describe_cluster_after](./../../../img/api-mysql-ha-delete-primary-pod-after.png)
-
+
-1. View the pod role of the MySQL Replication Cluster. In this example, the primary pod's name is `mycluster-mysql-0`.
+1. View the MySQL Replication Cluster information. View the primary pod name in `Topology`. In this example, the primary pod's name is `mycluster-mysql-0`.
```bash
- kubectl get pods --show-labels -n demo | grep role
+ kbcli cluster describe mycluster
```
- ![describe_pod](./../../../img/api-mysql-ha-grep-role.png)
+ ![describe_cluster](./../../../img/ha-mysql-describe-cluster.png)
2. Delete the primary pod `mycluster-mysql-0` to simulate a pod fault.
```bash
- kubectl delete pod mycluster-mysql-0 -n demo
+ kubectl delete pod mycluster-mysql-0
```
- ![delete_pod](./../../../img/api-mysql-ha-delete-primary-pod.png)
-3. Check the status of the pods and Replication Cluster connection.
+ ![delete_pod](./../../../img/ha-mysql-delete-primary-pod.png)
+3. Run `kbcli cluster describe` to check the status of the pods and Replication Cluster connection.
+
+ ***Results***
The following example shows that the roles of pods have changed after the old primary pod was deleted and `mycluster-mysql-1` is elected as the new primary pod.
```bash
- kubectl get pods --show-labels -n demo | grep role
+ kbcli cluster describe mycluster
```
- ![describe_cluster_after](./../../../img/api-mysql-ha-delete-primary-pod-after.png)
+ ![describe_cluster_after](./../../../img/ha-mysql-primary-pod-describe-after.png)
+
+ It shows that this MySQL Replication Cluster can be connected within seconds.
@@ -114,33 +114,7 @@ After the primary pod is deleted, the MySQL Replication Cluster elects a new pri
-
-
-1. View the MySQL Replication Cluster information and view the secondary pod name in `Topology`. In this example, the secondary pod is `mycluster-mysql-0`.
-
- ```bash
- kbcli cluster describe mycluster
- ```
-
- ![describe_cluster](./../../../img/ha-mysql-primary-pod-describe-after.png)
-2. Delete the secondary pod mycluster-mysql-0.
-
- ```bash
- kubectl delete pod mycluster-mysql-0
- ```
-
- ![delete_secondary_pod](./../../../img/ha-mysql-delete-secondary.png)
-3. View the Replication Cluster status and you can find the secondary pod is being terminated in `Component.Instance`.
-
- ```bash
- kbcli cluster describe mycluster
- ```
-
- ![describe_cluster_secondary](./../../../img/ha-mysql-delete-secondary-after.png)
-
-
-
-
+
1. View the pod role again and in this example, the secondary pod is `mycluster-mysql-0`.
@@ -170,45 +144,45 @@ After the primary pod is deleted, the MySQL Replication Cluster elects a new pri
-
-
-***How the automatic recovery works***
-
-One secondary pod exception doesn't trigger re-electing of the primary pod or access link switch, so the R/W of the cluster is not affected. The secondary pod exception triggers recreation and recovery. The process takes no more than 30 seconds.
-
-### Both pods exception
-
-***Steps:***
-
-
-
-
+
-1. Run the command below to view the MySQL Replication Cluster information and view the pods' names in `Topology`.
+1. View the MySQL Replication Cluster information and view the secondary pod name in `Topology`. In this example, the secondary pod is `mycluster-mysql-0`.
```bash
kbcli cluster describe mycluster
```
- ![describe_cluster](./../../../img/ha-mysql-delete-secondary-after.png)
-2. Delete all pods.
+ ![describe_cluster](./../../../img/ha-mysql-primary-pod-describe-after.png)
+2. Delete the secondary pod mycluster-mysql-0.
```bash
- kubectl delete pod mycluster-mysql-1 mycluster-mysql-0
+ kubectl delete pod mycluster-mysql-0
```
- ![delete_three_pods](./../../../img/ha-mysql-delete-both-pods.png)
-3. Run the command below to view the deleting process. You can find the pods are pending.
+ ![delete_secondary_pod](./../../../img/ha-mysql-delete-secondary.png)
+3. View the Replication Cluster status and you can find the secondary pod is being terminated in `Component.Instance`.
```bash
kbcli cluster describe mycluster
```
- ![describe_three_clusters](./../../../img/ha-mysql-delete-both-pods-after.png)
+ ![describe_cluster_secondary](./../../../img/ha-mysql-delete-secondary-after.png)
-
+
+
+***How the automatic recovery works***
+
+One secondary pod exception doesn't trigger re-electing of the primary pod or access link switch, so the R/W of the cluster is not affected. The secondary pod exception triggers recreation and recovery. The process takes no more than 30 seconds.
+
+### Both pods exception
+
+***Steps:***
+
+
+
+
1. View the role of pods.
@@ -241,6 +215,32 @@ One secondary pod exception doesn't trigger re-electing of the primary pod or ac
+
+
+1. Run the command below to view the MySQL Replication Cluster information and view the pods' names in `Topology`.
+
+ ```bash
+ kbcli cluster describe mycluster
+ ```
+
+ ![describe_cluster](./../../../img/ha-mysql-delete-secondary-after.png)
+2. Delete all pods.
+
+ ```bash
+ kubectl delete pod mycluster-mysql-1 mycluster-mysql-0
+ ```
+
+ ![delete_three_pods](./../../../img/ha-mysql-delete-both-pods.png)
+3. Run the command below to view the deleting process. You can find the pods are pending.
+
+ ```bash
+ kbcli cluster describe mycluster
+ ```
+
+ ![describe_three_clusters](./../../../img/ha-mysql-delete-both-pods-after.png)
+
+
+
***How the automatic recovery works***
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/create-and-connect-a-postgresql-cluster.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/create-and-connect-a-postgresql-cluster.md
index da0048345ba..3e3a0742b01 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/create-and-connect-a-postgresql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/create-and-connect-a-postgresql-cluster.md
@@ -23,26 +23,26 @@ This tutorial shows how to create and connect to a PostgreSQL cluster.
-
+
```bash
- kbcli addon list
+ kubectl get addons.extensions.kubeblocks.io postgresql
>
- NAME TYPE STATUS EXTRAS AUTO-INSTALL
- ...
- postgresql Helm Enabled true
- ...
+ NAME TOPOLOGIES SERVICEREFS STATUS AGE
+ postgresql Available 30m
```
-
+
```bash
- kubectl get addons.extensions.kubeblocks.io postgresql
+ kbcli addon list
>
- NAME TOPOLOGIES SERVICEREFS STATUS AGE
- postgresql Available 30m
+ NAME TYPE STATUS EXTRAS AUTO-INSTALL
+ ...
+ postgresql Helm Enabled true
+ ...
```
@@ -53,16 +53,7 @@ This tutorial shows how to create and connect to a PostgreSQL cluster.
-
-
- ```bash
- kbcli clusterdefinition list
- kbcli clusterversion list
- ```
-
-
-
-
+
```bash
kubectl get clusterdefinition postgresql
@@ -88,6 +79,15 @@ This tutorial shows how to create and connect to a PostgreSQL cluster.
+
+
+ ```bash
+ kbcli clusterdefinition list
+ kbcli clusterversion list
+ ```
+
+
+
* To keep things isolated, create a separate namespace called `demo` throughout this tutorial.
@@ -102,47 +102,7 @@ KubeBlocks supports creating two types of PostgreSQL clusters: Standalone and Re
-
-
-1. Create a PostgreSQL cluster.
-
- Here is an example of creating a Standalone.
-
- ```bash
- kbcli cluster create postgresql mycluster -n demo
- ```
-
- `kbcli` provides various options for you to customize your cluster specifications, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create postgresql --help
- kbcli cluster create postgresql -h
- ```
-
- For example, you can create a Replication Cluster with the `--replicas` flag.
-
- ```bash
- kbcli cluster create postgresql mycluster --replicas=2 -n demo
- ```
-
- If you only have one node for deploying a Replication Cluster, set the `--topology-keys` as `null` when creating a Replication Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
-
- ```bash
- kbcli cluster create postgresql mycluster --replicas=2 --availability-policy='none' -n demo
- ```
-
-2. Verify whether this cluster is created successfully.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
- ```
-
-
-
-
+
1. Create a PostgreSQL cluster.
@@ -232,20 +192,52 @@ KubeBlocks supports creating two types of PostgreSQL clusters: Standalone and Re
-
+
-## Connect to a PostgreSQL Cluster
+1. Create a PostgreSQL cluster.
-
+ Here is an example of creating a Standalone.
-
+ ```bash
+ kbcli cluster create postgresql mycluster -n demo
+ ```
-```bash
-kbcli cluster connect mycluster --namespace demo
-```
+ `kbcli` provides various options for you to customize your cluster specifications, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
+
+ ```bash
+ kbcli cluster create postgresql --help
+ kbcli cluster create postgresql -h
+ ```
+
+ For example, you can create a Replication Cluster with the `--replicas` flag.
+
+ ```bash
+ kbcli cluster create postgresql mycluster --replicas=2 -n demo
+ ```
+
+ If you only have one node for deploying a Replication Cluster, set the `--topology-keys` as `null` when creating a Replication Cluster. But you should note that for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.
+
+ ```bash
+ kbcli cluster create postgresql mycluster --replicas=2 --availability-policy='none' -n demo
+ ```
+
+2. Verify whether this cluster is created successfully.
+
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+ ```
+
+
+## Connect to a PostgreSQL Cluster
+
+
+
You can use `kubectl exec` to exec into a Pod and connect to a database.
@@ -300,6 +292,14 @@ You can also port forward the service to connect to the database from your local
+
+
+```bash
+kbcli cluster connect mycluster --namespace demo
+```
+
+
+
For the detailed database connection guide, refer to [Connect database](./../../connect_database/overview-of-database-connection.md).
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/delete-a-postgresql-cluster.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/delete-a-postgresql-cluster.md
index 56f7c239502..fc852418627 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/delete-a-postgresql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/delete-a-postgresql-cluster.md
@@ -30,24 +30,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster postgresql postgresql-14.8.0 Delete Running 29m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster postgresql postgresql-14.8.0 Delete Running 29m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
```
@@ -60,15 +60,7 @@ Run the command below to delete a specified cluster.
-
-
-```bash
-kbcli cluster delete mycluster -n demo
-```
-
-
-
-
+
```bash
kubectl delete cluster mycluster -n demo
@@ -84,4 +76,12 @@ kubectl delete -n demo cluster mycluster
+
+
+```bash
+kbcli cluster delete mycluster -n demo
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md
index 5cbb64ffdc4..ee9b2c2485a 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md
@@ -19,24 +19,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster postgresql postgresql-14.8.0 Delete Running 29m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster postgresql postgresql-14.8.0 Delete Running 29m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
```
@@ -47,49 +47,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
-
-
-1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster --components="postgresql" --volume-claim-templates="data" --storage="30Gi" -n demo
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
-2. Validate the volume expansion.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo postgresql postgresql-14.8.0 Delete Updating Sep 28,2024 16:47 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -125,7 +83,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -164,7 +122,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -173,7 +131,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Volume Claim Templates:
Name: data
Spec:
@@ -186,4 +144,46 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
+
+
+1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
+
+ ```bash
+ kbcli cluster volume-expand mycluster --components="postgresql" --volume-claim-templates="data" --storage="30Gi" -n demo
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+2. Validate the volume expansion.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo postgresql postgresql-14.8.0 Delete Updating Sep 28,2024 16:47 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/restart-a-postgresql-cluster.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/restart-a-postgresql-cluster.md
index 67b4d25fa2c..77c1c97ed4d 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/restart-a-postgresql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/restart-a-postgresql-cluster.md
@@ -23,34 +23,7 @@ The pod role may change after the cluster restarts.
-
-
-1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster -n demo --components="postgresql" --ttlSecondsAfterSucceed=30
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Validate the restarting.
-
- Run the command below to check the cluster status to check the restarting status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:57 UTC+0800
- ```
-
- * STATUS=Updating: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Restart a cluster.
@@ -91,4 +64,31 @@ The pod role may change after the cluster restarts.
+
+
+1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="postgresql" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:57 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md
index 61c798d56f2..a0f67fca1b7 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md
@@ -29,24 +29,24 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster postgresql postgresql-14.8.0 Delete Running 29m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster postgresql postgresql-14.8.0 Delete Running 29m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
```
@@ -57,51 +57,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --components="postgresql" --memory="1Gi" --cpu="1"
- ```
-
- - `--components` describes the component name ready for vertical scaling.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be the normal instances number is less than the total instance number or the primary instance is running properly while others are abnormal.
- > To solve the problem, you can check manually to see whether resources are sufficient. If AutoScaling is supported, the system recovers when there are enough resources, otherwise, you can create enough resources and check the result with kubectl describe command.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -142,7 +98,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: postgresql
Enabled Logs:
@@ -163,14 +119,18 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
-1. Change the configuration of `spec.components.resources` in the YAML file.
+1. Change the configuration of `spec.componentSpecs.resources` in the YAML file.
`spec.components.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- ......
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
affinity:
podAntiAffinity: Preferred
@@ -185,13 +145,14 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
disableExporter: true
name: postgresql
replicas: 2
- resources:
+ resources: # Change values of resources
limits:
cpu: "2"
memory: 4Gi
requests:
cpu: "1"
memory: 2Gi
+ ...
```
2. Check whether the corresponding resources change.
@@ -199,7 +160,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: postgresql
Enabled Logs:
@@ -218,6 +179,50 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --components="postgresql" --memory="1Gi" --cpu="1"
+ ```
+
+ - `--components` describes the component name ready for vertical scaling.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-g67k9 -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be the normal instances number is less than the total instance number or the primary instance is running properly while others are abnormal.
+ > To solve the problem, you can check manually to see whether resources are sufficient. If AutoScaling is supported, the system recovers when there are enough resources, otherwise, you can create enough resources and check the result with kubectl describe command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -232,24 +237,24 @@ Check whether the cluster STATUS is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster postgresql postgresql-14.8.0 Delete Running 29m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster postgresql postgresql-14.8.0 Delete Running 29m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo postgresql postgresql-14.8.0 Delete Running Sep 28,2024 16:47 UTC+0800
```
@@ -260,45 +265,7 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
-
-
-1. Configure the parameters `--components` and `--replicas`, and run the command.
-
- ```bash
- kbcli cluster hscale mycluster -n demo --components="postgresql" --replicas=2
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -367,22 +334,22 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
`spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: postgresql
clusterVersionRef: postgresql-14.8.0
componentSpecs:
- name: postgresql
componentDefRef: postgresql
- replicas: 1 # Change the amount
- ......
+ replicas: 1 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -393,6 +360,44 @@ mycluster postgresql postgresql-14.8.0 Delete Runnin
+
+
+1. Configure the parameters `--components` and `--replicas`, and run the command.
+
+ ```bash
+ kbcli cluster hscale mycluster -n demo --components="postgresql" --replicas=2
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-ffp9p -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md
index 358097aa232..eacb3d53667 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md
@@ -19,15 +19,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to stop a cluster.
@@ -50,12 +42,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
Configure replicas as 0 to delete pods.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: postgresql
clusterVersionRef: postgresql-14.8.0
@@ -64,8 +58,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: postgresql
componentDefRef: postgresql
disableExporter: true
- replicas: 0
- ......
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -76,18 +78,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list -n demo
```
@@ -100,15 +102,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
```bash
kubectl apply -f - <
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: postgresql
clusterVersionRef: postgresql-14.8.0
@@ -144,8 +139,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: mysql
componentDefRef: mysql
disableExporter: true
- replicas: 1
- ......
+ replicas: 1 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -156,18 +159,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/switchover.md b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/switchover.md
index 72d2a9d33eb..9675dcc7846 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/cluster-management/switchover.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/cluster-management/switchover.md
@@ -34,29 +34,7 @@ You can switch over a secondary of a PostgreSQL Replication Cluster to the prima
-
-
-* Switchover with no primary instance specified
-
- ```bash
- kbcli cluster promote mycluster -n demo
- ```
-
-* Switchover with a specified new primary instance
-
- ```bash
- kbcli cluster promote mycluster -n demo --instance='mycluster-postgresql-2'
- ```
-
-* If there are multiple components, you can use `--components` to specify a component.
-
- ```bash
- kbcli cluster promote mycluster -n demo --instance='mycluster-postgresql-2' --components='postgresql'
- ```
-
-
-
-
+
The value of `instanceName` decides whether a new primary instance is specified for the switchover.
@@ -98,6 +76,28 @@ The value of `instanceName` decides whether a new primary instance is specified
+
+
+* Switchover with no primary instance specified
+
+ ```bash
+ kbcli cluster promote mycluster -n demo
+ ```
+
+* Switchover with a specified new primary instance
+
+ ```bash
+ kbcli cluster promote mycluster -n demo --instance='mycluster-postgresql-2'
+ ```
+
+* If there are multiple components, you can use `--components` to specify a component.
+
+ ```bash
+ kbcli cluster promote mycluster -n demo --instance='mycluster-postgresql-2' --components='postgresql'
+ ```
+
+
+
## Verify the switchover
@@ -106,20 +106,20 @@ Check the instance status to verify whether the switchover is performed successf
-
+
```bash
-kbcli cluster list-instances -n demo
+kubectl get cluster mycluster -n demo
+
+kubectl -n demo get po -L kubeblocks.io/role
```
-
+
```bash
-kubectl get cluster mycluster -n demo
-
-kubectl -n demo get po -L kubeblocks.io/role
+kbcli cluster list-instances -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-postgresql/configuration/configuration.md b/docs/user_docs/kubeblocks-for-postgresql/configuration/configuration.md
index 56914888495..08dc5b497d0 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/configuration/configuration.md
@@ -20,7 +20,162 @@ But it's also important to note that the dynamic parameter configuration doesn't
-
+
+
+KubeBlocks supports configuring cluster parameters by editing its configuration file.
+
+1. Get the configuration file of this cluster.
+
+ ```bash
+ kubectl edit configurations.apps.kubeblocks.io mycluster-postgresql -n demo
+ ```
+
+2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
+
+ ```yaml
+ spec:
+ clusterRef: mycluster
+ componentName: postgresql
+ configItemDetails:
+ - configFileParams:
+ my.cnf:
+ parameters:
+ max_connections: "600"
+ configSpec:
+ constraintRef: postgresql14-cc
+ defaultMode: 292
+ keys:
+ - postgresql.conf
+ name: postgresql-configuration
+ namespace: kb-system
+ templateRef: postgresql-configuration
+ volumeName: postgresql-config
+ name: postgresql-configuration
+ - configSpec:
+ defaultMode: 292
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ root
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ 2gvztbvz
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-postgresql-0 -- bash
+
+ root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
+ Password: tf8fhsv2
+ >
+ postgres=# show max_connections;
+ max_connections
+ -----------------
+ 600
+ (1 row)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a YAML file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
+
+ ```yaml
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: postgresql
+ configurations:
+ - keys:
+ - key: postgresql.conf
+ parameters:
+ - key: max_connections
+ value: "600"
+ name: postgresql-configuration
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply this OpsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml
+ ```
+
+3. Connect to this cluster to verify whether the configuration takes effect.
+
+ 1. Get the username and password.
+
+ ```bash
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ postgres
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ tf8fhsv2
+ ```
+
+ 2. Connect to this cluster and verify whether the parameters are configured as expected.
+
+ ```bash
+ kubectl exec -ti -n demo mycluster-postgresql-0 -- bash
+
+ root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
+ Password: tf8fhsv2
+ >
+ postgres=# show max_connections;
+ max_connections
+ -----------------
+ 600
+ (1 row)
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -262,159 +417,4 @@ shared_buffers 256MB 512MB
-
-
-KubeBlocks supports configuring cluster parameters by editing its configuration file.
-
-1. Get the configuration file of this cluster.
-
- ```bash
- kubectl edit configurations.apps.kubeblocks.io mycluster-postgresql -n demo
- ```
-
-2. Configure parameters according to your needs. The example below adds the `spec.configFileParams` part to configure `max_connections`.
-
- ```yaml
- spec:
- clusterRef: mycluster
- componentName: postgresql
- configItemDetails:
- - configFileParams:
- my.cnf:
- parameters:
- max_connections: "600"
- configSpec:
- constraintRef: postgresql14-cc
- defaultMode: 292
- keys:
- - postgresql.conf
- name: postgresql-configuration
- namespace: kb-system
- templateRef: postgresql-configuration
- volumeName: postgresql-config
- name: postgresql-configuration
- - configSpec:
- defaultMode: 292
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- root
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- 2gvztbvz
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-postgresql-0 -- bash
-
- root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
- Password: tf8fhsv2
- >
- postgres=# show max_connections;
- max_connections
- -----------------
- 600
- (1 row)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a YAML file named `mycluster-configuring-demo.yaml`. In this example, `max_connections` is configured as `600`.
-
- ```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: postgresql
- configurations:
- - keys:
- - key: postgresql.conf
- parameters:
- - key: max_connections
- value: "600"
- name: postgresql-configuration
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply this OpsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml
- ```
-
-3. Connect to this cluster to verify whether the configuration takes effect.
-
- 1. Get the username and password.
-
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- postgres
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- tf8fhsv2
- ```
-
- 2. Connect to this cluster and verify whether the parameters are configured as expected.
-
- ```bash
- kubectl exec -ti -n demo mycluster-postgresql-0 -- bash
-
- root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
- Password: tf8fhsv2
- >
- postgres=# show max_connections;
- max_connections
- -----------------
- 600
- (1 row)
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-postgresql/high-availability/high-availability.md b/docs/user_docs/kubeblocks-for-postgresql/high-availability/high-availability.md
index 48552eff946..29e98079827 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/high-availability/high-availability.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/high-availability/high-availability.md
@@ -33,174 +33,174 @@ KubeBlocks integrates [the open-source Patroni solution](https://patroni.readthe
-
+
-1. View the initial status of the PostgreSQL cluster.
+1. View the initial status of the PostgreSQL cluster and pods.
```bash
- kbcli cluster describe mycluster -n demo
+ kubectl get cluster mycluster -n demo
+
+ kubectl -n demo get pod -L kubeblocks.io/role
```
- ![PostgreSQL cluster original status](../../../img/pgsql-ha-before.png)
+ ![PostgreSQL cluster original status](./../../../img/api-ha-pg-original-status.png)
- Currently, `mycluster-postgresql-1` is the primary pod and `mycluster-postgresql-0` is the secondary pod.
+ Currently, `mycluster-postgresql-0` is the primary pod and `mycluster-postgresql-1` is the secondary pod.
2. Simulate a primary pod exception.
```bash
# Enter the primary pod
- kubectl exec -it mycluster-postgresql-1 -n demo -- bash
+ kubectl exec -it mycluster-postgresql-0 -n demo -- bash
# Delete the data directory of PostgreSQL to simulate an exception
root@mycluster-postgresql-0:/home/postgres# rm -fr /home/postgres/pgdata/pgroot/data
```
-3. View logs to observe how the roles of pods switch when an exception occurs.
+3. View logs to observe how the roles of pods switch when an exception occurs.
```bash
# View the primary pod logs
- kubectl logs mycluster-postgresql-1 -n demo
+ kubectl logs mycluster-postgresql-0 -n demo
```
In the logs, the leader lock is released from the primary pod and an HA switch occurs.
```bash
- 2024-09-28 09:54:15,199 INFO: Lock owner: mycluster-postgresql-1; I am mycluster-postgresql-1
- 2024-09-28 09:54:15,419 INFO: Leader key released
- 2024-09-28 09:54:15,632 INFO: released leader key voluntarily as data dir empty and currently leader
- 2024-09-28 09:54:15,634 INFO: Lock owner: mycluster-postgresql-0; I am mycluster-postgresql-1
- 2024-09-28 09:54:15,635 INFO: trying to bootstrap from leader 'mycluster-postgresql-0'
+ 2024-05-17 02:41:23,523 INFO: Lock owner: mycluster-postgresql-0; I am mycluster-postgresql-0
+ 2024-05-17 02:41:23,702 INFO: Leader key released
+ 2024-05-17 02:41:23,904 INFO: released leader key voluntarily as data dir empty and currently leader
+ 2024-05-17 02:41:23,905 INFO: Lock owner: mycluster-postgresql-1; I am mycluster-postgresql-0
+ 2024-05-17 02:41:23,906 INFO: trying to bootstrap from leader 'mycluster-postgresql-1'
```
```bash
# View secondary pod logs
- kubectl logs mycluster-postgresql-0 -n demo
+ kubectl logs mycluster-postgresql-1 -n demo
```
In the logs, the original secondary pod has obtained the lock and become the leader.
```bash
- 2024-09-28 09:54:17,117 INFO: no action. I am (mycluster-postgresql-0), the leader with the lock
- 2024-09-28 09:54:17,516 INFO: no action. I am (mycluster-postgresql-0), the leader with the lock
-
+ 2024-05-17 02:41:35,806 INFO: no action. I am (mycluster-postgresql-1), the leader with the lock
+ 2024-05-17 02:41:45,804 INFO: no action. I am (mycluster-postgresql-1), the leader with the lock
```
4. Connect to the PostgreSQL cluster to view the replication information.
```bash
- kbcli cluster connect mycluster -n demo
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
+ >
+ postgres
+
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ shgkz4z9
+
+ kubectl exec -ti -n demo mycluster-postgresql-1 -- bash
+
+ root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
+ Password: shgkz4z9
```
```bash
postgres=# select * from pg_stat_replication;
```
- ![PostgreSQL replication info](../../../img/pgsql-ha-pg_stat_replication.png)
+ ![PostgreSQL replication info](./../../../img/api-ha-pg-replication-info.png)
- From the output, `mycluster-postgresql-1` has been assigned as the secondary pod.
+ From the output, `mycluster-postgresql-0` has been assigned as the secondary pod.
-5. Describe the cluster and check the instance role.
+5. View the status of the PostgreSQL cluster and pods again.
```bash
- kbcli cluster describe mycluster -n demo
+ kubectl get cluster mycluster -n demo
+
+ kubectl -n demo get pod -L kubeblocks.io/role
```
- ![PostgreSQL cluster status after HA](../../../img/pgsql-ha-after.png)
+ ![PostgreSQL cluster status after HA](./../../../img/api-ha-pg-after.png)
- After the failover, `mycluster-postgresql-1` becomes the secondary pod and `mycluster-postgresql-0` becomes the primary pod.
+ After the failover, `mycluster-postgresql-0` becomes the secondary pod and `mycluster-postgresql-1` becomes the primary pod.
-
+
-1. View the initial status of the PostgreSQL cluster and pods.
+1. View the initial status of the PostgreSQL cluster.
```bash
- kubectl get cluster mycluster -n demo
-
- kubectl -n demo get pod -L kubeblocks.io/role
+ kbcli cluster describe mycluster -n demo
```
- ![PostgreSQL cluster original status](./../../../img/api-ha-pg-original-status.png)
+ ![PostgreSQL cluster original status](../../../img/pgsql-ha-before.png)
- Currently, `mycluster-postgresql-0` is the primary pod and `mycluster-postgresql-1` is the secondary pod.
+ Currently, `mycluster-postgresql-1` is the primary pod and `mycluster-postgresql-0` is the secondary pod.
2. Simulate a primary pod exception.
```bash
# Enter the primary pod
- kubectl exec -it mycluster-postgresql-0 -n demo -- bash
+ kubectl exec -it mycluster-postgresql-1 -n demo -- bash
# Delete the data directory of PostgreSQL to simulate an exception
root@mycluster-postgresql-0:/home/postgres# rm -fr /home/postgres/pgdata/pgroot/data
```
-3. View logs to observe how the roles of pods switch when an exception occurs.
+3. View logs to observe how the roles of pods switch when an exception occurs.
```bash
# View the primary pod logs
- kubectl logs mycluster-postgresql-0 -n demo
+ kubectl logs mycluster-postgresql-1 -n demo
```
In the logs, the leader lock is released from the primary pod and an HA switch occurs.
```bash
- 2024-05-17 02:41:23,523 INFO: Lock owner: mycluster-postgresql-0; I am mycluster-postgresql-0
- 2024-05-17 02:41:23,702 INFO: Leader key released
- 2024-05-17 02:41:23,904 INFO: released leader key voluntarily as data dir empty and currently leader
- 2024-05-17 02:41:23,905 INFO: Lock owner: mycluster-postgresql-1; I am mycluster-postgresql-0
- 2024-05-17 02:41:23,906 INFO: trying to bootstrap from leader 'mycluster-postgresql-1'
+ 2024-09-28 09:54:15,199 INFO: Lock owner: mycluster-postgresql-1; I am mycluster-postgresql-1
+ 2024-09-28 09:54:15,419 INFO: Leader key released
+ 2024-09-28 09:54:15,632 INFO: released leader key voluntarily as data dir empty and currently leader
+ 2024-09-28 09:54:15,634 INFO: Lock owner: mycluster-postgresql-0; I am mycluster-postgresql-1
+ 2024-09-28 09:54:15,635 INFO: trying to bootstrap from leader 'mycluster-postgresql-0'
```
```bash
# View secondary pod logs
- kubectl logs mycluster-postgresql-1 -n demo
+ kubectl logs mycluster-postgresql-0 -n demo
```
In the logs, the original secondary pod has obtained the lock and become the leader.
```bash
- 2024-05-17 02:41:35,806 INFO: no action. I am (mycluster-postgresql-1), the leader with the lock
- 2024-05-17 02:41:45,804 INFO: no action. I am (mycluster-postgresql-1), the leader with the lock
+ 2024-09-28 09:54:17,117 INFO: no action. I am (mycluster-postgresql-0), the leader with the lock
+ 2024-09-28 09:54:17,516 INFO: no action. I am (mycluster-postgresql-0), the leader with the lock
+
```
4. Connect to the PostgreSQL cluster to view the replication information.
```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- postgres
-
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
- >
- shgkz4z9
-
- kubectl exec -ti -n demo mycluster-postgresql-1 -- bash
-
- root@mycluster-postgresql-0:/home/postgres# psql -U postgres -W
- Password: shgkz4z9
+ kbcli cluster connect mycluster -n demo
```
```bash
postgres=# select * from pg_stat_replication;
```
- ![PostgreSQL replication info](./../../../img/api-ha-pg-replication-info.png)
+ ![PostgreSQL replication info](../../../img/pgsql-ha-pg_stat_replication.png)
- From the output, `mycluster-postgresql-0` has been assigned as the secondary pod.
+ From the output, `mycluster-postgresql-1` has been assigned as the secondary pod.
-5. View the status of the PostgreSQL cluster and pods again.
+5. Describe the cluster and check the instance role.
```bash
- kubectl get cluster mycluster -n demo
-
- kubectl -n demo get pod -L kubeblocks.io/role
+ kbcli cluster describe mycluster -n demo
```
- ![PostgreSQL cluster status after HA](./../../../img/api-ha-pg-after.png)
+ ![PostgreSQL cluster status after HA](../../../img/pgsql-ha-after.png)
- After the failover, `mycluster-postgresql-0` becomes the secondary pod and `mycluster-postgresql-1` becomes the primary pod.
+ After the failover, `mycluster-postgresql-1` becomes the secondary pod and `mycluster-postgresql-0` becomes the primary pod.
-
\ No newline at end of file
+
diff --git a/docs/user_docs/kubeblocks-for-postgresql/postgresql-connection-pool/postgresql-connection-pool.md b/docs/user_docs/kubeblocks-for-postgresql/postgresql-connection-pool/postgresql-connection-pool.md
index d7993c5ed1d..9d6d4e7e9f7 100644
--- a/docs/user_docs/kubeblocks-for-postgresql/postgresql-connection-pool/postgresql-connection-pool.md
+++ b/docs/user_docs/kubeblocks-for-postgresql/postgresql-connection-pool/postgresql-connection-pool.md
@@ -19,49 +19,50 @@ When creating a PostgreSQL cluster with KubeBlocks, PgBouncer is installed by de
-
+
1. View the status of the created PostgreSQL cluster and ensure this cluster is `Running`.
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-2. Describe this cluster and there are two connection links in Endpoints.
+2. Describe the services and there are two connection links in Endpoints.
Port `5432` is used to connect to the primary pod of this database and port `6432` is used to connect to PgBouncer.
```bash
- kbcli cluster describe mycluster -n demo
+ kubectl get services mycluster-postgresql -n demo
>
- Endpoints:
- COMPONENT MODE INTERNAL EXTERNAL
- postgresql ReadWrite mycluster-postgresql.default.svc.cluster.local:5432
- mycluster-postgresql.default.svc.cluster.local:6432
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
+ mycluster-postgresql ClusterIP 10.97.123.178 5432/TCP,6432/TCP 39m
```
-3. Connect the cluster with PgBouncer.
-
- This command shows how to connect to a cluster with CLI. The default example uses port `5432` and you can replace it with port `6432`.
+3. Run the command below to get the `username` and `password` for the `kubectl exec` command.
```bash
- kbcli cluster connect --client=cli --show-example mycluster -n demo
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
>
- kubectl port-forward service/mycluster-postgresql 6432:6432
- PGPASSWORD=***** psql -h127.0.0.1 -p 6432 -U postgres postgres
- ```
-
-4. Run `port-forward`.
+ postgres
- ```bash
- kubectl port-forward service/mycluster-postgresql 6432:6432
+ kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ >
+ shgkz4z9
```
+4. Connect the cluster with PgBouncer. The default example uses port `6432` and you can replace it with port `5432`.
+
+ ```bash
+ kubectl -n demo port-forward service/mycluster-postgresql 6432:6432
+ ```
+
5. Open a new terminal window and run the `psql` command to connect to PgBouncer.
- ```bash
- PGPASSWORD=***** psql -h127.0.0.1 -p 6432 -U postgres postgres
- ```
+ Fill the password obtained from step 3 into the `PGPASSWORD`.
+
+ ```bash
+ PGPASSWORD=shgkz4z9 psql -h127.0.0.1 -p 6432 -U postgres postgres
+ ```
6. Run the following command in `psgl` to verify the connection.
@@ -97,50 +98,49 @@ When creating a PostgreSQL cluster with KubeBlocks, PgBouncer is installed by de
-
+
1. View the status of the created PostgreSQL cluster and ensure this cluster is `Running`.
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
-2. Describe the services and there are two connection links in Endpoints.
+2. Describe this cluster and there are two connection links in Endpoints.
Port `5432` is used to connect to the primary pod of this database and port `6432` is used to connect to PgBouncer.
```bash
- kubectl get services mycluster-postgresql -n demo
+ kbcli cluster describe mycluster -n demo
>
- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
- mycluster-postgresql ClusterIP 10.97.123.178 5432/TCP,6432/TCP 39m
+ Endpoints:
+ COMPONENT MODE INTERNAL EXTERNAL
+ postgresql ReadWrite mycluster-postgresql.default.svc.cluster.local:5432
+ mycluster-postgresql.default.svc.cluster.local:6432
```
-3. Run the command below to get the `username` and `password` for the `kubectl exec` command.
+3. Connect the cluster with PgBouncer.
- ```bash
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
- >
- postgres
+ This command shows how to connect to a cluster with CLI. The default example uses port `5432` and you can replace it with port `6432`.
- kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
+ ```bash
+ kbcli cluster connect --client=cli --show-example mycluster -n demo
>
- shgkz4z9
- ```
+ kubectl port-forward service/mycluster-postgresql 6432:6432
+ PGPASSWORD=***** psql -h127.0.0.1 -p 6432 -U postgres postgres
+ ```
-4. Connect the cluster with PgBouncer. The default example uses port `6432` and you can replace it with port `5432`.
+4. Run `port-forward`.
- ```bash
- kubectl -n demo port-forward service/mycluster-postgresql 6432:6432
- ```
+ ```bash
+ kubectl port-forward service/mycluster-postgresql 6432:6432
+ ```
5. Open a new terminal window and run the `psql` command to connect to PgBouncer.
- Fill the password obtained from step 3 into the `PGPASSWORD`.
-
- ```bash
- PGPASSWORD=shgkz4z9 psql -h127.0.0.1 -p 6432 -U postgres postgres
- ```
+ ```bash
+ PGPASSWORD=***** psql -h127.0.0.1 -p 6432 -U postgres postgres
+ ```
6. Run the following command in `psgl` to verify the connection.
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/create-pulsar-cluster-on-kubeblocks.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/create-pulsar-cluster-on-kubeblocks.md
index 268dc31c843..76f26146c26 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/create-pulsar-cluster-on-kubeblocks.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/create-pulsar-cluster-on-kubeblocks.md
@@ -36,16 +36,7 @@ Refer to the [Pulsar official document](https://pulsar.apache.org/docs/3.1.x/) f
-
-
- ```bash
- kbcli clusterdefinition list
- kbcli clusterversion list
- ```
-
-
-
-
+
```bash
kubectl get clusterdefinition pulsar
@@ -66,6 +57,15 @@ Refer to the [Pulsar official document](https://pulsar.apache.org/docs/3.1.x/) f
+
+
+ ```bash
+ kbcli clusterdefinition list
+ kbcli clusterversion list
+ ```
+
+
+
* To keep things isolated, create a separate namespace called `demo`.
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/delete-a-pulsar-cluster.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/delete-a-pulsar-cluster.md
index c4b371280a0..da885db967d 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/delete-a-pulsar-cluster.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/delete-a-pulsar-cluster.md
@@ -30,24 +30,24 @@ To check the termination policy, execute the following command.
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl -n demo get cluster mycluster
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo pulsar pulsar-3.0.2 Delete Running Sep 28,2024 16:47 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster pulsar pulsar-3.0.2 Delete Running 19m
```
-
+
```bash
-kubectl -n demo get cluster mycluster
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster pulsar pulsar-3.0.2 Delete Running 19m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo pulsar pulsar-3.0.2 Delete Running Sep 28,2024 16:47 UTC+0800
```
@@ -60,15 +60,7 @@ Run the command below to delete a specified cluster.
-
-
-```bash
-kbcli cluster delete mycluster -n demo
-```
-
-
-
-
+
```bash
kubectl delete cluster mycluster -n demo
@@ -84,4 +76,12 @@ kubectl delete -n demo cluster mycluster
+
+
+```bash
+kbcli cluster delete mycluster -n demo
+```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/expand-volume.md
index af839c55370..43a1f180739 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/expand-volume.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/expand-volume.md
@@ -18,18 +18,18 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
```
@@ -40,60 +40,7 @@ kubectl get cluster mycluster -n demo
-
-
-1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
-
- :::note
-
- Expand volume for `journal` first. `ledger` volume expansion must be performed after the `journal` volume expansion.
-
- :::
-
- - Expand volume for `journal`.
-
- ```bash
- kbcli cluster volume-expand mycluster --storage=40Gi --components=bookies -t journal -n demo
- ```
-
- - `--components` describes the component name for volume expansion.
- - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
- - `--storage` describes the volume storage size.
-
- - Expand volume for `ledger`.
-
- ```bash
- kbcli cluster volume-expand mycluster --storage=200Gi --components=bookies -t ledgers -n demo
- ```
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-njd9n -n demo
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -160,7 +107,7 @@ kubectl get cluster mycluster -n demo
- ReadWriteOnce
resources:
requests:
- storage: 40Gi # Change the volume storage size.
+ storage: 40Gi # Change the volume storage size
terminationPolicy: Delete
```
@@ -172,4 +119,57 @@ kubectl get cluster mycluster -n demo
+
+
+1. Configure the values of `--components`, `--volume-claim-templates`, and `--storage`, and run the command below to expand the volume.
+
+ :::note
+
+ Expand volume for `journal` first. `ledger` volume expansion must be performed after the `journal` volume expansion.
+
+ :::
+
+ - Expand volume for `journal`.
+
+ ```bash
+ kbcli cluster volume-expand mycluster --storage=40Gi --components=bookies -t journal -n demo
+ ```
+
+ - `--components` describes the component name for volume expansion.
+ - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
+ - `--storage` describes the volume storage size.
+
+ - Expand volume for `ledger`.
+
+ ```bash
+ kbcli cluster volume-expand mycluster --storage=200Gi --components=bookies -t ledgers -n demo
+ ```
+
+2. Validate the volume expansion operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-njd9n -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/restart-a-pulsar-cluster.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/restart-a-pulsar-cluster.md
index e92dedbb310..dc7e6e9ec86 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/restart-a-pulsar-cluster.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/restart-a-pulsar-cluster.md
@@ -23,34 +23,7 @@ The pod role may change after the cluster restarts.
-
-
-1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
-
- ```bash
- kbcli cluster restart mycluster -n demo --components="pulsar" --ttlSecondsAfterSucceed=30
- ```
-
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
-
-2. Validate the restarting.
-
- Run the command below to check the cluster status to check the restarting status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
- mycluster pulsar pulsar-3.0.2 Delete Running 19m
- ```
-
- * STATUS=Updating: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
-
-
-
-
+
1. Restart a cluster.
@@ -87,4 +60,31 @@ The pod role may change after the cluster restarts.
+
+
+1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="pulsar" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+ mycluster pulsar pulsar-3.0.2 Delete Running 19m
+ ```
+
+ * STATUS=Updating: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/scale-for-pulsar.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/scale-for-pulsar.md
index 68d26a50a78..0264b31bd2e 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/scale-for-pulsar.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/scale-for-pulsar.md
@@ -21,18 +21,18 @@ Check whether the cluster status is `Running`. Otherwise, the following operatio
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
```
@@ -43,54 +43,7 @@ kubectl get cluster mycluster -n demo
-
-
-1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
-
- ```bash
- kbcli cluster vscale mycluster --cpu=3 --memory=10Gi --components=broker,bookies -n demo
- ```
-
- - `--components` describes the component name ready for vertical scaling.
- - `--memory` describes the requested and limited size of the component memory.
- - `--cpu` describes the requested and limited size of the component CPU.
-
-2. Validate the vertical scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-njl6s -n demo
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
- - STATUS=updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
- > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
- :::note
-
- Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
-
- :::
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -143,14 +96,18 @@ kubectl get cluster mycluster -n demo
-1. Change the configuration of `spec.components.resources` in the YAML file.
+1. Change the configuration of `spec.componentSpecs.resources` in the YAML file.
- `spec.components.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
+ `spec.componentSpecs.resources` controls the requirement and limit of resources and changing them triggers a vertical scaling.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- ......
+ ```
+
+ Edit the value of `spec.componentSpecs.resources`.
+
+ ```yaml
+ ...
spec:
affinity:
podAntiAffinity: Preferred
@@ -165,7 +122,7 @@ kubectl get cluster mycluster -n demo
disableExporter: true
name: pulsar
replicas: 1
- resources:
+ resources: # Change values of resources
limits:
cpu: "2"
memory: 4Gi
@@ -179,7 +136,7 @@ kubectl get cluster mycluster -n demo
```bash
kubectl describe cluster mycluster -n demo
>
- ......
+ ...
Component Specs:
Component Def Ref: pulsar
Enabled Logs:
@@ -198,6 +155,53 @@ kubectl get cluster mycluster -n demo
+
+
+1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command.
+
+ ```bash
+ kbcli cluster vscale mycluster --cpu=3 --memory=10Gi --components=broker,bookies -n demo
+ ```
+
+ - `--components` describes the component name ready for vertical scaling.
+ - `--memory` describes the requested and limited size of the component memory.
+ - `--cpu` describes the requested and limited size of the component CPU.
+
+2. Validate the vertical scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-njl6s -n demo
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+ - STATUS=updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+ > To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+ :::note
+
+ Vertical scaling does not synchronize parameters related to CPU and memory and it is required to manually call the OpsRequest of configuration to change parameters accordingly. Refer to [Configuration](./../configuration/configuration.md) for instructions.
+
+ :::
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
## Horizontal scaling
@@ -214,18 +218,18 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -236,46 +240,7 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
-
-
-1. Change configuration.
-
- Configure the parameters `--components` and `--replicas`, and run the command.
-
- ```bash
- kbcli cluster hscale pulsar-cluster --replicas=5 --components=broker,bookies
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-9lfvc -n demo
- ```
-
- - View the cluster satus.
-
- Check the cluster STATUS to identify the horizontal scaling status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- ```
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -344,21 +309,22 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
`spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: pulsar
clusterVersionRef: pulsar-3.0.2
componentSpecs:
- name: pulsar
componentDefRef: pulsar-proxy
- replicas: 2 # Change the amount
+ replicas: 2 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -369,6 +335,45 @@ From v0.9.0, besides replicas, KubeBlocks also supports scaling in and out insta
+
+
+1. Change configuration.
+
+ Configure the parameters `--components` and `--replicas`, and run the command.
+
+ ```bash
+ kbcli cluster hscale pulsar-cluster --replicas=5 --components=broker,bookies
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-9lfvc -n demo
+ ```
+
+ - View the cluster status.
+
+ Check the cluster STATUS to identify the horizontal scaling status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ ```
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Handle the snapshot exception
diff --git a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md
index 5a6fcc5f6b2..6a47e502e64 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md
@@ -19,15 +19,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to stop a cluster.
@@ -48,14 +40,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
Configure replicas as 0 to delete pods.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: pulsar
clusterVersionRef: pulsar-3.0.2
@@ -65,7 +57,15 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
componentDefRef: pulsar
disableExporter: true
replicas: 0
- ......
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -76,18 +76,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -100,15 +100,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster start mycluster -n demo
- ```
-
-
-
-
+
Apply an OpsRequest to start a cluster.
@@ -129,14 +121,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
+ ```bash
+ kubectl edit cluster mycluster
+ ```
+
Change replicas back to the original amount to start this cluster again.
```yaml
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: pulsar
clusterVersionRef: pulsar-3.0.2
@@ -146,7 +138,15 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
componentDefRef: pulsar
disableExporter: true
replicas: 1
- ......
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster start mycluster -n demo
```
@@ -157,18 +157,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
diff --git a/docs/user_docs/kubeblocks-for-pulsar/configuration/configuration.md b/docs/user_docs/kubeblocks-for-pulsar/configuration/configuration.md
index 3aded2d2169..4469c689f64 100644
--- a/docs/user_docs/kubeblocks-for-pulsar/configuration/configuration.md
+++ b/docs/user_docs/kubeblocks-for-pulsar/configuration/configuration.md
@@ -28,7 +28,102 @@ There are 3 types of parameters:
-
+
+
+KubeBlocks supports configuring cluster parameters by configuration file.
+
+1. Modify the Pulsar `broker.conf` file, in this case, it is `pulsar-broker-broker-config`.
+
+ ```bash
+ kubectl edit cm pulsar-broker-broker-config -n demo
+ ```
+
+2. Check whether the configuration is done.
+
+ ```bash
+ kubectl get pod -l app.kubernetes.io/name=pulsar-broker -n dmo
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can use switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
+
+KubeBlocks supports configuring cluster parameters with OpsRequest.
+
+1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `lostBookieRecoveryDelay` is configured as `1000`.
+
+ ```bash
+ apiVersion: apps.kubeblocks.io/v1alpha1
+ kind: OpsRequest
+ metadata:
+ name: mycluster-configuring-demo
+ namespace: demo
+ spec:
+ clusterName: mycluster
+ reconfigure:
+ componentName: bookies
+ configurations:
+ - keys:
+ - key: bookkeeper.conf
+ parameters:
+ - key: lostBookieRecoveryDelay
+ value: "1000"
+ name: bookies-config
+ preConditionDeadlineSeconds: 0
+ type: Reconfiguring
+ EOF
+ ```
+
+ | Field | Definition |
+ |--------------------------------------------------------|--------------------------------|
+ | `metadata.name` | It specifies the name of this OpsRequest. |
+ | `metadata.namespace` | It specifies the namespace where this cluster is created. |
+ | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
+ | `spec.reconfigure` | It specifies a component and its configuration updates. |
+ | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
+ | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
+ | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
+ | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
+ | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
+ | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
+ | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
+ | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
+
+2. Apply the configuration opsRequest.
+
+ ```bash
+ kubectl apply -f mycluster-configuring-demo.yaml
+ ```
+
+3. Verify the configuration.
+
+ 1. Check the progress of configuration:
+
+ ```bash
+ kubectl get ops -n demo
+ ```
+
+ 2. Check whether the configuration is done.
+
+ ```bash
+ kubectl get pod -l app.kubernetes.io/name=pulsar -n demo
+ ```
+
+:::note
+
+Just in case you cannot find the configuration file of your cluster, you can use switch to the `kbcli` tab to view the current configuration file of a cluster.
+
+:::
+
+
+
+
## View parameter information
@@ -201,99 +296,4 @@ kbcli cluster diff-config mycluster-reconfiguring-qxw8s mycluster-reconfiguring-
-
-
-KubeBlocks supports configuring cluster parameters by configuration file.
-
-1. Modify the Pulsar `broker.conf` file, in this case, it is `pulsar-broker-broker-config`.
-
- ```bash
- kubectl edit cm pulsar-broker-broker-config -n demo
- ```
-
-2. Check whether the configuration is done.
-
- ```bash
- kubectl get pod -l app.kubernetes.io/name=pulsar-broker -n dmo
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can use switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
-
-
-KubeBlocks supports configuring cluster parameters with OpsRequest.
-
-1. Define an OpsRequest file and configure the parameters in the OpsRequest in a yaml file named `mycluster-configuring-demo.yaml`. In this example, `lostBookieRecoveryDelay` is configured as `1000`.
-
- ```bash
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: OpsRequest
- metadata:
- name: mycluster-configuring-demo
- namespace: demo
- spec:
- clusterName: mycluster
- reconfigure:
- componentName: bookies
- configurations:
- - keys:
- - key: bookkeeper.conf
- parameters:
- - key: lostBookieRecoveryDelay
- value: "1000"
- name: bookies-config
- preConditionDeadlineSeconds: 0
- type: Reconfiguring
- EOF
- ```
-
- | Field | Definition |
- |--------------------------------------------------------|--------------------------------|
- | `metadata.name` | It specifies the name of this OpsRequest. |
- | `metadata.namespace` | It specifies the namespace where this cluster is created. |
- | `spec.clusterName` | It specifies the cluster name that this operation is targeted at. |
- | `spec.reconfigure` | It specifies a component and its configuration updates. |
- | `spec.reconfigure.componentName` | It specifies the component name of this cluster. |
- | `spec.configurations` | It contains a list of ConfigurationItem objects, specifying the component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. |
- | `spec.reconfigure.configurations.keys.key` | It specifies the configuration map. |
- | `spec.reconfigure.configurations.keys.parameters` | It defines a list of key-value pairs for a single configuration file. |
- | `spec.reconfigure.configurations.keys.parameter.key` | It represents the name of the parameter you want to edit. |
- | `spec.reconfigure.configurations.keys.parameter.value` | It represents the parameter values that are to be updated. If set to nil, the parameter defined by the Key field will be removed from the configuration file. |
- | `spec.reconfigure.configurations.name` | It specifies the configuration template name. |
- | `preConditionDeadlineSeconds` | It specifies the maximum number of seconds this OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. |
-
-2. Apply the configuration opsRequest.
-
- ```bash
- kubectl apply -f mycluster-configuring-demo.yaml
- ```
-
-3. Verify the configuration.
-
- 1. Check the progress of configuration:
-
- ```bash
- kubectl get ops -n demo
- ```
-
- 2. Check whether the configuration is done.
-
- ```bash
- kubectl get pod -l app.kubernetes.io/name=pulsar -n demo
- ```
-
-:::note
-
-Just in case you cannot find the configuration file of your cluster, you can use switch to the `kbcli` tab to view the current configuration file of a cluster.
-
-:::
-
-
-
diff --git a/docs/user_docs/kubeblocks-for-qdrant/manage-qdrant.md b/docs/user_docs/kubeblocks-for-qdrant/manage-qdrant.md
index 9fe611c714c..e93cf00e031 100644
--- a/docs/user_docs/kubeblocks-for-qdrant/manage-qdrant.md
+++ b/docs/user_docs/kubeblocks-for-qdrant/manage-qdrant.md
@@ -32,69 +32,7 @@ KubeBlocks supports the management of Qdrant. This tutorial illustrates how to c
-
-
-1. Execute the following command to create a Qdrant cluster.
-
- ```bash
- kbcli cluster create qdrant mycluster -n demo
- ```
-
- If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
- ```bash
- kbcli cluster create qdrant --help
-
- kbcli cluster create qdrant -h
- ```
-
-2. Check whether the cluster is created.
-
- ```bash
- kbcli cluster list -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
- ```
-
-3. Check the cluster information.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- >
- Name: mycluster Created Time: Aug 15,2023 23:03 UTC+0800
- NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY
- demo qdrant Running Delete
-
- Endpoints:
- COMPONENT MODE INTERNAL EXTERNAL
- qdrant ReadWrite mycluster-qdrant-qdrant.default.svc.cluster.local:6333
- mycluster-qdrant-qdrant.default.svc.cluster.local:6334
-
- Topology:
- COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME
- qdrant mycluster-qdrant-0 Running x-worker3/172.20.0.3 Aug 15,2023 23:03 UTC+0800
- qdrant mycluster-qdrant-1 Running x-worker2/172.20.0.5 Aug 15,2023 23:03 UTC+0800
- qdrant mycluster-qdrant-2 Running x-worker/172.20.0.2 Aug 15,2023 23:04 UTC+0800
-
- Resources Allocation:
- COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
- qdrant false 1 / 1 1Gi / 1Gi data:20Gi standard
-
- Images:
- COMPONENT TYPE IMAGE
- qdrant qdrant docker.io/qdrant/qdrant:latest
-
- Data Protection:
- AUTO-BACKUP BACKUP-SCHEDULE TYPE BACKUP-TTL LAST-SCHEDULE RECOVERABLE-TIME
- Disabled 7d
-
- Show cluster events: kbcli cluster list-events -n demo mycluster
- ```
-
-
-
-
+
KubeBlocks implements a `Cluster` CRD to define a cluster. Here is an example of creating a Qdrant Replication cluster. Primary and Secondary are distributed on different nodes by default. But if you only have one node for deploying a Replication Cluster, set `spec.affinity.topologyKeys` as `null`.
@@ -172,29 +110,77 @@ kubectl get cluster mycluster -n demo -o yaml
-
+
-## Connect to a Qdrant cluster
+1. Execute the following command to create a Qdrant cluster.
-Qdrant provides both HTTP and gRPC protocols for client access on ports 6333 and 6334 respectively. Depending on where the client is, different connection options are offered to connect to the Qdrant cluster.
+ ```bash
+ kbcli cluster create qdrant mycluster -n demo
+ ```
-
+ If you want to customize your cluster specifications, kbcli provides various options, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding `--help` or `-h` flag.
-
+ ```bash
+ kbcli cluster create qdrant --help
-:::note
+ kbcli cluster create qdrant -h
+ ```
-If your cluster is on AWS, install the AWS Load Balancer Controller first.
+2. Check whether the cluster is created.
-:::
+ ```bash
+ kbcli cluster list -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
+ ```
-- If your client is inside a K8s cluster, run `kbcli cluster describe mycluster -n demo` to get the ClusterIP address of the cluster or the corresponding K8s cluster domain name.
-- If your client is outside the K8s cluster but in the same VPC as the server, run `kbcli cluster expose mycluster -n demo --enable=true --type=vpc` to get a VPC load balancer address for the database cluster.
-- If your client is outside the VPC, run `kbcli cluster expose mycluster -n demo --enable=true --type=internet` to open a public network reachable address for the database cluster.
+3. Check the cluster information.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ >
+ Name: mycluster Created Time: Aug 15,2023 23:03 UTC+0800
+ NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY
+ demo qdrant Running Delete
+
+ Endpoints:
+ COMPONENT MODE INTERNAL EXTERNAL
+ qdrant ReadWrite mycluster-qdrant-qdrant.default.svc.cluster.local:6333
+ mycluster-qdrant-qdrant.default.svc.cluster.local:6334
+
+ Topology:
+ COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME
+ qdrant mycluster-qdrant-0 Running x-worker3/172.20.0.3 Aug 15,2023 23:03 UTC+0800
+ qdrant mycluster-qdrant-1 Running x-worker2/172.20.0.5 Aug 15,2023 23:03 UTC+0800
+ qdrant mycluster-qdrant-2 Running x-worker/172.20.0.2 Aug 15,2023 23:04 UTC+0800
+
+ Resources Allocation:
+ COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
+ qdrant false 1 / 1 1Gi / 1Gi data:20Gi standard
+
+ Images:
+ COMPONENT TYPE IMAGE
+ qdrant qdrant docker.io/qdrant/qdrant:latest
+
+ Data Protection:
+ AUTO-BACKUP BACKUP-SCHEDULE TYPE BACKUP-TTL LAST-SCHEDULE RECOVERABLE-TIME
+ Disabled 7d
+
+ Show cluster events: kbcli cluster list-events -n demo mycluster
+ ```
-
+
+
+## Connect to a Qdrant cluster
+
+Qdrant provides both HTTP and gRPC protocols for client access on ports 6333 and 6334 respectively. Depending on where the client is, different connection options are offered to connect to the Qdrant cluster.
+
+
+
+
1. Run the following command to port forward the service.
@@ -212,6 +198,20 @@ If your cluster is on AWS, install the AWS Load Balancer Controller first.
+
+
+:::note
+
+If your cluster is on AWS, install the AWS Load Balancer Controller first.
+
+:::
+
+- If your client is inside a K8s cluster, run `kbcli cluster describe mycluster -n demo` to get the ClusterIP address of the cluster or the corresponding K8s cluster domain name.
+- If your client is outside the K8s cluster but in the same VPC as the server, run `kbcli cluster expose mycluster -n demo --enable=true --type=vpc` to get a VPC load balancer address for the database cluster.
+- If your client is outside the VPC, run `kbcli cluster expose mycluster -n demo --enable=true --type=internet` to open a public network reachable address for the database cluster.
+
+
+
## Monitor the database
@@ -234,24 +234,24 @@ Check whether the cluster status is Running. Otherwise, the following operations
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster qdrant Delete Running 47m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster qdrant Delete Running 47m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
```
@@ -262,50 +262,7 @@ mycluster qdrant Delete Running
-
-
-1. Set the `--replicas` value according to your needs and perform the horizontal scaling.
-
- ```bash
- kbcli cluster hscale mycluster -n demo --replicas=5 --components=qdrant
- ```
-
- - `--components` describes the component name ready for horizontal scaling.
- - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
-
- Please wait a few seconds until the scaling process is over.
-
-2. Validate the horizontal scaling operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-horizontalscaling-xpdwz -n demo
- ```
-
- - View the cluster satus.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo qdrant Delete Running Jul 24,2023 11:38 UTC+0800
- ```
-
- - STATUS=Updating: it means horizontal scaling is in progress.
- - STATUS=Running: it means horizontal scaling has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs.
@@ -372,21 +329,22 @@ mycluster qdrant Delete Running
1. Change the configuration of `spec.componentSpecs.replicas` in the YAML file. `spec.componentSpecs.replicas` stands for the pod amount and changing this value triggers a horizontal scaling of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.replicas`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: qdrant
clusterVersionRef: qdrant-1.8.1
componentSpecs:
- name: qdrant
componentDefRef: qdrant
- replicas: 2 # Change the amount
- ......
+ replicas: 2 # Change this value
+ ...
```
2. Check whether the corresponding resources change.
@@ -397,6 +355,49 @@ mycluster qdrant Delete Running
+
+
+1. Set the `--replicas` value according to your needs and perform the horizontal scaling.
+
+ ```bash
+ kbcli cluster hscale mycluster -n demo --replicas=5 --components=qdrant
+ ```
+
+ - `--components` describes the component name ready for horizontal scaling.
+ - `--replicas` describes the replica amount of the specified components. Edit the amount based on your demands to scale in or out replicas.
+
+ Please wait a few seconds until the scaling process is over.
+
+2. Validate the horizontal scaling operation.
+
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-horizontalscaling-xpdwz -n demo
+ ```
+
+ - View the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo qdrant Delete Running Jul 24,2023 11:38 UTC+0800
+ ```
+
+ - STATUS=Updating: it means horizontal scaling is in progress.
+ - STATUS=Running: it means horizontal scaling has been applied.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
+
+
+
### Scale vertically
@@ -409,24 +410,24 @@ Check whether the cluster status is Running. Otherwise, the following operations
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster qdrant Delete Running 47m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster qdrant Delete Running 47m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
```
@@ -436,52 +437,8 @@ mycluster qdrant Delete Running
#### Steps
-
-
-
-1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
-
- ```bash
- kbcli cluster vscale mycluster -n demo --cpu=0.5 --memory=512Mi --components=qdrant
- ```
-
- Please wait a few seconds until the scaling process is over.
-
-2. Validate the vertical scaling operation.
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
- >
- NAME TYPE CLUSTER STATUS PROGRESS AGE
- mycluster-verticalscaling-rpw2l VerticalScaling mycluster Running 1/5 44s
- ```
-
- - Check the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo Delete Updating Aug 15,2023 23:03 UTC+0800
- ```
-
- - STATUS=Updating: it means the vertical scaling is in progress.
- - STATUS=Running: it means the vertical scaling operation has been applied.
- - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
- >To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
+
1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.
@@ -560,10 +517,54 @@ mycluster qdrant Delete Running
terminationPolicy: Delete
```
-2. Check whether the corresponding resources change.
+2. Check whether the corresponding resources change.
+
+ ```bash
+ kubectl describe cluster mycluster -n demo
+ ```
+
+
+
+
+
+1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling.
+
+ ```bash
+ kbcli cluster vscale mycluster -n demo --cpu=0.5 --memory=512Mi --components=qdrant
+ ```
+
+ Please wait a few seconds until the scaling process is over.
+
+2. Validate the vertical scaling operation.
+ - View the OpsRequest progress.
+
+ KubeBlocks outputs a command automatically for you to view the OpsRequest progress. The output includes the status of this OpsRequest and Pods. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-verticalscaling-rpw2l -n demo
+ >
+ NAME TYPE CLUSTER STATUS PROGRESS AGE
+ mycluster-verticalscaling-rpw2l VerticalScaling mycluster Running 1/5 44s
+ ```
+
+ - Check the cluster status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo Delete Updating Aug 15,2023 23:03 UTC+0800
+ ```
+
+ - STATUS=Updating: it means the vertical scaling is in progress.
+ - STATUS=Running: it means the vertical scaling operation has been applied.
+ - STATUS=Abnormal: it means the vertical scaling is abnormal. The reason may be that the number of the normal instances is less than that of the total instance or the leader instance is running properly while others are abnormal.
+ >To solve the problem, you can manually check whether this error is caused by insufficient resources. Then if AutoScaling is supported by the Kubernetes cluster, the system recovers when there are enough resources. Otherwise, you can create enough resources and troubleshoot with `kubectl describe` command.
+
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
```bash
- kubectl describe cluster mycluster -n demo
+ kbcli cluster describe mycluster -n demo
```
@@ -578,24 +579,24 @@ Check whether the cluster status is Running. Otherwise, the following operations
-
+
```bash
-kbcli cluster list mycluster -n demo
+kubectl get cluster mycluster -n demo
>
-NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
-mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
+NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
+mycluster qdrant Delete Running 47m
```
-
+
```bash
-kubectl get cluster mycluster -n demo
+kbcli cluster list mycluster -n demo
>
-NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
-mycluster qdrant Delete Running 47m
+NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
```
@@ -606,50 +607,7 @@ mycluster qdrant Delete Running
-
-
-1. Set the `--storage` value according to your need and run the command to expand the volume.
-
- ```bash
- kbcli cluster volume-expand mycluster -n demo --storage=40Gi --components=qdrant -t data
- ```
-
- The volume expansion may take a few minutes.
-
-2. Validate the volume expansion operation.
-
- - View the OpsRequest progress.
-
- KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
-
- ```bash
- kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
- >
- NAME TYPE CLUSTER STATUS PROGRESS AGE
- mycluster-volumeexpansion-5pbd2 VolumeExpansion mycluster Running 1/1 67s
- ```
-
- - View the cluster status.
-
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo qdrant Delete Updating Aug 15,2023 23:03 UTC+0800
- ```
-
- * STATUS=Updating: it means the volume expansion is in progress.
- * STATUS=Running: it means the volume expansion operation has been applied.
-
-3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
-
- ```bash
- kbcli cluster describe mycluster -n demo
- ```
-
-
-
-
+
1. Change the value of storage according to your need and run the command below to expand the volume of a cluster.
@@ -696,13 +654,14 @@ mycluster qdrant Delete Running
`spec.componentSpecs.volumeClaimTemplates.spec.resources` is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.
- ```yaml
+ ```bash
kubectl edit cluster mycluster -n demo
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ```
+
+ Edit the value of `spec.componentSpecs.volumeClaimTemplates.spec.resources`.
+
+ ```yaml
+ ...
spec:
clusterDefinitionRef: qdrant
clusterVersionRef: qdrant-1.8.1
@@ -717,8 +676,8 @@ mycluster qdrant Delete Running
- ReadWriteOnce
resources:
requests:
- storage: 1Gi # Change the volume storage size.
- terminationPolicy: Delete
+ storage: 1Gi # Change the volume storage size
+ ...
```
2. Check whether the corresponding cluster resources change.
@@ -729,40 +688,56 @@ mycluster qdrant Delete Running
-
+
-## Restart
+1. Set the `--storage` value according to your need and run the command to expand the volume.
-
+ ```bash
+ kbcli cluster volume-expand mycluster -n demo --storage=40Gi --components=qdrant -t data
+ ```
-
+ The volume expansion may take a few minutes.
-1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+2. Validate the volume expansion operation.
- ```bash
- kbcli cluster restart mycluster -n demo --components="qdrant" --ttlSecondsAfterSucceed=30
- ```
+ - View the OpsRequest progress.
- - `components` describes the component name that needs to be restarted.
- - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+ KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is `Succeed`, this OpsRequest is completed.
+
+ ```bash
+ kbcli cluster describe-ops mycluster-volumeexpansion-5pbd2 -n demo
+ >
+ NAME TYPE CLUSTER STATUS PROGRESS AGE
+ mycluster-volumeexpansion-5pbd2 VolumeExpansion mycluster Running 1/1 67s
+ ```
-2. Validate the restarting.
+ - View the cluster status.
- Run the command below to check the cluster status to check the restarting status.
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo qdrant Delete Updating Aug 15,2023 23:03 UTC+0800
+ ```
- ```bash
- kbcli cluster list mycluster -n demo
- >
- NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
- mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
- ```
+ * STATUS=Updating: it means the volume expansion is in progress.
+ * STATUS=Running: it means the volume expansion operation has been applied.
- * STATUS=Updating: it means the cluster restart is in progress.
- * STATUS=Running: it means the cluster has been restarted.
+3. After the OpsRequest status is `Succeed` or the cluster status is `Running` again, check whether the corresponding resources change.
+
+ ```bash
+ kbcli cluster describe mycluster -n demo
+ ```
-
+
+
+## Restart
+
+
+
+
1. Restart a cluster.
@@ -795,6 +770,33 @@ mycluster qdrant Delete Running
+
+
+1. Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
+
+ ```bash
+ kbcli cluster restart mycluster -n demo --components="qdrant" --ttlSecondsAfterSucceed=30
+ ```
+
+ - `components` describes the component name that needs to be restarted.
+ - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
+
+2. Validate the restarting.
+
+ Run the command below to check the cluster status to check the restarting status.
+
+ ```bash
+ kbcli cluster list mycluster -n demo
+ >
+ NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
+ mycluster demo qdrant Delete Running Aug 15,2023 23:03 UTC+0800
+ ```
+
+ * STATUS=Updating: it means the cluster restart is in progress.
+ * STATUS=Running: it means the cluster has been restarted.
+
+
+
## Stop/Start a cluster
@@ -807,15 +809,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
-
- ```bash
- kbcli cluster stop mycluster -n demo
- ```
-
-
-
-
+
Configure replicas as 0 to delete pods.
@@ -836,16 +830,14 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- Edit the cluster YAML file and configure replicas as 0 to delete pods.
+ ```bash
+ kubectl edit cluster mycluster -n demo
+ ```
+
+ Configure the value of `spec.ComponentSpecs.replicas` as 0 to delete pods.
```yaml
- kubectl edit cluster mycluster -n demo
- >
- apiVersion: apps.kubeblocks.io/v1alpha1
- kind: Cluster
- metadata:
- name: mycluster
- namespace: demo
+ ...
spec:
clusterDefinitionRef: qdrant
clusterVersionRef: qdrant-1.8.1
@@ -854,8 +846,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
- name: qdrant
componentDefRef: qdrant
disableExporter: true
- replicas: 0
- ......
+ replicas: 0 # Change this value
+ ...
+ ```
+
+
+
+
+
+ ```bash
+ kbcli cluster stop mycluster -n demo
```
@@ -866,18 +866,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-
+
```bash
- kbcli cluster list mycluster -n demo
+ kubectl get cluster mycluster -n demo
```
-
+
```bash
- kubectl get cluster mycluster -n demo
+ kbcli cluster list mycluster -n demo
```
@@ -890,15 +890,7 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
-