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 - - - ```bash - kbcli cluster start mycluster -n demo - ``` - - - - + Run the command below to start a cluster. @@ -919,16 +911,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 - 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 @@ -937,8 +927,16 @@ You can stop/start a cluster to save computing resources. When a cluster is stop - name: qdrant componentDefRef: qdrant disableExporter: true - replicas: 1 - ...... + replicas: 1 # Change this value + ... + ``` + + + + + + ```bash + kbcli cluster start mycluster -n demo ``` @@ -949,18 +947,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 ``` @@ -988,24 +986,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 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 ``` @@ -1018,22 +1016,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-rabbitmq/manage-rabbitmq.md b/docs/user_docs/kubeblocks-for-rabbitmq/manage-rabbitmq.md index 4048559912f..164abcaffb7 100644 --- a/docs/user_docs/kubeblocks-for-rabbitmq/manage-rabbitmq.md +++ b/docs/user_docs/kubeblocks-for-rabbitmq/manage-rabbitmq.md @@ -274,25 +274,18 @@ mycluster Delete Running ```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: rabbitmq componentDefRef: rabbitmq - replicas: 1 # Change the amount - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - terminationPolicy: Delete + replicas: 1 # Change this value + ... ``` 2. Check whether the corresponding resources change. @@ -367,11 +360,12 @@ mycluster Delete Running ```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: componentSpecs: - name: rabbitmq @@ -384,8 +378,8 @@ mycluster Delete Running - 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. @@ -465,6 +459,12 @@ kubect edit cluster mycluster -n demo Configure `replicas` as 0 to delete pods. +```bash +kubectl edit cluster mycluster -n demo +``` + +Edit the value of `replicas`. + ```yaml ... spec: @@ -516,6 +516,12 @@ kubectl edit cluster mycluster -n demo Change replicas back to the original amount to start this cluster again. +```bash +kubectl edit cluster mycluster -n demo +``` + +Edit the value of `replicas`. + ```yaml ... spec: diff --git a/docs/user_docs/kubeblocks-for-redis/cluster-management/create-and-connect-a-redis-cluster.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/create-and-connect-a-redis-cluster.md index 37ba5704f05..0f9e5d99326 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/create-and-connect-a-redis-cluster.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/create-and-connect-a-redis-cluster.md @@ -23,26 +23,26 @@ This tutorial shows how to create and connect to a Redis cluster. - + ```bash - kbcli addon list + kubectl get addons.extensions.kubeblocks.io redis > - NAME TYPE STATUS EXTRAS AUTO-INSTALL - ... - redis Helm Enabled true - ... + NAME TYPE VERSION PROVIDER STATUS AGE + redis Helm Enabled 61m ``` - + ```bash - kubectl get addons.extensions.kubeblocks.io redis + kbcli addon list > - NAME TYPE VERSION PROVIDER STATUS AGE - redis Helm Enabled 61m + NAME TYPE STATUS EXTRAS AUTO-INSTALL + ... + redis Helm Enabled true + ... ``` @@ -53,24 +53,7 @@ This tutorial shows how to create and connect to a Redis cluster. - - - ```bash - kbcli clusterdefinition list - > - NAME TOPOLOGIES SERVICEREFS STATUS AGE - redis replication,replication-twemproxy,standalone Available 16m - - kbcli clusterversion list - > - NAME CLUSTER-DEFINITION STATUS IS-DEFAULT CREATED-TIME - redis-7.0.6 redis Available false Sep 27,2024 11:36 UTC+0800 - redis-7.2.4 redis Available false Sep 27,2024 11:36 UTC+0800 - ``` - - - - + ```bash kubectl get clusterdefinition redis @@ -89,6 +72,23 @@ This tutorial shows how to create and connect to a Redis cluster. + + + ```bash + kbcli clusterdefinition list + > + NAME TOPOLOGIES SERVICEREFS STATUS AGE + redis replication,replication-twemproxy,standalone Available 16m + + kbcli clusterversion list + > + NAME CLUSTER-DEFINITION STATUS IS-DEFAULT CREATED-TIME + redis-7.0.6 redis Available false Sep 27,2024 11:36 UTC+0800 + redis-7.2.4 redis Available false Sep 27,2024 11:36 UTC+0800 + ``` + + + * To keep things isolated, create a separate namespace called `demo` throughout this tutorial. @@ -105,34 +105,7 @@ KubeBlocks supports creating two types of Redis clusters: Standalone and Replica - - -1. Create an Redis cluster. - - ```bash - kbcli cluster create redis 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 redis --help - - kbcli cluster create redis -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 redis Delete Running Sep 29,2024 09:46 UTC+0800 - ``` - - - - + KubeBlocks implements a `Cluster` CRD to define a cluster. Here is an example of creating a Standalone. @@ -206,21 +179,40 @@ kubectl get cluster mycluster -n demo -o yaml - + -## Connect to a Redis Cluster +1. Create an Redis cluster. - + ```bash + kbcli cluster create redis 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 connect mycluster -n demo -``` + ```bash + kbcli cluster create redis --help + + kbcli cluster create redis -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 redis Delete Running Sep 29,2024 09:46 UTC+0800 + ``` - + + +## Connect to a Redis Cluster + + + + You can use `kubectl exec` to exec into a Pod and connect to a database. @@ -272,6 +264,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](./../../connect_database/overview-of-database-connection.md). diff --git a/docs/user_docs/kubeblocks-for-redis/cluster-management/delete-a-redis-cluster.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/delete-a-redis-cluster.md index d767dd584d0..d0399175405 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/delete-a-redis-cluster.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/delete-a-redis-cluster.md @@ -30,23 +30,23 @@ To check the termination policy, execute the following command. - + ```bash -kbcli cluster list mycluster -n demo -NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME -mycluster demo redis Delete Running Apr 10,2023 20:27 UTC+0800 +kubectl -n demo get cluster mycluster +> +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster redis Delete Running 10m ``` - + ```bash -kubectl -n demo get cluster mycluster -> -NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE -mycluster redis Delete Running 10m +kbcli cluster list mycluster -n demo +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo redis Delete Running Apr 10,2023 20:27 UTC+0800 ``` @@ -59,15 +59,7 @@ Run the command below to delete a specified cluster. - - -```bash -kbcli cluster delete mycluster -n demo -``` - - - - + ```bash kubectl delete cluster mycluster -n demo @@ -83,4 +75,12 @@ kubectl delete -n demo cluster mycluster + + +```bash +kbcli cluster delete mycluster -n demo +``` + + + diff --git a/docs/user_docs/kubeblocks-for-redis/cluster-management/expand-volume.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/expand-volume.md index 1afedf86369..fef6e8b966a 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/expand-volume.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/expand-volume.md @@ -25,24 +25,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 redis Delete Running Sep 29,2024 09:46 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster redis 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 redis Delete Running 19m +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo redis Delete Running Sep 29,2024 09:46 UTC+0800 ``` @@ -53,51 +53,7 @@ mycluster redis 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 -n demo --components="redis" --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. - - - 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-ih2r4 -n demo - ``` - - - View the cluster status. - - ```bash - kbcli cluster list mycluster -n demo - > - NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME - redis-cluster redis Delete Updating Sep 29,2024 09: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. @@ -133,7 +89,7 @@ mycluster redis Delete Running ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -152,7 +108,14 @@ mycluster redis 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.requests.storage`. + ```yaml + ... spec: affinity: podAntiAffinity: Preferred @@ -181,15 +144,20 @@ mycluster redis Delete Running - ReadWriteOnce resources: requests: - storage: 40Gi # Change the volume storage size. + storage: 40Gi # Change the volume storage size + ... ``` 2. Check whether the corresponding cluster resources change. ```bash kubectl describe cluster mycluster -n demo - > - ...... + ``` + + View the value of `spec.componentSpecs.volumeClaimTemplates.spec.resources.requests.storage`. + + ```yaml + ... Volume Claim Templates: Name: data Spec: @@ -202,4 +170,48 @@ mycluster redis 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 -n demo --components="redis" --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. + + - 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-ih2r4 -n demo + ``` + + - View the cluster status. + + ```bash + kbcli cluster list mycluster -n demo + > + NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME + redis-cluster redis Delete Updating Sep 29,2024 09: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-redis/cluster-management/restart-a-redis-cluster.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/restart-a-redis-cluster.md index 3ec2a6c7cad..2ee64703ad5 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/restart-a-redis-cluster.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/restart-a-redis-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 --components="redis" --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 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 - mycluster demo redis Delete Running Sep 29,2024 09:46 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. @@ -92,4 +63,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 --components="redis" --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 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 + mycluster demo redis Delete Running Sep 29,2024 09:46 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-redis/cluster-management/scale-for-a-redis-cluster.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md index ea51cca623e..d8ec6923d0d 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md @@ -23,24 +23,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 redis Delete Running Sep 29,2024 09:46 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster redis 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 redis Delete Running 19m +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo redis Delete Running Sep 29,2024 09:46 UTC+0800 ``` @@ -51,57 +51,7 @@ mycluster redis Delete Running - - -1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command. - - ```bash - kbcli cluster vscale mycluster --components="redis" --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 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-enbr9 -n demo - ``` - - - Check the cluster status. - - ```bash - kbcli cluster list mycluster - > - NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME - mycluster demo redis Delete Running Sep 29,2024 09:46 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. 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. @@ -151,36 +101,28 @@ mycluster redis Delete Running `spec.componentSpecs.resources` controls the requests and limits 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 values of `spec.componentSpecs.resources`. + + ```yaml + ... spec: clusterDefinitionRef: redis componentSpecs: - name: redis componentDef: redis replicas: 1 - resources: # Change values of resources. + resources: # Change values of resources requests: memory: "2Gi" cpu: "1" limits: memory: "4Gi" cpu: "2" - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. Check whether the corresponding resources change. @@ -191,6 +133,56 @@ mycluster redis Delete Running + + +1. Configure the parameters `--components`, `--memory`, and `--cpu` and run the command. + + ```bash + kbcli cluster vscale mycluster --components="redis" --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 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-enbr9 -n demo + ``` + + - Check the cluster status. + + ```bash + kbcli cluster list mycluster + > + NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME + mycluster demo redis Delete Running Sep 29,2024 09:46 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. 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 -n demo get cluster mycluster > -NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME -mycluster demo redis Delete Running Sep 29,2024 09:46 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster redis 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 redis Delete Running 19m +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo redis Delete Running Sep 29,2024 09:46 UTC+0800 ``` @@ -233,48 +225,7 @@ mycluster redis Delete Running - - -1. Configure the parameters `--components` and `--replicas`, and run the command. - - ```bash - kbcli cluster hscale mycluster --components="redis" --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-we2r3 -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 redis Delete Running Sep 29,2024 09:46 UTC+0800 - ``` - - - 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 the specified cluster. Configure the parameters according to your needs. @@ -341,29 +292,21 @@ mycluster redis Delete Running 1. Change the value 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: redis componentSpecs: - name: redis componentDef: redis - replicas: 2 # Change the pod amount. - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + replicas: 2 # Change this value + ... ``` 2. Check whether the corresponding resources change. @@ -374,6 +317,47 @@ mycluster redis Delete Running + + +1. Configure the parameters `--components` and `--replicas`, and run the command. + + ```bash + kbcli cluster hscale mycluster --components="redis" --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-we2r3 -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 redis Delete Running Sep 29,2024 09:46 UTC+0800 + ``` + + - 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-redis/cluster-management/stop-start-a-redis-cluster.md b/docs/user_docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md index f941db16667..bf8d1dec2b3 100644 --- a/docs/user_docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md +++ b/docs/user_docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-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 - ``` - - - - + Run the command below to stop a cluster. @@ -48,11 +40,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 values of `replicas` as 0 to delete pods. ```yaml - kubectl edit cluster mycluster -n demo - > + ... spec: affinity: podAntiAffinity: Preferred @@ -65,12 +60,20 @@ You can stop/start a cluster to save computing resources. When a cluster is stop - running disableExporter: true name: redis - replicas: 0 - ...... + replicas: 0 # Change this value + ... - componentDef: redis-sentinel-7 name: redis-sentinel - replicas: 0 - ...... + replicas: 0 # Change this value + ... + ``` + + + + + + ```bash + kbcli cluster stop mycluster -n demo ``` @@ -81,18 +84,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 ``` @@ -105,15 +108,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. @@ -134,11 +129,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 values of `replicas` back to the original amount to start this cluster again. ```yaml - kubectl edit cluster mycluster -n demo - > + ... spec: affinity: podAntiAffinity: Preferred @@ -151,12 +149,20 @@ You can stop/start a cluster to save computing resources. When a cluster is stop - running disableExporter: true name: redis - replicas: 3 - ...... + replicas: 3 # Change this value + ... - componentDef: redis-sentinel-7 name: redis-sentinel - replicas: 3 - ...... + replicas: 3 # Change this value + ... + ``` + + + + + + ```bash + kbcli cluster start mycluster -n demo ``` @@ -166,18 +172,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-redis/configuration/configuration.md b/docs/user_docs/kubeblocks-for-redis/configuration/configuration.md index 317acf51b9f..3041a1e0bfb 100644 --- a/docs/user_docs/kubeblocks-for-redis/configuration/configuration.md +++ b/docs/user_docs/kubeblocks-for-redis/configuration/configuration.md @@ -16,7 +16,151 @@ From v0.6.0, KubeBlocks supports `kbcli cluster configure` and `kbcli cluster ed - + + +1. Get the configuration file of this cluster. + + ```bash + kubectl edit configurations.apps.kubeblocks.io mycluster-redis -n demo + ``` + +2. Configure parameters according to your needs. The example below adds the `- configFileParams` part to configure `acllog-max-len`. + + ```yaml + spec: + clusterRef: mycluster + componentName: redis + configItemDetails: + - configSpec: + constraintRef: redis7-config-constraints + name: redis-replication-config + namespace: demo + reRenderResourceTypes: + - vscale + templateRef: redis7-config-template + volumeName: redis-config + - configFileParams: + redis.conf: + parameters: + acllog-max-len: "256" + name: mycluster-redis-redis-replication-config + ``` + +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 + > + default + + kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d + > + kpz77mcs + ``` + + 2. Connect to this cluster and verify whether the parameters are configured as expected. + + ```bash + kubectl exec -ti -n demo mycluster-redis-0 -- bash + + root@mycluster-redis-0:/# redis-cli -a kpz77mcs --user default + + 127.0.0.1:6379> config get parameter acllog-max-len + 1) "acllog-max-len" + 2) "256" + ``` + +:::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, `acllog-max-len` is configured as `256`. + + ```yaml + apiVersion: apps.kubeblocks.io/v1alpha1 + kind: OpsRequest + metadata: + name: mycluster-configuring-demo + namespace: demo + spec: + clusterName: mycluster + reconfigure: + componentName: redis + configurations: + - keys: + - key: redis.conf + parameters: + - key: acllog-max-len + value: "256" + name: redis-replication-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. + + 1. Get the username and password. + + ```bash + kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d + > + default + + kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d + > + kpz77mcs + ``` + + 2. Connect to this cluster and verify whether the parameters are configured as expected. + + ```bash + kubectl exec -ti -n demo mycluster-redis-0 -- bash + + root@mycluster-redis-0:/# redis-cli -a kpz77mcs --user default + + 127.0.0.1:6379> config get parameter acllog-max-len + 1) "acllog-max-len" + 2) "256" + ``` + +:::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 @@ -245,148 +389,4 @@ maxclients 20000 40000 - - -1. Get the configuration file of this cluster. - - ```bash - kubectl edit configurations.apps.kubeblocks.io mycluster-redis -n demo - ``` - -2. Configure parameters according to your needs. The example below adds the `- configFileParams` part to configure `acllog-max-len`. - - ```yaml - spec: - clusterRef: mycluster - componentName: redis - configItemDetails: - - configSpec: - constraintRef: redis7-config-constraints - name: redis-replication-config - namespace: demo - reRenderResourceTypes: - - vscale - templateRef: redis7-config-template - volumeName: redis-config - - configFileParams: - redis.conf: - parameters: - acllog-max-len: "256" - name: mycluster-redis-redis-replication-config - ``` - -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 - > - default - - kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d - > - kpz77mcs - ``` - - 2. Connect to this cluster and verify whether the parameters are configured as expected. - - ```bash - kubectl exec -ti -n demo mycluster-redis-0 -- bash - - root@mycluster-redis-0:/# redis-cli -a kpz77mcs --user default - - 127.0.0.1:6379> config get parameter acllog-max-len - 1) "acllog-max-len" - 2) "256" - ``` - -:::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, `acllog-max-len` is configured as `256`. - - ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: OpsRequest - metadata: - name: mycluster-configuring-demo - namespace: demo - spec: - clusterName: mycluster - reconfigure: - componentName: redis - configurations: - - keys: - - key: redis.conf - parameters: - - key: acllog-max-len - value: "256" - name: redis-replication-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. - - 1. Get the username and password. - - ```bash - kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d - > - default - - kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d - > - kpz77mcs - ``` - - 2. Connect to this cluster and verify whether the parameters are configured as expected. - - ```bash - kubectl exec -ti -n demo mycluster-redis-0 -- bash - - root@mycluster-redis-0:/# redis-cli -a kpz77mcs --user default - - 127.0.0.1:6379> config get parameter acllog-max-len - 1) "acllog-max-len" - 2) "256" - ``` - -:::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-redis/high-availability/high-availability.md b/docs/user_docs/kubeblocks-for-redis/high-availability/high-availability.md index 28efeb3e543..4148b3fb05e 100644 --- a/docs/user_docs/kubeblocks-for-redis/high-availability/high-availability.md +++ b/docs/user_docs/kubeblocks-for-redis/high-availability/high-availability.md @@ -50,141 +50,141 @@ In the Redis Replication Cluster provided by KubeBlocks, Sentinel is deployed as - + -This section takes the cluster `redis-cluster` in the namespace `default` as an example. +This section takes the cluster `mycluster` in the namespace `demo` as an example. 1. View the initial status of the Redis cluster. + ```bash + kubectl get pods -l kubeblocks.io/role=primary -n demo + > + NAME READY STATUS RESTARTS AGE + mycluster-redis-0 3/3 Running 0 24m + + kubectl get pods -l kubeblocks.io/role=secondary -n demo + > + NAME READY STATUS RESTARTS AGE + mycluster-redis-1 3/3 Running 1 (24m ago) 24m + ``` + + Currently, `mycluster-redis-0` is the primary pod and `mycluster-redis-1` is the secondary pod. + + :::note + + To fetch a more complete output, you can modify the `-o` parameter. + ```bash - kbcli cluster describe redis-cluster + kubectl get pods -o custom-columns=NAME:.metadata.name,ROLE_LABEL:.metadata.labels."kubeblocks\.io/role" ``` - ![Redis cluster original status](../../../img/redis-ha-before.png) - - Currently, `redis-cluster-redis-0` is the primary pod and `redis-cluster-redis-1` is the secondary pod. + ::: 2. Simulate a primary pod exception. ```bash # Enter the primary pod - kubectl exec -it redis-cluster-redis-0 -- bash + kubectl exec -ti -n demo mycluster-redis-0 -- bash # Execute the debug sleep command to simulate a primary pod exception - root@redis-redis-0:/# redis-cli debug sleep 30 + root@mycluster-redis-0:/# redis-cli debug sleep 30 ``` 3. Open the Redis Sentinel log to view the failover. ```bash - kubectl logs redis-cluster-redis-sentinel-0 + kubectl logs mycluster-redis-sentinel-0 -n demo ``` In the logs, we can view when a high-availability switch occurs. ```bash - 1:X 18 Apr 2023 06:13:17.072 # +switch-master redis-cluster-redis-sentinel redis-cluster-redis-0.redis-cluster-redis-headless.default.svc 6379 redis-cluster-redis-1.redis-cluster-redis-headless.default.svc 6379 - 1:X 18 Apr 2023 06:13:17.074 * +slave slave redis-cluster-redis-0.redis-cluster-redis-headless.default.svc:6379 redis-cluster-redis-0.redis-cluster-redis-headless.default.svc 6379 @ redis-cluster-redis-sentinel redis-cluster-redis-1.redis-cluster-redis-headless.default.svc 6379 + 1:X 18 Apr 2023 06:13:17.072 # +switch-master mycluster-redis-sentinel mycluster-redis-0.mycluster-redis-headless.default.svc 6379 mycluster-redis-1.mycluster-redis-headless.default.svc 6379 + 1:X 18 Apr 2023 06:13:17.074 * +slave slave mycluster-redis-0.mycluster-redis-headless.default.svc:6379 mycluster-redis-0.mycluster-redis-headless.default.svc 6379 @ mycluster-redis-sentinel mycluster-redis-1.mycluster-redis-headless.default.svc 6379 1:X 18 Apr 2023 06:13:17.077 * Sentinel new configuration saved on disk ``` 4. Connect to the Redis cluster to view the primary pod information after the exception simulation. - ```bash - kbcli cluster connect redis-cluster - ``` - - ```bash - # View the current primary pod - 127.0.0.1:6379> info replication - ``` - - ![Redis info replication](../../../img/redis-ha-info-replication.png) + ```bash + 127.0.0.1:6379> info replication + ``` - From the output, `redis-cluster-redis-1` has been assigned as the primary's pod. + Now `mycluster-redis-1` has been assigned as the primary's pod. 5. Describe the cluster and check the instance role. ```bash - kbcli cluster describe redis-cluster + kubectl get pods -l kubeblocks.io/role=primary -n demo + kubectl get pods -l kubeblocks.io/role=secondary -n demo ``` - ![Redis cluster status after HA](./../../../img/redis-ha-after.png) - - After the failover, `redis-cluster-redis-0` becomes the secondary pod and `redis-cluster-redis-1` becomes the primary pod. + After the failover, `mycluster-redis-0` becomes the secondary pod and `mycluster-redis-1` becomes the primary pod. - + -This section takes the cluster `mycluster` in the namespace `demo` as an example. +This section takes the cluster `redis-cluster` in the namespace `default` as an example. 1. View the initial status of the Redis cluster. - ```bash - kubectl get pods -l kubeblocks.io/role=primary -n demo - > - NAME READY STATUS RESTARTS AGE - mycluster-redis-0 3/3 Running 0 24m - - kubectl get pods -l kubeblocks.io/role=secondary -n demo - > - NAME READY STATUS RESTARTS AGE - mycluster-redis-1 3/3 Running 1 (24m ago) 24m - ``` - - Currently, `mycluster-redis-0` is the primary pod and `mycluster-redis-1` is the secondary pod. - - :::note - - To fetch a more complete output, you can modify the `-o` parameter. - ```bash - kubectl get pods -o custom-columns=NAME:.metadata.name,ROLE_LABEL:.metadata.labels."kubeblocks\.io/role" + kbcli cluster describe redis-cluster ``` - ::: + ![Redis cluster original status](../../../img/redis-ha-before.png) + + Currently, `redis-cluster-redis-0` is the primary pod and `redis-cluster-redis-1` is the secondary pod. 2. Simulate a primary pod exception. ```bash # Enter the primary pod - kubectl exec -ti -n demo mycluster-redis-0 -- bash + kubectl exec -it redis-cluster-redis-0 -- bash # Execute the debug sleep command to simulate a primary pod exception - root@mycluster-redis-0:/# redis-cli debug sleep 30 + root@redis-redis-0:/# redis-cli debug sleep 30 ``` 3. Open the Redis Sentinel log to view the failover. ```bash - kubectl logs mycluster-redis-sentinel-0 -n demo + kubectl logs redis-cluster-redis-sentinel-0 ``` In the logs, we can view when a high-availability switch occurs. ```bash - 1:X 18 Apr 2023 06:13:17.072 # +switch-master mycluster-redis-sentinel mycluster-redis-0.mycluster-redis-headless.default.svc 6379 mycluster-redis-1.mycluster-redis-headless.default.svc 6379 - 1:X 18 Apr 2023 06:13:17.074 * +slave slave mycluster-redis-0.mycluster-redis-headless.default.svc:6379 mycluster-redis-0.mycluster-redis-headless.default.svc 6379 @ mycluster-redis-sentinel mycluster-redis-1.mycluster-redis-headless.default.svc 6379 + 1:X 18 Apr 2023 06:13:17.072 # +switch-master redis-cluster-redis-sentinel redis-cluster-redis-0.redis-cluster-redis-headless.default.svc 6379 redis-cluster-redis-1.redis-cluster-redis-headless.default.svc 6379 + 1:X 18 Apr 2023 06:13:17.074 * +slave slave redis-cluster-redis-0.redis-cluster-redis-headless.default.svc:6379 redis-cluster-redis-0.redis-cluster-redis-headless.default.svc 6379 @ redis-cluster-redis-sentinel redis-cluster-redis-1.redis-cluster-redis-headless.default.svc 6379 1:X 18 Apr 2023 06:13:17.077 * Sentinel new configuration saved on disk ``` 4. Connect to the Redis cluster to view the primary pod information after the exception simulation. - ```bash - 127.0.0.1:6379> info replication - ``` + ```bash + kbcli cluster connect redis-cluster + ``` - Now `mycluster-redis-1` has been assigned as the primary's pod. + ```bash + # View the current primary pod + 127.0.0.1:6379> info replication + ``` + + ![Redis info replication](../../../img/redis-ha-info-replication.png) + + From the output, `redis-cluster-redis-1` has been assigned as the primary's pod. 5. Describe the cluster and check the instance role. ```bash - kubectl get pods -l kubeblocks.io/role=primary -n demo - kubectl get pods -l kubeblocks.io/role=secondary -n demo + kbcli cluster describe redis-cluster ``` - After the failover, `mycluster-redis-0` becomes the secondary pod and `mycluster-redis-1` becomes the primary pod. + ![Redis cluster status after HA](./../../../img/redis-ha-after.png) + + After the failover, `redis-cluster-redis-0` becomes the secondary pod and `redis-cluster-redis-1` becomes the primary pod. diff --git a/docs/user_docs/kubeblocks-for-starrocks/manage-starrocks.md b/docs/user_docs/kubeblocks-for-starrocks/manage-starrocks.md index 2756c7b2a3a..378e35f7047 100644 --- a/docs/user_docs/kubeblocks-for-starrocks/manage-starrocks.md +++ b/docs/user_docs/kubeblocks-for-starrocks/manage-starrocks.md @@ -30,76 +30,7 @@ This tutorial illustrates how to create and manage a StarRocks cluster by `kbcli - - -***Steps*** - -1. Execute the following command to create a StarRocks cluster. - - ```bash - kbcli cluster create mycluster --cluster-definition=starrocks -n demo - ``` - - You can also create a cluster with specified CPU, memory and storage values. - - ```bash - kbcli cluster create mycluster --cluster-definition=starrocks --set cpu=1,memory=2Gi,storage=10Gi -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 --help -kbcli cluster create -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 starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 - ``` - -3. Check the cluster information. - - ```bash - kbcli cluster describe mycluster -n demo - > - Name: mycluster Created Time: Jul 17,2024 19:06 UTC+0800 - NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY - demo starrocks starrocks-3.1.1 Running Delete - - Endpoints: - COMPONENT MODE INTERNAL EXTERNAL - fe ReadWrite mycluster-fe.default.svc.cluster.local:9030 - - Topology: - COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME - be mycluster-be-0 Running minikube/192.168.49.2 Jul 17,2024 19:06 UTC+0800 - fe mycluster-fe-0 Running minikube/192.168.49.2 Jul 17,2024 19:06 UTC+0800 - - Resources Allocation: - COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS - fe false 1 / 1 1Gi / 1Gi data:20Gi standard - be false 1 / 1 1Gi / 1Gi data:20Gi standard - - Images: - COMPONENT TYPE IMAGE - fe fe apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/fe-ubuntu:2.5.4 - be be apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/fe-ubuntu:2.5.4 - - 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 StarRocks cluster. @@ -185,89 +116,116 @@ kubectl get cluster mycluster -n demo -o yaml - + -## Scale +***Steps*** -### Scale vertically +1. Execute the following command to create a StarRocks cluster. -#### Before you start + ```bash + kbcli cluster create mycluster --cluster-definition=starrocks -n demo + ``` -Check whether the cluster status is `Running`. Otherwise, the following operations may fail. + You can also create a cluster with specified CPU, memory and storage values. - + ```bash + kbcli cluster create mycluster --cluster-definition=starrocks --set cpu=1,memory=2Gi,storage=10Gi -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 list mycluster -n demo -> -NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME -mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 +kbcli cluster create --help +kbcli cluster create -h ``` - +::: - +2. Check whether the cluster is created successfully. -```bash -kubectl get cluster mycluster -n demo -> -NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE -mycluster starrocks starrocks-3.1.1 Delete Running 4m29s -``` + ```bash + kbcli cluster list -n demo + > + NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME + mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 + ``` - +3. Check the cluster information. - + ```bash + kbcli cluster describe mycluster -n demo + > + Name: mycluster Created Time: Jul 17,2024 19:06 UTC+0800 + NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY + demo starrocks starrocks-3.1.1 Running Delete -#### Steps + Endpoints: + COMPONENT MODE INTERNAL EXTERNAL + fe ReadWrite mycluster-fe.default.svc.cluster.local:9030 - + Topology: + COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME + be mycluster-be-0 Running minikube/192.168.49.2 Jul 17,2024 19:06 UTC+0800 + fe mycluster-fe-0 Running minikube/192.168.49.2 Jul 17,2024 19:06 UTC+0800 - + Resources Allocation: + COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS + fe false 1 / 1 1Gi / 1Gi data:20Gi standard + be false 1 / 1 1Gi / 1Gi data:20Gi standard -1. Set the `--cpu` and `--memory` values according to your needs and run the following command to perform vertical scaling. + Images: + COMPONENT TYPE IMAGE + fe fe apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/fe-ubuntu:2.5.4 + be be apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/fe-ubuntu:2.5.4 - ```bash - kbcli cluster vscale mycluster -n demo --cpu=2 --memory=20Gi --components=be + Show cluster events: kbcli cluster list-events -n demo mycluster ``` - Please wait a few seconds until the scaling process is over. + -2. Validate the vertical scaling operation. + - - View the OpsRequest progress. +## Scale - 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. +### Scale vertically - ```bash - kbcli cluster describe-ops mycluster-verticalscaling-smx8b -n demo - ``` +#### Before you start - - Check the cluster status. +Check whether the cluster status is `Running`. Otherwise, the following operations may fail. - ```bash - kbcli cluster list mycluster -n demo - > - NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME - mycluster demo starrocks starrocks-3.1.1 Delete Updating Jul 17,2024 19:06 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 get cluster mycluster -n demo +> +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster starrocks starrocks-3.1.1 Delete Running 4m29s +``` - ```bash - kbcli cluster describe mycluster -n demo - ``` + + + + +```bash +kbcli cluster list mycluster -n demo +> +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 +``` - + + +#### Steps + + + + 1. Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs. @@ -315,14 +273,14 @@ mycluster starrocks starrocks-3.1.1 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 values of `spec.componentSpecs.resources`. + + ```yaml + ... spec: clusterDefinitionRef: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 @@ -330,13 +288,14 @@ mycluster starrocks starrocks-3.1.1 Delete Running - name: fe componentDefRef: fe replicas: 2 - resources: # Change the values of resources. + resources: # Change the values of resources requests: memory: "2Gi" cpu: "1" limits: memory: "4Gi" cpu: "2" + ... ``` 2. Check whether the corresponding resources change. @@ -347,6 +306,48 @@ mycluster starrocks starrocks-3.1.1 Delete Running + + +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=2 --memory=20Gi --components=be + ``` + + 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-smx8b -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 starrocks starrocks-3.1.1 Delete Updating Jul 17,2024 19:06 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 + ``` + + + ### Scale horizontally @@ -361,75 +362,35 @@ 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 starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster starrocks starrocks-3.1.1 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 starrocks starrocks-3.1.1 Delete Running 4m29s +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 ``` -#### Steps - - - - - -1. Configure the parameters `--components` and `--replicas`, and run the command. - - ```bash - kbcli cluster hscale mycluster --replicas=3 --components=be -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. - - - 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 - ``` - - +#### Steps + + - + 1. Apply an OpsRequest to a specified cluster. Configure the parameters according to your needs. @@ -496,21 +457,22 @@ mycluster starrocks starrocks-3.1.1 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 values of `spec.componentSpecs.replicas`. + + ```yaml + ... spec: clusterDefinitionRef: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 componentSpecs: - name: fe componentDefRef: fe - replicas: 2 # Change the amount + replicas: 2 # Change this value + ... ``` 2. Check whether the corresponding resources change. @@ -521,6 +483,46 @@ mycluster starrocks starrocks-3.1.1 Delete Running + + +1. Configure the parameters `--components` and `--replicas`, and run the command. + + ```bash + kbcli cluster hscale mycluster --replicas=3 --components=be -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. + + - 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 + ``` + + + ## Volume expansion @@ -531,24 +533,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 starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster starrocks starrocks-3.1.1 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 starrocks starrocks-3.1.1 Delete Running 4m29s +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 ``` @@ -559,44 +561,7 @@ mycluster starrocks starrocks-3.1.1 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=be - ``` - - 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 -n demo - > - NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME - mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 - ``` - -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. @@ -643,13 +608,14 @@ mycluster starrocks starrocks-3.1.1 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 values of `spec.componentSpecs.volumeClaimTemplates.spec.resources`. + + ```yaml + ... spec: clusterDefinitionRef: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 @@ -663,8 +629,8 @@ mycluster starrocks starrocks-3.1.1 Delete Running - 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. @@ -675,40 +641,50 @@ mycluster starrocks starrocks-3.1.1 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=be + ``` - + 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="starrocks" --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 - mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 - ``` + ```bash + kbcli cluster list mycluster -n demo + > + NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME + mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800 + ``` - * 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. @@ -742,6 +718,33 @@ mycluster starrocks starrocks-3.1.1 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="starrocks" --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 starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 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 @@ -754,15 +757,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 restart a cluster. @@ -783,14 +778,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: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 @@ -808,10 +803,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop - name: fe componentDefRef: fe serviceAccountName: kb-starrocks-cluster - replicas: 0 + replicas: 0 # Change this value - name: be componentDefRef: be - replicas: 0 + replicas: 0 # Change this value + ``` + + + + + + ```bash + kbcli cluster stop mycluster -n demo ``` @@ -822,18 +825,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 ``` @@ -846,15 +849,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. @@ -875,6 +870,10 @@ 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 @@ -895,10 +894,18 @@ You can stop/start a cluster to save computing resources. When a cluster is stop - name: fe componentDefRef: fe serviceAccountName: kb-starrocks-cluster - replicas: 1 + replicas: 1 # Change this value - name: be componentDefRef: be - replicas: 2 + replicas: 2 # Change this value + ``` + + + + + + ```bash + kbcli cluster start mycluster -n demo ``` @@ -909,18 +916,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 ``` @@ -948,24 +955,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 30,2024 13:03 UTC+0800 +NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE +mycluster starrocks starrocks-3.1.1 Delete Running 34m ``` - + ```bash -kubectl get cluster mycluster -n demo +kbcli cluster list mycluster -n demo > -NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE -mycluster starrocks starrocks-3.1.1 Delete Running 34m +NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME +mycluster demo Delete Running Sep 30,2024 13:03 UTC+0800 ``` @@ -978,22 +985,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/maintenance/backup-and-restore/backup/backup-repo.md b/docs/user_docs/maintenance/backup-and-restore/backup/backup-repo.md index 59b5d679750..e6b7376fe02 100644 --- a/docs/user_docs/maintenance/backup-and-restore/backup/backup-repo.md +++ b/docs/user_docs/maintenance/backup-and-restore/backup/backup-repo.md @@ -126,35 +126,35 @@ You can specify the BackupRepo information in a YAML configuration file when ins - + ```bash - kbcli kubeblocks install -f backuprepo.yaml + kubectl create -f backuprepo.yaml ``` Use the command below to check the BackupRepo after installation. ```bash - kbcli backuprepo list + kubectl get backuprepo ``` - + ```bash - kubectl create -f backuprepo.yaml + kbcli kubeblocks install -f backuprepo.yaml ``` Use the command below to check the BackupRepo after installation. ```bash - kubectl get backuprepo + kbcli backuprepo list ``` - + ### Manual BackupRepo configuration @@ -162,168 +162,7 @@ If you do not configure the BackupRepo information when installing KubeBlocks, y - - -1. Install the S3 CSI driver (only used in the Mount method). - - ```bash - # Enable the CSI-S3 addon - kbcli addon enable csi-s3 - - # You can add flags to customize the installation of this addon - # CSI-S3 installs a daemonSet Pod on all nodes by default and you can set tolerations to install it on the specified node - kbcli addon enable csi-s3 \ - --tolerations '[{"key":"taintkey","operator":"Equal","effect":"NoSchedule","value":"true"}]' \ - --tolerations 'daemonset:[{"key":"taintkey","operator":"Equal","effect":"NoSchedule","value":"true"}]' - - # View the status of CSI-S3 driver and make sure it is Enabled - kbcli addon list csi-s3 - ``` - -2. Create BackupRepo. - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider s3 \ - --region cn-northwest-1 \ - --bucket test-kb-backup \ - --access-key-id \ - --secret-access-key \ - --access-method Tool \ # Mount is also acceptable - --default - ``` - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider oss \ - --region cn-zhangjiakou \ - --bucket test-kb-backup \ - # --endpoint https://oss-cn-zhangjiakou-internal.aliyuncs.com \ can show the specified oss endpoint - --access-key-id \ - --secret-access-key \ - --access-method Tool \ - --default - ``` - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider obs \ - --region cn-north-4 \ - --bucket test-kb-backup \ - --access-key-id \ - --secret-access-key \ - --access-method Tool \ - --default - ``` - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider cos \ - --region ap-guangzhou \ - # In COS, the naming format of a bucket is ,where APPID is automatically generated by Tencent Cloud - # When setting up, first create the bucket through Tencent Cloud's console and obtain the bucket name - --bucket test-kb-backup \ - --access-key-id \ - --secret-access-key \ - --access-method Tool \ - --default - ``` - - - - - - ```bash - # The current GCS is the S3-compatible version provided by Google Cloud - kbcli backuprepo create my-repo \ - --provider gcs \ - --region auto \ - --bucket test-kb-backup \ - --access-key-id \ - --secret-access-key \ - --access-method Tool \ - --default - ``` - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider minio \ - --endpoint \ # The access address for the deployed MinIO is: http://minio.kb-system.svc.cluster.local:9000 - --bucket test-minio \ - --access-key-id \ - --secret-access-key \ - --access-method Tool \ - --default - ``` - - - - - - ```bash - kbcli backuprepo create my-repo \ - --provider pvc \ - --storage-class-name "nfs-storage" \ - --access-mode "ReadWriteMany" \ - --volume-capacity "100Gi" \ - --default - ``` - - - - - - The above command creates a default backup repository `my-repo`. - - * `my-repo` is the name of the created backup repository. If you do not specify a name, the system creates a random name, following the format `backuprepo-xxxxx`. - * `--default` means that this repository is set as the default repository. Note that there can only be one default global repository. If there exist multiple default repositories, KubeBlocks cannot decide which one to use (similar to the default StorageClass of Kubernetes), which further results in backup failure. Using kbcli to create BackupRepo can avoid such problems because kbcli checks whether there is another default repository before creating a new one. - * `--provider` specifies the storage type, i.e. `storageProvider`, and is required for creating a BakcupRepo. The available values are `s3`, `cos`, `gcs-s3comp`, `obs`, `oss`, `minio`, `ftp`, and `nfs`. Parameters for different storage providers vary and you can run `kbcli backuprepo create --provider STORAGE-PROVIDER-NAME -h` to view the flags for different storage providers. Please note that `--provider` is mandatory in configuration. - - After `kbcli backuprepo create` is executed successfully, the system creates the K8s resource whose type is `BackupRepo`. You can modify the annotation of this resource to adjust the default repository. - - ```bash - # Cancel the default repository - kubectl annotate backuprepo old-default-repo \ - --overwrite=true \ - dataprotection.kubeblocks.io/is-default-repo=false - ``` - - ```bash - # Set a new default repository - kubectl annotate backuprepo backuprepo-4qms6 \ - --overwrite=true \ - dataprotection.kubeblocks.io/is-default-repo=true - ``` - -3. View the BackupRepo and its status. If the status is `Ready`, the BackupRepo is ready. - - ```bash - kbcli backuprepo list - ``` - - - - + 1. Install the S3 CSI driver (only used in the Mount method). @@ -560,4 +399,165 @@ If you do not configure the BackupRepo information when installing KubeBlocks, y + + +1. Install the S3 CSI driver (only used in the Mount method). + + ```bash + # Enable the CSI-S3 addon + kbcli addon enable csi-s3 + + # You can add flags to customize the installation of this addon + # CSI-S3 installs a daemonSet Pod on all nodes by default and you can set tolerations to install it on the specified node + kbcli addon enable csi-s3 \ + --tolerations '[{"key":"taintkey","operator":"Equal","effect":"NoSchedule","value":"true"}]' \ + --tolerations 'daemonset:[{"key":"taintkey","operator":"Equal","effect":"NoSchedule","value":"true"}]' + + # View the status of CSI-S3 driver and make sure it is Enabled + kbcli addon list csi-s3 + ``` + +2. Create BackupRepo. + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider s3 \ + --region cn-northwest-1 \ + --bucket test-kb-backup \ + --access-key-id \ + --secret-access-key \ + --access-method Tool \ # Mount is also acceptable + --default + ``` + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider oss \ + --region cn-zhangjiakou \ + --bucket test-kb-backup \ + # --endpoint https://oss-cn-zhangjiakou-internal.aliyuncs.com \ can show the specified oss endpoint + --access-key-id \ + --secret-access-key \ + --access-method Tool \ + --default + ``` + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider obs \ + --region cn-north-4 \ + --bucket test-kb-backup \ + --access-key-id \ + --secret-access-key \ + --access-method Tool \ + --default + ``` + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider cos \ + --region ap-guangzhou \ + # In COS, the naming format of a bucket is ,where APPID is automatically generated by Tencent Cloud + # When setting up, first create the bucket through Tencent Cloud's console and obtain the bucket name + --bucket test-kb-backup \ + --access-key-id \ + --secret-access-key \ + --access-method Tool \ + --default + ``` + + + + + + ```bash + # The current GCS is the S3-compatible version provided by Google Cloud + kbcli backuprepo create my-repo \ + --provider gcs \ + --region auto \ + --bucket test-kb-backup \ + --access-key-id \ + --secret-access-key \ + --access-method Tool \ + --default + ``` + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider minio \ + --endpoint \ # The access address for the deployed MinIO is: http://minio.kb-system.svc.cluster.local:9000 + --bucket test-minio \ + --access-key-id \ + --secret-access-key \ + --access-method Tool \ + --default + ``` + + + + + + ```bash + kbcli backuprepo create my-repo \ + --provider pvc \ + --storage-class-name "nfs-storage" \ + --access-mode "ReadWriteMany" \ + --volume-capacity "100Gi" \ + --default + ``` + + + + + + The above command creates a default backup repository `my-repo`. + + * `my-repo` is the name of the created backup repository. If you do not specify a name, the system creates a random name, following the format `backuprepo-xxxxx`. + * `--default` means that this repository is set as the default repository. Note that there can only be one default global repository. If there exist multiple default repositories, KubeBlocks cannot decide which one to use (similar to the default StorageClass of Kubernetes), which further results in backup failure. Using kbcli to create BackupRepo can avoid such problems because kbcli checks whether there is another default repository before creating a new one. + * `--provider` specifies the storage type, i.e. `storageProvider`, and is required for creating a BakcupRepo. The available values are `s3`, `cos`, `gcs-s3comp`, `obs`, `oss`, `minio`, `ftp`, and `nfs`. Parameters for different storage providers vary and you can run `kbcli backuprepo create --provider STORAGE-PROVIDER-NAME -h` to view the flags for different storage providers. Please note that `--provider` is mandatory in configuration. + + After `kbcli backuprepo create` is executed successfully, the system creates the K8s resource whose type is `BackupRepo`. You can modify the annotation of this resource to adjust the default repository. + + ```bash + # Cancel the default repository + kubectl annotate backuprepo old-default-repo \ + --overwrite=true \ + dataprotection.kubeblocks.io/is-default-repo=false + ``` + + ```bash + # Set a new default repository + kubectl annotate backuprepo backuprepo-4qms6 \ + --overwrite=true \ + dataprotection.kubeblocks.io/is-default-repo=true + ``` + +3. View the BackupRepo and its status. If the status is `Ready`, the BackupRepo is ready. + + ```bash + kbcli backuprepo list + ``` + + + \ No newline at end of file diff --git a/docs/user_docs/maintenance/backup-and-restore/backup/configure-backuppolicy.md b/docs/user_docs/maintenance/backup-and-restore/backup/configure-backuppolicy.md index a58a0ff135f..dadf3ae311a 100644 --- a/docs/user_docs/maintenance/backup-and-restore/backup/configure-backuppolicy.md +++ b/docs/user_docs/maintenance/backup-and-restore/backup/configure-backuppolicy.md @@ -111,25 +111,25 @@ After creating a database cluster, a BackupPolicy is created automatically for d - + ```bash -kbcli cluster list-backup-policy mysql-cluster +kubectl get backuppolicy | grep mycluster > -NAME NAMESPACE DEFAULT CLUSTER CREATE-TIME STATUS -mysql-cluster-mysql-backup-policy default true mysql-cluster Oct 30,2023 14:34 UTC+0800 Available -mysql-cluster-mysql-backup-policy-hscale default false mysql-cluster Oct 30,2023 14:34 UTC+0800 Available +mycluster-mysql-backup-policy Available 35m +mycluster-mysql-backup-policy-hscale Available 35m ``` - + ```bash -kubectl get backuppolicy | grep mycluster +kbcli cluster list-backup-policy mysql-cluster > -mycluster-mysql-backup-policy Available 35m -mycluster-mysql-backup-policy-hscale Available 35m +NAME NAMESPACE DEFAULT CLUSTER CREATE-TIME STATUS +mysql-cluster-mysql-backup-policy default true mysql-cluster Oct 30,2023 14:34 UTC+0800 Available +mysql-cluster-mysql-backup-policy-hscale default false mysql-cluster Oct 30,2023 14:34 UTC+0800 Available ``` @@ -140,7 +140,15 @@ The backup policy includes the backup methods supported by the cluster. Execute - + + +```bash +kubectl get backuppolicy mycluster-mysql-backup-policy -o yaml +``` + + + + ```bash kbcli cluster describe-backup-policy mysql-cluster @@ -160,14 +168,6 @@ volume-snapshot volumesnapshot-for-apecloud-mysql true - - -```bash -kubectl get backuppolicy mycluster-mysql-backup-policy -o yaml -``` - - - For a MySQL cluster, two default backup methods are supported: `xtrabackup` and `volume-snapshot`. The former uses the backup tool `xtrabackup` to backup MySQL data to an object storage, while the latter utilizes the volume snapshot capability of cloud storage to backup data through snapshots. When creating a backup, you can specify which backup method to use. diff --git a/docs/user_docs/maintenance/backup-and-restore/backup/on-demand-backup.md b/docs/user_docs/maintenance/backup-and-restore/backup/on-demand-backup.md index 06fd0dd1e59..05b7e3feac5 100644 --- a/docs/user_docs/maintenance/backup-and-restore/backup/on-demand-backup.md +++ b/docs/user_docs/maintenance/backup-and-restore/backup/on-demand-backup.md @@ -19,25 +19,7 @@ The following command uses the `xtrabackup` backup method to create a backup nam - - -```bash -# Create a backup -kbcli cluster backup mysql-cluster --name mybackup --method xtrabackup -> -Backup mybackup created successfully, you can view the progress: - kbcli cluster list-backups --name=mybackup -n default - -# View the backup -kbcli cluster list-backups --name=mybackup -n default -> -NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION CREATE-TIME COMPLETION-TIME EXPIRATION -mybackup default mysql-cluster xtrabackup Completed 4426858 2m8s Oct 30,2023 15:19 UTC+0800 Oct 30,2023 15:21 UTC+0800 -``` - - - - + ```bash # Create a backup @@ -69,19 +51,11 @@ The `dataprotection.kubeblocks.io/connection-password` in annotations uses the p - - -## Volume snapshot backup - -To create a backup using the snapshot, the `backupMethod` in the YAML configuration file or the `--method` field in the kbcli command should be set to `volume-snapshot`. - - - - + ```bash # Create a backup -kbcli cluster backup mysql-cluster --name mybackup --method volume-snapshot +kbcli cluster backup mysql-cluster --name mybackup --method xtrabackup > Backup mybackup created successfully, you can view the progress: kbcli cluster list-backups --name=mybackup -n default @@ -89,13 +63,21 @@ Backup mybackup created successfully, you can view the progress: # View the backup kbcli cluster list-backups --name=mybackup -n default > -NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION CREATE-TIME COMPLETION-TIME EXPIRATION -mybackup default mysql-cluster volume-snapshot Completed 4426858 2m8s Oct 30,2023 15:19 UTC+0800 Oct 30,2023 15:21 UTC+0800 +NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION CREATE-TIME COMPLETION-TIME EXPIRATION +mybackup default mysql-cluster xtrabackup Completed 4426858 2m8s Oct 30,2023 15:19 UTC+0800 Oct 30,2023 15:21 UTC+0800 ``` - + + +## Volume snapshot backup + +To create a backup using the snapshot, the `backupMethod` in the YAML configuration file or the `--method` field in the kbcli command should be set to `volume-snapshot`. + + + + ```bash # Create a backup @@ -119,6 +101,24 @@ mybackup mycluster-mysql-backup-policy volume-snapshot my-repo Compl + + +```bash +# Create a backup +kbcli cluster backup mysql-cluster --name mybackup --method volume-snapshot +> +Backup mybackup created successfully, you can view the progress: + kbcli cluster list-backups --name=mybackup -n default + +# View the backup +kbcli cluster list-backups --name=mybackup -n default +> +NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION CREATE-TIME COMPLETION-TIME EXPIRATION +mybackup default mysql-cluster volume-snapshot Completed 4426858 2m8s Oct 30,2023 15:19 UTC+0800 Oct 30,2023 15:21 UTC+0800 +``` + + + :::caution diff --git a/docs/user_docs/maintenance/backup-and-restore/backup/scheduled-backup.md b/docs/user_docs/maintenance/backup-and-restore/backup/scheduled-backup.md index 9804b93cff4..8ce4201609c 100644 --- a/docs/user_docs/maintenance/backup-and-restore/backup/scheduled-backup.md +++ b/docs/user_docs/maintenance/backup-and-restore/backup/scheduled-backup.md @@ -15,29 +15,17 @@ KubeBlocks supports configuring scheduled backups for clusters. - - -```bash -kbcli cluster update mysql-cluster --backup-enabled=true \ ---backup-method=xtrabackup --backup-repo-name=my-repo \ ---backup-retention-period=7d --backup-cron-expression="0 18 * * *" -``` - -- `--backup-enabled` indicates whether to enable scheduled backups. -- `--backup-method` specifies the backup method. You can use the `kbcli cluster describe-backup-policy mysql-cluster` command to view the supported backup methods. -- `--backup-repo-name` specifies the name of the backupRepo. -- `--backup-retention-period` specifies the retention period for backups, which is 7 days in the example. -- `--backup-cron-expression` specifies the backup schedule using a cron expression in UTC timezone. Refer to [cron](https://en.wikipedia.org/wiki/Cron) for the expression format. - - - - + Modify the backup field with kubectl as follows. ```bash kubectl edit cluster -n default mysql-cluster -> +``` + +Edit the cluster YAML. + +```yaml spec: ... backup: @@ -59,6 +47,22 @@ In the above YAML file, you can set whether to enable automatic backups and PITR + + +```bash +kbcli cluster update mysql-cluster --backup-enabled=true \ +--backup-method=xtrabackup --backup-repo-name=my-repo \ +--backup-retention-period=7d --backup-cron-expression="0 18 * * *" +``` + +- `--backup-enabled` indicates whether to enable scheduled backups. +- `--backup-method` specifies the backup method. You can use the `kbcli cluster describe-backup-policy mysql-cluster` command to view the supported backup methods. +- `--backup-repo-name` specifies the name of the backupRepo. +- `--backup-retention-period` specifies the retention period for backups, which is 7 days in the example. +- `--backup-cron-expression` specifies the backup schedule using a cron expression in UTC timezone. Refer to [cron](https://en.wikipedia.org/wiki/Cron) for the expression format. + + + After the scheduled backup is enabled, execute the following command to check if a CronJob object has been created: diff --git a/docs/user_docs/maintenance/backup-and-restore/restore/pitr.md b/docs/user_docs/maintenance/backup-and-restore/restore/pitr.md index e4a73c25f40..9586977707d 100644 --- a/docs/user_docs/maintenance/backup-and-restore/restore/pitr.md +++ b/docs/user_docs/maintenance/backup-and-restore/restore/pitr.md @@ -23,24 +23,7 @@ KubeBlocks supports PITR for databases such as MySQL and PostgreSQL. This docume - - - ```bash - kbcli cluster describe pg-cluster - > - ... - Data Protection: - BACKUP-REPO AUTO-BACKUP BACKUP-SCHEDULE BACKUP-METHOD BACKUP-RETENTION RECOVERABLE-TIME - minio Enabled */5 * * * * archive-wal 8d May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800 - ``` - - `RECOVERABLE-TIME` represents the time range within which the cluster can be restored. - - It can be seen that the current backup time range is `May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800`. Still, a full backup is required for data restoration, and this full backup must be completed within the time range of the log backups. - - - - + ```bash # 1. Get all backup objects for the current cluster @@ -59,21 +42,30 @@ KubeBlocks supports PITR for databases such as MySQL and PostgreSQL. This docume - - -2. Restore the cluster to a specific point in time. - - - - + ```bash - kbcli cluster restore pg-cluster-pitr --restore-to-time 'May 07,2024 15:48:47 UTC+0800' --backup + kbcli cluster describe pg-cluster + > + ... + Data Protection: + BACKUP-REPO AUTO-BACKUP BACKUP-SCHEDULE BACKUP-METHOD BACKUP-RETENTION RECOVERABLE-TIME + minio Enabled */5 * * * * archive-wal 8d May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800 ``` + `RECOVERABLE-TIME` represents the time range within which the cluster can be restored. + + It can be seen that the current backup time range is `May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800`. Still, a full backup is required for data restoration, and this full backup must be completed within the time range of the log backups. + - + + +2. Restore the cluster to a specific point in time. + + + + ```bash apiVersion: apps.kubeblocks.io/v1alpha1 @@ -91,24 +83,32 @@ KubeBlocks supports PITR for databases such as MySQL and PostgreSQL. This docume + + + ```bash + kbcli cluster restore pg-cluster-pitr --restore-to-time 'May 07,2024 15:48:47 UTC+0800' --backup + ``` + + + 3. Check the status of the new cluster. - + ```bash - kbcli cluster list pg-cluster-pitr + kubectl get cluster pg-cluster-pitr ``` - + ```bash - kubectl get cluster pg-cluster-pitr + kbcli cluster list pg-cluster-pitr ``` diff --git a/docs/user_docs/maintenance/backup-and-restore/restore/restore-data-from-backup-set.md b/docs/user_docs/maintenance/backup-and-restore/restore/restore-data-from-backup-set.md index 06a8ac84094..d24de26ab9f 100644 --- a/docs/user_docs/maintenance/backup-and-restore/restore/restore-data-from-backup-set.md +++ b/docs/user_docs/maintenance/backup-and-restore/restore/restore-data-from-backup-set.md @@ -17,7 +17,15 @@ KubeBlocks supports restoring clusters from backups with the following instructi - + + + ```bash + kubectl get backups + ``` + + + + For existing clusters, execute: @@ -33,38 +41,13 @@ KubeBlocks supports restoring clusters from backups with the following instructi - - - ```bash - kubectl get backups - ``` - - - 2. Restore clusters from a specific backup. - - - ```bash - # Restore new cluster - kbcli cluster restore myrestore --backup mybackup - > - Cluster myrestore created - - # View the status of the restored cluster - kbcli cluster list myrestore - > - NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME - myrestore default apecloud-mysql ac-mysql-8.0.30 Delete Running Oct 30,2023 16:26 UTC+0800 - ``` - - - - + You can set the `connectionPassword.annotations` of the restored cluster as that of the original cluster. The password of the original cluster can be accessed by viewing the annotation of `dataprotection.kubeblocks.io/connection-password` in the backup YAML file. @@ -98,6 +81,23 @@ KubeBlocks supports restoring clusters from backups with the following instructi + + + ```bash + # Restore new cluster + kbcli cluster restore myrestore --backup mybackup + > + Cluster myrestore created + + # View the status of the restored cluster + kbcli cluster list myrestore + > + NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME + myrestore default apecloud-mysql ac-mysql-8.0.30 Delete Running Oct 30,2023 16:26 UTC+0800 + ``` + + + 3. Connect to the restored cluster for verification. Once the cluster status is `Running`, [connect to the cluster](./../../../kubeblocks-for-apecloud-mysql/cluster-management/create-and-connect-an-apecloud-mysql-cluster.md#connect-to-a-cluster) for verification. diff --git a/docs/user_docs/maintenance/resource-scheduling/resource-scheduling.md b/docs/user_docs/maintenance/resource-scheduling/resource-scheduling.md index abd5a51bb2a..ce235f440bb 100644 --- a/docs/user_docs/maintenance/resource-scheduling/resource-scheduling.md +++ b/docs/user_docs/maintenance/resource-scheduling/resource-scheduling.md @@ -16,115 +16,7 @@ Affinity and toleration can be set by `kbcli` or editing the spec of a cluster o - - -Run `kbcli cluster create -h` to view the examples and the parameter options of affinity and toleration configurations. - -```bash -kbcli cluster create -h -> -Create a cluster - -Examples: - ...... - - # Create a cluster forced to scatter by node - kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname --pod-anti-affinity -Required - - # Create a cluster in specific labels nodes - kbcli cluster create --cluster-definition apecloud-mysql --node-labels -'"topology.kubernetes.io/zone=us-east-1a","disktype=ssd,essd"' - - # Create a Cluster with two tolerations - kbcli cluster create --cluster-definition apecloud-mysql --tolerations -'"key=engineType,value=mongo,operator=Equal,effect=NoSchedule","key=diskType,value=ssd,operator=Equal,effect=NoSchedule"' - - # Create a cluster, with each pod runs on their own dedicated node - kbcli cluster create --tenancy=DedicatedNode - -Options: - ...... - --node-labels=[]: - Node label selector - - --pod-anti-affinity='Preferred': - Pod anti-affinity type, one of: (Preferred, Required) - - --tenancy='SharedNode': - Tenancy options, one of: (SharedNode, DedicatedNode) - - --tolerations=[]: - Tolerations for cluster, such as '"key=engineType,value=mongo,operator=Equal,effect=NoSchedule"' - - --topology-keys=[]: - Topology keys for affinity - ...... -....... -``` - -## Examples - -The following examples use `kbcli` to create cluster instances and show the common situations of how to use pod affinity and toleration configuration. - -### Default configuration - -No affinity parameters are required. - -### Spread evenly as much as possible - -You can configure the pod affinity as "Preferred" if you want the pods of the cluster to be deployed in different topological domains, but do not want deployment failure due to failing to meet distribution requirements. -The example below creates and sets a cluster to be deployed evenly across nodes as much as possible. - -```bash -kbcli cluster create --topology-keys kubernetes.io/hostname --pod-anti-affinity Preferred -``` - -### Forced spread evenly - -You can configure the pod affinity as "Required" if the pods of the cluster must be deployed in different topological domains to ensure that the cluster can be disaster-tolerant across topological domains. -The example below creates and sets a cluster that must be deployed across nodes. - -```bash -kbcli cluster create --topology-keys kubernetes.io/hostname --pod-anti-affinity Required -``` - -### Deploy pods in specified nodes - -You can specify a node label to deploy a cluster on the specified node. -The example below creates and sets a cluster to be deployed on the node with an available zone label of `topology.kubernetes.io/zone=us-east-1a`. - -```bash -kbcli cluster create --node-labels '"topology.kubernetes.io/zone=us-east-1a"' -``` - -### Deploy pods in dedicated nodes - -If you want to manage node groups by the taint and node labels and need the clusters to be deployed on a dedicated host group, you can set tolerations and specify a node label. - -For example, you have a host group for deploying database clusters and this host is added with a taint named `database=true:NoSchedule` and a label `database=true`, then you can follow the command below to create a cluster. - -```bash -kbcli cluster create --node-labels '"databa=true"' --tolerations '"key=database,value=true,operator=Equal,effect=NoSchedule" -``` - -### One node only for one pod - -If you need one cluster only for the online core business and need to ensure every pod of this cluster has its own node to avoid being affected by the cluster of the cluster, you can specify `tenancy` as "DedicatedNode". - -```bash -kbcli cluster create --tenancy=DedicatedNode -``` - -:::note - -This command will be performed successfully based on the prerequisite that you have added taints for these nodes. Otherwise, the business that is not managed by KubeBlocks can still be deployed on these nodes. - -::: - - - - + You can configure pod affinity and toleration in either the spec of a cluster or the spec of a component. @@ -150,7 +42,7 @@ spec: podAntiAffinity: Required topologyKeys: - kubernetes.io/hostname - ...... +... ``` **Description of parameters in the YAML file** @@ -254,4 +146,112 @@ This command will be performed successfully based on the prerequisite that you h + + +Run `kbcli cluster create -h` to view the examples and the parameter options of affinity and toleration configurations. + +```bash +kbcli cluster create -h +> +Create a cluster + +Examples: + ... + + # Create a cluster forced to scatter by node + kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname --pod-anti-affinity +Required + + # Create a cluster in specific labels nodes + kbcli cluster create --cluster-definition apecloud-mysql --node-labels +'"topology.kubernetes.io/zone=us-east-1a","disktype=ssd,essd"' + + # Create a Cluster with two tolerations + kbcli cluster create --cluster-definition apecloud-mysql --tolerations +'"key=engineType,value=mongo,operator=Equal,effect=NoSchedule","key=diskType,value=ssd,operator=Equal,effect=NoSchedule"' + + # Create a cluster, with each pod runs on their own dedicated node + kbcli cluster create --tenancy=DedicatedNode + +Options: + ... + --node-labels=[]: + Node label selector + + --pod-anti-affinity='Preferred': + Pod anti-affinity type, one of: (Preferred, Required) + + --tenancy='SharedNode': + Tenancy options, one of: (SharedNode, DedicatedNode) + + --tolerations=[]: + Tolerations for cluster, such as '"key=engineType,value=mongo,operator=Equal,effect=NoSchedule"' + + --topology-keys=[]: + Topology keys for affinity + ... +... +``` + +## Examples + +The following examples use `kbcli` to create cluster instances and show the common situations of how to use pod affinity and toleration configuration. + +### Default configuration + +No affinity parameters are required. + +### Spread evenly as much as possible + +You can configure the pod affinity as "Preferred" if you want the pods of the cluster to be deployed in different topological domains, but do not want deployment failure due to failing to meet distribution requirements. +The example below creates and sets a cluster to be deployed evenly across nodes as much as possible. + +```bash +kbcli cluster create --topology-keys kubernetes.io/hostname --pod-anti-affinity Preferred +``` + +### Forced spread evenly + +You can configure the pod affinity as "Required" if the pods of the cluster must be deployed in different topological domains to ensure that the cluster can be disaster-tolerant across topological domains. +The example below creates and sets a cluster that must be deployed across nodes. + +```bash +kbcli cluster create --topology-keys kubernetes.io/hostname --pod-anti-affinity Required +``` + +### Deploy pods in specified nodes + +You can specify a node label to deploy a cluster on the specified node. +The example below creates and sets a cluster to be deployed on the node with an available zone label of `topology.kubernetes.io/zone=us-east-1a`. + +```bash +kbcli cluster create --node-labels '"topology.kubernetes.io/zone=us-east-1a"' +``` + +### Deploy pods in dedicated nodes + +If you want to manage node groups by the taint and node labels and need the clusters to be deployed on a dedicated host group, you can set tolerations and specify a node label. + +For example, you have a host group for deploying database clusters and this host is added with a taint named `database=true:NoSchedule` and a label `database=true`, then you can follow the command below to create a cluster. + +```bash +kbcli cluster create --node-labels '"databa=true"' --tolerations '"key=database,value=true,operator=Equal,effect=NoSchedule" +``` + +### One node only for one pod + +If you need one cluster only for the online core business and need to ensure every pod of this cluster has its own node to avoid being affected by the cluster of the cluster, you can specify `tenancy` as "DedicatedNode". + +```bash +kbcli cluster create --tenancy=DedicatedNode +``` + +:::note + +This command will be performed successfully based on the prerequisite that you have added taints for these nodes. Otherwise, the business that is not managed by KubeBlocks can still be deployed on these nodes. + +::: + + + diff --git a/docs/user_docs/maintenance/scale/horizontal-scale.md b/docs/user_docs/maintenance/scale/horizontal-scale.md index d69bb3e0cd6..18fad5297a8 100644 --- a/docs/user_docs/maintenance/scale/horizontal-scale.md +++ b/docs/user_docs/maintenance/scale/horizontal-scale.md @@ -160,7 +160,11 @@ You can also edit the cluster YAML file to scale in a specified instance. ```yaml kubectl edit cluster redis -> +``` + +Edit the value of `replicas`. + +```yaml apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: @@ -168,9 +172,9 @@ metadata: spec: componentSpecs: - name: proxy - replicas: 9 + replicas: 9 # Change this value offlineInstances: ["redis-proxy-proxy-2c4g-2"] -# ... +... ``` diff --git a/docs/user_docs/maintenance/scale/vertical-scale.md b/docs/user_docs/maintenance/scale/vertical-scale.md index a09d8a4050f..4df8fd72076 100644 --- a/docs/user_docs/maintenance/scale/vertical-scale.md +++ b/docs/user_docs/maintenance/scale/vertical-scale.md @@ -88,12 +88,13 @@ There are two ways to apply vertical scaling. ```yaml kubectl edit cluster mycluster -n demo + ``` + + Edit the values of `spec.componentSpecs.resources`. + + ```yaml > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: apecloud-mysql clusterVersionRef: ac-mysql-8.0.30 @@ -101,22 +102,14 @@ There are two ways to apply vertical scaling. - 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 corresponding resources change. diff --git a/docs/user_docs/observability/monitor-database.md b/docs/user_docs/observability/monitor-database.md index 18e38554932..d5e6f6e6123 100644 --- a/docs/user_docs/observability/monitor-database.md +++ b/docs/user_docs/observability/monitor-database.md @@ -29,62 +29,7 @@ If you are using KubeBlocks Playground, these addons are enabled by default. - - -1. View all built-in Addons and make sure the monitoring Addons are enabled. If the monitoring Addons are not enabled, [enable these addons](./../installation/install-addons.md) first. - - ```bash - # View all addons supported - kbcli addon list - ... - grafana Helm Enabled true - alertmanager-webhook-adaptor Helm Enabled true - prometheus Helm Enabled alertmanager true - ... - ``` - -2. Check whether the monitoring function of the cluster is enabled. If the monitoring function is enabled, the output shows `disableExporter: false`. - - ```bash - kubectl get cluster mycluster -o yaml - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - ...... - spec: - ...... - componentSpecs: - ...... - disableExporter: false - ``` - - If `disableExporter: false` is not shown in the output, it means the monitoring function of this cluster is not enabled and you need to enable it first. - - ```bash - kbcli cluster update mycluster --disable-exporter=false - ``` - -3. View the dashboard list. - - ```bash - kbcli dashboard list - > - NAME NAMESPACE PORT CREATED-TIME - kubeblocks-grafana kb-system 13000 Jul 24,2023 11:38 UTC+0800 - kubeblocks-prometheus-alertmanager kb-system 19093 Jul 24,2023 11:38 UTC+0800 - kubeblocks-prometheus-server kb-system 19090 Jul 24,2023 11:38 UTC+0800 - ``` - -4. Open and view the web console of a monitoring dashboard. For example, - - ```bash - kbcli dashboard open kubeblocks-grafana - ``` - - - - + #### Enable monitoring addons @@ -121,7 +66,7 @@ Here is an example of enabling the `prometheus` Addon. You can enable other moni helm list -A > NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION - ...... + ... prometheus kb-system 1 2024-05-31 12:01:52.872584 +0800 CST deployed prometheus-15.16.1 2.39.1 ``` @@ -145,7 +90,12 @@ You can also edit the `cluster.yaml` to enable/disable the monitoring function. ```bash kubectl edit cluster mycluster -n demo -...... +``` + +Edit the value of `spec.componentSpecs.disableExporter`. + +```yaml +... componentSpecs: - name: mysql componentDefRef: mysql @@ -191,6 +141,61 @@ If there is no data in the dashboard, you can check whether the job is `kubebloc + + +1. View all built-in Addons and make sure the monitoring Addons are enabled. If the monitoring Addons are not enabled, [enable these addons](./../installation/install-addons.md) first. + + ```bash + # View all addons supported + kbcli addon list + ... + grafana Helm Enabled true + alertmanager-webhook-adaptor Helm Enabled true + prometheus Helm Enabled alertmanager true + ... + ``` + +2. Check whether the monitoring function of the cluster is enabled. If the monitoring function is enabled, the output shows `disableExporter: false`. + + ```bash + kubectl get cluster mycluster -o yaml + > + apiVersion: apps.kubeblocks.io/v1alpha1 + kind: Cluster + metadata: + ... + spec: + ... + componentSpecs: + ... + disableExporter: false + ``` + + If `disableExporter: false` is not shown in the output, it means the monitoring function of this cluster is not enabled and you need to enable it first. + + ```bash + kbcli cluster update mycluster --disable-exporter=false + ``` + +3. View the dashboard list. + + ```bash + kbcli dashboard list + > + NAME NAMESPACE PORT CREATED-TIME + kubeblocks-grafana kb-system 13000 Jul 24,2023 11:38 UTC+0800 + kubeblocks-prometheus-alertmanager kb-system 19093 Jul 24,2023 11:38 UTC+0800 + kubeblocks-prometheus-server kb-system 19090 Jul 24,2023 11:38 UTC+0800 + ``` + +4. Open and view the web console of a monitoring dashboard. For example, + + ```bash + kbcli dashboard open kubeblocks-grafana + ``` + + + ## For production environment @@ -209,31 +214,7 @@ Check whether the monitoring function of the cluster is enabled. If the monitori - - -```bash -kubectl get cluster mycluster -o yaml -> -apiVersion: apps.kubeblocks.io/v1alpha1 -kind: Cluster -metadata: -...... -spec: - ...... - componentSpecs: - ...... - disableExporter: false -``` - -If `disableExporter: false` is not shown in the output, it means the monitoring function of this cluster is not enabled and you need to enable it first. - -```bash -kbcli cluster update mycluster --disable-exporter=false -``` - - - - + If you disable the monitoring function when creating a cluster, run the command below to enable it. @@ -251,7 +232,12 @@ You can also edit the `cluster.yaml` to enable/disable the monitoring function. ```bash kubectl edit cluster mycluster -n demo -...... +``` + +Edit the value of `spec.componentSpecs.disableExporter`. + +```yaml +... componentSpecs: - name: mysql componentDefRef: mysql @@ -264,6 +250,30 @@ componentSpecs: + + +```bash +kubectl get cluster mycluster -o yaml +> +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: Cluster +metadata: +... +spec: + ... + componentSpecs: + ... + disableExporter: false +``` + +If `disableExporter: false` is not shown in the output, it means the monitoring function of this cluster is not enabled and you need to enable it first. + +```bash +kbcli cluster update mycluster --disable-exporter=false +``` + + + ### View the dashboard @@ -276,7 +286,17 @@ Remote write is an optional step and you can enable it based on your actual need - + + +Install the `victoria-metrics-agent` Addon. + +```bash +helm install vm kubeblocks/victoria-metrics-agent --set remoteWriteUrls={http://:/} +``` + + + + 1. Enable data push. @@ -321,14 +341,4 @@ Remote write is an optional step and you can enable it based on your actual need - - -Install the `victoria-metrics-agent` Addon. - -```bash -helm install vm kubeblocks/victoria-metrics-agent --set remoteWriteUrls={http://:/} -``` - - - diff --git a/i18n/zh-cn/user-docs/connect-databases/connect-to-database-in-testing-environment.md b/i18n/zh-cn/user-docs/connect-databases/connect-to-database-in-testing-environment.md index 99456b1e757..455b7b46e10 100644 --- a/i18n/zh-cn/user-docs/connect-databases/connect-to-database-in-testing-environment.md +++ b/i18n/zh-cn/user-docs/connect-databases/connect-to-database-in-testing-environment.md @@ -57,7 +57,7 @@ kbcli cluster connect --show-example --show-password ${cluster-name} 1. 获取 `username`。 - 使用 `kubectl get secrects` 命令,从 demo 命名空间中名为 `mycluster-conn-credential` 的 secret 中提取用户名。 + 使用 `kubectl get secrets` 命令,从 demo 命名空间中名为 `mycluster-conn-credential` 的 secret 中提取用户名。 ```bash kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d diff --git a/i18n/zh-cn/user-docs/installation/install-addons.md b/i18n/zh-cn/user-docs/installation/install-addons.md index 83addd36ddc..90d8d165108 100644 --- a/i18n/zh-cn/user-docs/installation/install-addons.md +++ b/i18n/zh-cn/user-docs/installation/install-addons.md @@ -56,7 +56,7 @@ KubeBlocks v0.8.0 发布后,数据库引擎插件(Addon)与 KubeBlocks 解 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/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md b/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md index d99c04b59b8..af38b14c5b0 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/scale-for-apecloud-mysql.md @@ -107,12 +107,12 @@ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: apecloud-mysql clusterVersionRef: ac-mysql-8.0.30 @@ -304,19 +304,19 @@ mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete ```yaml kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: apecloud-mysql clusterVersionRef: ac-mysql-8.0.30 componentSpecs: - name: mysql componentDefRef: mysql - replicas: 1 # 修改该数值 + replicas: 1 # 修改该参数值 volumeClaimTemplates: - name: data spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md index 682771c0ffb..f7249ed9381 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-apecloud-mysql/cluster-management/stop-start-a-cluster.md @@ -38,15 +38,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 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 @@ -55,16 +54,8 @@ import TabItem from '@theme/TabItem'; - name: mysql componentDefRef: mysql disableExporter: true - replicas: 0 - volumeClaimTemplates: - - name: data - spec: - storageClassName: standard - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi + replicas: 0 # 修改该参数值 + ... ``` @@ -126,15 +117,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值调整为停止集群前的数量,再次启动集群。 ```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 @@ -143,16 +133,8 @@ import TabItem from '@theme/TabItem'; - name: mysql componentDefRef: mysql disableExporter: true - replicas: 3 - volumeClaimTemplates: - - name: data - spec: - storageClassName: standard - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi + replicas: 3 # 修改该参数值 + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md b/i18n/zh-cn/user-docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md index c28f0b217e4..9b585989448 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-elasticsearch/manage-elasticsearch.md @@ -268,11 +268,12 @@ mycluster demo Delete ```yaml kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: elasticsearch clusterVersionRef: elasticsearch-8.8.2 @@ -280,15 +281,7 @@ mycluster demo Delete - name: elasticsearch componentDefRef: elasticsearch replicas: 1 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 @@ -608,29 +601,22 @@ mycluster demo Delete 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: elasticsearch clusterVersionRef: elasticsearch-8.8.2 componentSpecs: - name: elasticsearch componentDefRef: elasticsearch - replicas: 1 # Change the amount - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + replicas: 1 # 修改该参数值 + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/expand-volume.md b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/expand-volume.md index e6d5ca967fa..99f8fa7d2ae 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/expand-volume.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/expand-volume.md @@ -85,7 +85,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -132,7 +132,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/scale.md b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/scale.md index 2426c33acd7..9ad976da6e2 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/scale.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/scale.md @@ -92,7 +92,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: kafka Enabled Logs: @@ -151,7 +151,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: kafka Enabled Logs: @@ -328,7 +328,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: kafka Enabled Logs: @@ -351,14 +351,14 @@ mycluster demo kafka kafka-3.3.2 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: kafka clusterVersionRef: kafka-3.3.2 @@ -366,15 +366,7 @@ mycluster demo kafka kafka-3.3.2 Delete - name: broker componentDefRef: broker replicas: 2 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 @@ -382,7 +374,7 @@ mycluster demo kafka kafka-3.3.2 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: kafka Enabled Logs: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/stop-start-a-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/stop-start-a-cluster.md index 46df7bac770..3de959447cc 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/stop-start-a-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-kafka/cluster-management/stop-start-a-cluster.md @@ -40,16 +40,15 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 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 @@ -58,17 +57,9 @@ import TabItem from '@theme/TabItem'; - name: kafka componentDefRef: kafka disableExporter: true - replicas: 0 - volumeClaimTemplates: - - name: data - spec: - storageClassName: standard - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - ``` + replicas: 0 # 修改该参数值 + ... + ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-milvus/manage-milvus.md b/i18n/zh-cn/user-docs/kubeblocks-for-milvus/manage-milvus.md index faa21bdacc2..33ae8f3274e 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-milvus/manage-milvus.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-milvus/manage-milvus.md @@ -589,13 +589,14 @@ mycluster demo milvus-2.3.2 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.volumeClaimTemplates.spec.resources` 的配置。`spec.componentSpecs.volumeClaimTemplates.spec.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.volumeClaimTemplates.spec.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: milvus clusterVersionRef: milvus-2.3.2 @@ -611,7 +612,7 @@ mycluster demo milvus-2.3.2 Delete resources: requests: storage: 40Gi # 修改磁盘容量 - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相应资源是否变更。 @@ -764,14 +765,14 @@ mycluster demo milvus-2.3.2 Delete + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 Pods。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: milvus clusterVersionRef: milvus-2.3.2 @@ -781,7 +782,7 @@ mycluster demo milvus-2.3.2 Delete componentDefRef: milvus disableExporter: true replicas: 0 # 修改该参数值 - ...... + ... ``` @@ -843,14 +844,14 @@ mycluster demo milvus-2.3.2 Delete + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值改为停止集群前的数值,再次启动集群。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: milvus clusterVersionRef: milvus-2.3.2 @@ -860,7 +861,7 @@ mycluster demo milvus-2.3.2 Delete componentDefRef: milvus disableExporter: true replicas: 1 # 修改该参数值 - ...... + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md b/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md index 15e8cdcb8a4..d7d23b50752 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/expand-volume.md @@ -85,7 +85,7 @@ mycluster demo mongodb mongodb-5.0 Delet ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -131,7 +131,7 @@ mycluster demo mongodb mongodb-5.0 Delet ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/scale-for-a-mongodb-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/scale-for-a-mongodb-cluster.md index 0351cf6e2ce..d1487b50acd 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/scale-for-a-mongodb-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-mongodb/cluster-management/scale-for-a-mongodb-cluster.md @@ -92,7 +92,7 @@ mycluster demo mongodb mongodb-5.0 Delet ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: mongodb Enabled Logs: @@ -115,10 +115,14 @@ mycluster demo mongodb mongodb-5.0 Delet 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - ...... + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: affinity: podAntiAffinity: Preferred @@ -133,13 +137,14 @@ mycluster demo mongodb mongodb-5.0 Delet disableExporter: true name: mongodb replicas: 2 - resources: + resources: # 修改参数值 limits: cpu: "2" memory: 4Gi requests: cpu: "1" memory: 2Gi + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相应资源是否变更。 @@ -147,7 +152,7 @@ mycluster demo mongodb mongodb-5.0 Delet ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: mongodb Enabled Logs: @@ -331,12 +336,12 @@ mycluster demo mongodb mongodb-5.0 Delete ```yaml kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: mongo clusterVersionRef: mongodb-5.0 @@ -344,15 +349,7 @@ mycluster demo mongodb mongodb-5.0 Delete - name: mongo componentDefRef: mongo replicas: 4 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md index 39f1b4363cb..31b2be63813 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/expand-volume.md @@ -84,7 +84,7 @@ mycluster demo mysql mysql-8.0.33 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -132,7 +132,7 @@ mycluster demo mysql mysql-8.0.33 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md index 985d87a1ac1..6a6d5d1f17e 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/scale-for-mysql.md @@ -105,14 +105,14 @@ mycluster demo mysql mysql-8.0.33 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: mysql clusterVersionRef: mysql-8.0.30 @@ -127,15 +127,7 @@ mycluster demo mysql mysql-8.0.33 Delete limits: memory: "4Gi" cpu: "2" - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 40Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后。查看相应资源是否变更。 @@ -298,14 +290,14 @@ mycluster demo mysql mysql-8.0.33 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: mysql clusterVersionRef: mysql-8.0.30 @@ -313,15 +305,7 @@ mycluster demo mysql mysql-8.0.33 Delete - name: mysql componentDefRef: mysql replicas: 1 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md index c1094ae014e..d7829abad8c 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-mysql-community-edition/cluster-management/stop-start-a-cluster.md @@ -38,14 +38,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 Pods。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: mysql clusterVersionRef: mysql-8.0.33 @@ -54,8 +54,8 @@ import TabItem from '@theme/TabItem'; - name: mysql componentDefRef: mysql disableExporter: true - replicas: 0 - ...... + replicas: 0 #修改该参数值 + ... ``` @@ -117,14 +117,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值调整为停止集群前的数量,再次启动集群。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: mysql clusterVersionRef: mysql-8.0.33 @@ -133,8 +133,8 @@ import TabItem from '@theme/TabItem'; - name: mysql componentDefRef: mysql disableExporter: true - replicas: 2 - ...... + replicas: 2 #修改该参数值 + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md index 8aee387cdaa..4663bb86441 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/expand-volume.md @@ -89,7 +89,7 @@ mycluster demo postgresql postgresql-14.8.0 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -137,7 +137,7 @@ mycluster demo postgresql postgresql-14.8.0 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md index 0342e402d61..6c5cb877474 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/scale-for-a-postgresql-cluster.md @@ -98,7 +98,7 @@ mycluster demo postgresql postgresql-14.8.0 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: postgresql Enabled Logs: @@ -121,10 +121,14 @@ mycluster demo postgresql postgresql-14.8.0 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - ...... + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: affinity: podAntiAffinity: Preferred @@ -139,13 +143,14 @@ mycluster demo postgresql postgresql-14.8.0 Delete disableExporter: true name: postgresql replicas: 2 - resources: + resources: # 修改参数值 limits: cpu: "2" memory: 4Gi requests: cpu: "1" memory: 2Gi + ... ``` 2. 当 OpsRequest 状态为 `Succeed` 或集群状态再次回到 `Running` 后,查看相应资源是否变更。 @@ -153,7 +158,7 @@ mycluster demo postgresql postgresql-14.8.0 Delete ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: postgresql Enabled Logs: @@ -327,14 +332,14 @@ mycluster demo postgresql postgresql-14.8.0 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: postgresql clusterVersionRef: postgresql-14.8.0 @@ -342,15 +347,7 @@ mycluster demo postgresql postgresql-14.8.0 Delete - name: postgresql componentDefRef: postgresql replicas: 1 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Halt + ... ``` 2. 当 OpsRequest 状态为 `Succeed` 或集群状态再次回到 `Running` 后,查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md index 3efe7943544..55badca7c87 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-postgresql/cluster-management/start-stop-a-cluster.md @@ -38,14 +38,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 Pods。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: postgresql clusterVersionRef: postgresql-14.8.0 @@ -54,8 +54,8 @@ import TabItem from '@theme/TabItem'; - name: postgresql componentDefRef: postgresql disableExporter: true - replicas: 0 - ...... + replicas: 0 # 修改该参数值 + ... ``` @@ -117,15 +117,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值调整为停止集群前的数量,再次启动集群。 ```yaml - kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster + ... spec: clusterDefinitionRef: postgresql clusterVersionRef: postgresql-14.8.0 @@ -134,8 +133,8 @@ import TabItem from '@theme/TabItem'; - name: mysql componentDefRef: mysql disableExporter: true - replicas: 1 - ...... + replicas: 1 # 修改该参数值 + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/scale-for-a-pulsar-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/scale-for-a-pulsar-cluster.md index 4bb6f748d78..8fdf817288d 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/scale-for-a-pulsar-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/scale-for-a-pulsar-cluster.md @@ -100,10 +100,14 @@ kbcli cluster list mycluster -n demo 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - ...... + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: affinity: podAntiAffinity: Preferred @@ -118,13 +122,14 @@ kbcli cluster list mycluster -n demo disableExporter: true name: pulsar replicas: 1 - resources: + resources: # 修改该参数值 limits: cpu: "2" memory: 4Gi requests: cpu: "1" memory: 2Gi + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相应资源是否变更。 @@ -132,7 +137,7 @@ kbcli cluster list mycluster -n demo ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Component Specs: Component Def Ref: pulsar Enabled Logs: @@ -301,14 +306,14 @@ kbcli cluster list mycluster -n demo 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: pulsar clusterVersionRef: pulsar-3.0.2 @@ -316,6 +321,7 @@ kbcli cluster list mycluster -n demo - name: pulsar componentDefRef: pulsar-proxy replicas: 2 # 修改该参数值 + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md index d27c15f3b41..f9a6ed19a24 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-pulsar/cluster-management/stop-start-a-pulsar-cluster.md @@ -38,14 +38,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 pods。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: pulsar clusterVersionRef: pulsar-3.0.2 @@ -54,8 +54,8 @@ import TabItem from '@theme/TabItem'; - name: pulsar componentDefRef: pulsar disableExporter: true - replicas: 0 - ...... + replicas: 0 # 修改该参数值 + ... ``` @@ -117,14 +117,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值改为停止集群前的数值,再次启动集群。 ```yaml - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ... spec: clusterDefinitionRef: pulsar clusterVersionRef: pulsar-3.0.2 @@ -133,8 +133,8 @@ import TabItem from '@theme/TabItem'; - name: pulsar componentDefRef: pulsar disableExporter: true - replicas: 1 - ...... + replicas: 1 # 修改该参数值 + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-qdrant/manage-qdrant.md b/i18n/zh-cn/user-docs/kubeblocks-for-qdrant/manage-qdrant.md index 24d27cd2d5a..bcfce4fec33 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-qdrant/manage-qdrant.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-qdrant/manage-qdrant.md @@ -306,13 +306,14 @@ mycluster demo qdrant Delete Runn 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: qdrant clusterVersionRef: qdrant-1.8.1 @@ -320,15 +321,7 @@ mycluster demo qdrant Delete Runn - name: qdrant componentDefRef: qdrant replicas: 2 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 @@ -632,13 +625,14 @@ mycluster demo qdrant Delete Runn `spec.componentSpecs.volumeClaimTemplates.spec.resources` 定义了 Pod 的存储资源信息,更改此值会触发磁盘扩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.volumeClaimTemplates.spec.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: qdrant clusterVersionRef: qdrant-1.8.1 @@ -655,6 +649,7 @@ mycluster demo qdrant Delete Runn requests: storage: 40Gi # 修改该参数值 terminationPolicy: Delete + ... ``` 2. 查看对应的集群资源是否变更。 @@ -807,16 +802,14 @@ mycluster demo qdrant Delete Runn + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 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 @@ -825,8 +818,8 @@ mycluster demo qdrant Delete Runn - name: qdrant componentDefRef: qdrant disableExporter: true - replicas: 0 - ...... + replicas: 0 # 修改该参数值 + ... ``` @@ -888,16 +881,14 @@ mycluster demo qdrant Delete Runn + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 修改为停止集群前的数量,再次启动集群。 ```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 @@ -907,7 +898,7 @@ mycluster demo qdrant Delete Runn componentDefRef: qdrant disableExporter: true replicas: 1 - ...... + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/expand-volume.md b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/expand-volume.md index 5dd7768e2b6..2ccf64bb281 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/expand-volume.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/expand-volume.md @@ -91,7 +91,7 @@ mycluster demo redis Delete Runn ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: @@ -148,7 +148,7 @@ mycluster demo redis Delete Runn ```bash kubectl describe cluster mycluster -n demo > - ...... + ... Volume Claim Templates: Name: data Spec: diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md index 03afec5c86e..92b73f830e0 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/scale-for-a-redis-cluster.md @@ -99,14 +99,14 @@ mycluster demo redis Delete Runn 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: redis clusterVersionRef: redis-7.0.6 @@ -121,15 +121,7 @@ mycluster demo redis Delete Runn limits: memory: "4Gi" cpu: "2" - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. 当 OpsRequest 状态为 `Succeed` 或集群状态再次回到 `Running` 后,查看相应资源是否变更。 @@ -303,14 +295,14 @@ mycluster demo redis Delete Runn 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: redis clusterVersionRef: redis-7.0.6 @@ -318,15 +310,7 @@ mycluster demo redis Delete Runn - name: redis componentDefRef: redis replicas: 2 # 修改该参数值 - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - terminationPolicy: Delete + ... ``` 2. 查看相关资源是否变更。 diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md index 1fa78acd0cd..79f3ff85973 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-redis/cluster-management/stop-start-a-redis-cluster.md @@ -38,11 +38,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 设为 0,删除 Pods。 ```yaml - kubectl edit cluster mycluster -n demo - > + ... spec: affinity: podAntiAffinity: Preferred @@ -55,12 +58,12 @@ import TabItem from '@theme/TabItem'; - running disableExporter: true name: redis - replicas: 0 - ...... + replicas: 0 # 修改该参数值 + ... - componentDef: redis-sentinel-7 name: redis-sentinel - replicas: 0 - ...... + replicas: 0 # 修改该参数值 + ... ``` @@ -122,11 +125,14 @@ import TabItem from '@theme/TabItem'; + ```bash + kubectl edit cluster mycluster -n demo + ``` + 将 replicas 数值调整为停止集群前的数量,再次启动集群。 ```yaml - kubectl edit cluster mycluster -n demo - > + ... spec: affinity: podAntiAffinity: Preferred @@ -139,12 +145,12 @@ import TabItem from '@theme/TabItem'; - running disableExporter: true name: redis - replicas: 3 - ...... + replicas: 3 # 修改该参数值 + ... - componentDef: redis-sentinel-7 name: redis-sentinel - replicas: 3 - ...... + replicas: 3 # 修改该参数值 + ... ``` diff --git a/i18n/zh-cn/user-docs/kubeblocks-for-starrocks/manage-starrocks.md b/i18n/zh-cn/user-docs/kubeblocks-for-starrocks/manage-starrocks.md index 1a5b0c4271f..1f301097e79 100644 --- a/i18n/zh-cn/user-docs/kubeblocks-for-starrocks/manage-starrocks.md +++ b/i18n/zh-cn/user-docs/kubeblocks-for-starrocks/manage-starrocks.md @@ -443,13 +443,14 @@ mycluster demo starrocks starrocks-3.1.1 Delete 1. 修改 YAML 文件中 `spec.componentSpecs.replicas` 的配置。`spec.componentSpecs.replicas` 定义了 pod 数量,修改该参数将触发集群水平扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.replicas` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 @@ -457,6 +458,7 @@ mycluster demo starrocks starrocks-3.1.1 Delete - name: fe componentDefRef: fe replicas: 2 # 修改参数值 + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相关资源是否变更。 @@ -592,13 +594,14 @@ mycluster demo starrocks starrocks-3.1.1 Delete `spec.componentSpecs.volumeClaimTemplates.spec.resources` 定义了 Pod 存储资源信息,修改该数值将触发集群磁盘扩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.volumeClaimTemplates.spec.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: starrocks-ce clusterVersionRef: starrocks-ce-3.1.1 @@ -613,7 +616,7 @@ mycluster demo starrocks starrocks-3.1.1 Delete resources: requests: storage: 40Gi # 修改该参数值 - terminationPolicy: Delete + ... ``` 2. 当集群状态再次回到 `Running` 后,查看相应资源是否变更。 diff --git a/i18n/zh-cn/user-docs/maintenance/backup-and-restore/backup/scheduled-backup.md b/i18n/zh-cn/user-docs/maintenance/backup-and-restore/backup/scheduled-backup.md index 77b397adf73..e2c9ea19cf9 100644 --- a/i18n/zh-cn/user-docs/maintenance/backup-and-restore/backup/scheduled-backup.md +++ b/i18n/zh-cn/user-docs/maintenance/backup-and-restore/backup/scheduled-backup.md @@ -37,7 +37,11 @@ kbcli cluster update mysql-cluster --backup-enabled=true \ ```bash kubectl edit cluster -n default mycluster -> +``` + +修改 backup 相关字段的参数值。 + +```yaml spec: ... backup: diff --git a/i18n/zh-cn/user-docs/maintenance/resource-scheduling/resource-scheduling.md b/i18n/zh-cn/user-docs/maintenance/resource-scheduling/resource-scheduling.md index 1eab6591d43..0d6a086d57e 100644 --- a/i18n/zh-cn/user-docs/maintenance/resource-scheduling/resource-scheduling.md +++ b/i18n/zh-cn/user-docs/maintenance/resource-scheduling/resource-scheduling.md @@ -26,7 +26,7 @@ kbcli cluster create -h Create a cluster Examples: - ...... + ... # 创建一个强制分散在节点上的集群 kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname --pod-anti-affinity @@ -44,7 +44,7 @@ Required kbcli cluster create --tenancy=DedicatedNode Options: - ...... + ... --node-labels=[]: Node label selector @@ -59,8 +59,7 @@ Options: --topology-keys=[]: Topology keys for affinity - ...... -....... +... ``` @@ -91,7 +90,7 @@ spec: podAntiAffinity: Required topologyKeys: - kubernetes.io/hostname - ...... +... ``` **YAML 文件中的参数** diff --git a/i18n/zh-cn/user-docs/maintenance/scale/horizontal-scale.md b/i18n/zh-cn/user-docs/maintenance/scale/horizontal-scale.md index 5087329d3e9..2c613f7ba55 100644 --- a/i18n/zh-cn/user-docs/maintenance/scale/horizontal-scale.md +++ b/i18n/zh-cn/user-docs/maintenance/scale/horizontal-scale.md @@ -160,7 +160,11 @@ EOF ```yaml kubectl edit cluster redis -> +``` + +在编辑器中修改 `spec.componentSpecs.replicas` 及 `spec.componentSpecs.offlineInstances` 的参数值。 + +```yaml apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: @@ -170,7 +174,7 @@ spec: - name: proxy replicas: 9 offlineInstances: ["redis-proxy-proxy-2c4g-2"] -# ... +... ``` diff --git a/i18n/zh-cn/user-docs/maintenance/scale/vertical-scale.md b/i18n/zh-cn/user-docs/maintenance/scale/vertical-scale.md index ace975df7e2..9c224e8c214 100644 --- a/i18n/zh-cn/user-docs/maintenance/scale/vertical-scale.md +++ b/i18n/zh-cn/user-docs/maintenance/scale/vertical-scale.md @@ -86,14 +86,14 @@ mycluster mysql mysql-8.0.33 Delete Running 4 1. 修改 YAML 文件中 `spec.componentSpecs.resources` 的配置。`spec.componentSpecs.resources` 控制资源的请求值和限制值,修改参数值将触发垂直扩缩容。 - ```yaml + ```bash kubectl edit cluster mycluster -n demo - > - apiVersion: apps.kubeblocks.io/v1alpha1 - kind: Cluster - metadata: - name: mycluster - namespace: demo + ``` + + 在编辑器中修改 `spec.componentSpecs.resources` 的参数值。 + + ```yaml + ... spec: clusterDefinitionRef: apecloud-mysql clusterVersionRef: ac-mysql-8.0.30 @@ -108,15 +108,7 @@ mycluster mysql mysql-8.0.33 Delete Running 4 limits: memory: "4Gi" cpu: "2" - volumeClaimTemplates: - - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - terminationPolicy: Delete + ... ``` 2. 查看相应资源是否变更。 diff --git a/i18n/zh-cn/user-docs/observability/monitor-database.md b/i18n/zh-cn/user-docs/observability/monitor-database.md index a477a4687d7..3a60ab4b18c 100644 --- a/i18n/zh-cn/user-docs/observability/monitor-database.md +++ b/i18n/zh-cn/user-docs/observability/monitor-database.md @@ -60,11 +60,11 @@ KubeBlocks 以插件(Addon)形式集成了许多开源监控组件,如 Pro apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: - ...... + ... spec: - ...... + ... componentSpecs: - ...... + ... disableExporter: false ``` @@ -130,7 +130,7 @@ KubeBlocks 以插件(Addon)形式集成了许多开源监控组件,如 Pro helm list -A > NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION - ...... + ... prometheus kb-system 1 2024-05-31 12:01:52.872584 +0800 CST deployed prometheus-15.16.1 2.39.1 ``` @@ -148,7 +148,12 @@ kubectl patch cluster mycluster -n demo --type "json" -p '[{"op":"add","path":"/ ```bash kubectl edit cluster mycluster -n demo -...... +``` + +在编辑器中修改 `disableExporter` 的参数值。 + +```yaml +... componentSpecs: - name: mysql componentDefRef: mysql @@ -157,6 +162,7 @@ componentSpecs: - general - slow disableExporter: false # 修改该参数值 +... ``` (可选)如果您想要在使用后关闭监控功能,可执行以下命令停用该功能。 @@ -222,11 +228,11 @@ kubectl get cluster mycluster -o yaml apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: -...... +... spec: - ...... + ... componentSpecs: - ...... + ... disableExporter: false ``` @@ -252,7 +258,12 @@ kubectl patch cluster mycluster -n demo --type "json" -p '[{"op":"add","path":"/ ```bash kubectl edit cluster mycluster -n demo -...... +``` + +在编辑器中修改 `disableExporter` 的参数值。 + +```yaml +... componentSpecs: - name: mysql componentDefRef: mysql @@ -261,6 +272,7 @@ componentSpecs: - general - slow disableExporter: false # 修改该参数值 +... ``` (可选)如果您想要在使用后关闭监控功能,可执行以下命令停用该功能。