diff --git a/docs/examples/mariadb/restart/MariaDB.yaml b/docs/examples/mariadb/restart/MariaDB.yaml new file mode 100644 index 0000000000..87d8365421 --- /dev/null +++ b/docs/examples/mariadb/restart/MariaDB.yaml @@ -0,0 +1,17 @@ +apiVersion: kubedb.com/v1 +kind: MariaDB +metadata: + name: mariadb + namespace: demo +spec: + version: "10.5.23" + replicas: 3 + storageType: Durable + storage: + storageClassName: standard + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut \ No newline at end of file diff --git a/docs/examples/mariadb/restart/ops.yaml b/docs/examples/mariadb/restart/ops.yaml new file mode 100644 index 0000000000..7767997e58 --- /dev/null +++ b/docs/examples/mariadb/restart/ops.yaml @@ -0,0 +1,11 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: MariaDBOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: mariadb + timeout: 3m + apply: Always \ No newline at end of file diff --git a/docs/examples/mysql/restart/mysql.yaml b/docs/examples/mysql/restart/mysql.yaml new file mode 100644 index 0000000000..ffc71227ee --- /dev/null +++ b/docs/examples/mysql/restart/mysql.yaml @@ -0,0 +1,18 @@ +apiVersion: kubedb.com/v1 +kind: MySQL +metadata: + name: mysql + namespace: demo +spec: + version: "8.2.0" + replicas: 3 + topology: + mode: GroupReplication + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut \ No newline at end of file diff --git a/docs/examples/mysql/restart/restart.yaml b/docs/examples/mysql/restart/restart.yaml new file mode 100644 index 0000000000..c0499ec33d --- /dev/null +++ b/docs/examples/mysql/restart/restart.yaml @@ -0,0 +1,11 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: MySQLOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: mysql + timeout: 3m + apply: Always \ No newline at end of file diff --git a/docs/examples/redis/restart/redis.yaml b/docs/examples/redis/restart/redis.yaml new file mode 100644 index 0000000000..b6b4b977c6 --- /dev/null +++ b/docs/examples/redis/restart/redis.yaml @@ -0,0 +1,19 @@ +apiVersion: kubedb.com/v1 +kind: Redis +metadata: + name: redis-cluster + namespace: demo +spec: + version: 8.2.2 + mode: Cluster + cluster: + replicas: 2 + storageType: Durable + storage: + resources: + requests: + storage: 1Gi + storageClassName: standard + accessModes: + - ReadWriteOnce + deletionPolicy: WipeOut \ No newline at end of file diff --git a/docs/examples/redis/restart/restart.yaml b/docs/examples/redis/restart/restart.yaml new file mode 100644 index 0000000000..8fdb3457ee --- /dev/null +++ b/docs/examples/redis/restart/restart.yaml @@ -0,0 +1,10 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: RedisOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: redis-cluster + apply: Always \ No newline at end of file diff --git a/docs/guides/ignite/custom-configuration/using-config-file.md b/docs/guides/ignite/custom-configuration/using-config-file.md index a74133099b..702e9eff1c 100644 --- a/docs/guides/ignite/custom-configuration/using-config-file.md +++ b/docs/guides/ignite/custom-configuration/using-config-file.md @@ -37,13 +37,13 @@ KubeDB supports providing custom configuration for Ignite. This tutorial will sh ## Overview -Ignite does not allows to configuration via any file. However, configuration parameters can be set as arguments while starting the ignite docker image. To keep similarity with other KubeDB supported databases which support configuration through a config file, KubeDB has added an additional executable script on top of the official ignite docker image. This script parses the configuration file then set them as arguments of ignite binary. +Ignite does not allow to configuration via any file. However, configuration parameters can be set as arguments while starting the ignite docker image. To keep similarity with other KubeDB supported databases which support configuration through a config file, KubeDB has added an additional executable script on top of the official ignite docker image. This script parses the configuration file then set them as arguments of ignite binary. -To know more about configuring Ignite server see [here](https://ignite.apache.org/docs/latest/understanding-configuration). +To know more about configuring Ignite server see [here](https://ignite.apache.org/docs/ignite3/latest/administrators-guide/config/node-config). At first, you have to create a config file named `node-configuration.xml` with your desired configuration. Then you have to put this file into a [volume](https://kubernetes.io/docs/concepts/storage/volumes/). You have to specify this volume in `spec.configSecret` section while creating Ignite crd. KubeDB will mount this volume into `/usr/config` directory of the database pod. -In this tutorial, we will enable ignite's [authentication](https://ignite.apache.org/docs/latest/security/authentication) via secret. +In this tutorial, we will enable Ignite's authentication via secret. Create a secret with custom configuration file: ```yaml diff --git a/docs/guides/mariadb/failover/guide.md b/docs/guides/mariadb/failover/guide.md index 74237b58e0..82a90fa1ef 100644 --- a/docs/guides/mariadb/failover/guide.md +++ b/docs/guides/mariadb/failover/guide.md @@ -30,7 +30,7 @@ load balancing supported through `MariaDB MaxScale Server`. >note: Writing to a slave replica may result in a binary log (binlog) conflict issue. -- **Galera Cluster (Multi-`Master`):** +- **Galera Cluster (Multi-Master):** In this setup, all nodes act as `Master`, capable of handling both read and write operations. Since there’s no single point of failure, the system provides synchronous replication and built-in high availability, but doesn’t use the traditional failover concept, as all pods are equal. diff --git a/docs/guides/mariadb/restart/_index.md b/docs/guides/mariadb/restart/_index.md new file mode 100644 index 0000000000..44fbc53e7b --- /dev/null +++ b/docs/guides/mariadb/restart/_index.md @@ -0,0 +1,11 @@ +--- +title: Restart +menu: + docs_{{ .version }}: + identifier: mariadb-restart-details + name: Restart + parent: guides-mariadb + weight: 47 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- \ No newline at end of file diff --git a/docs/guides/mariadb/restart/restart.md b/docs/guides/mariadb/restart/restart.md new file mode 100644 index 0000000000..d71eac68aa --- /dev/null +++ b/docs/guides/mariadb/restart/restart.md @@ -0,0 +1,195 @@ +--- +title: Restart MariaDB +menu: + docs_{{ .version }}: + identifier: mariadb-restart + name: Restart MariaDB + parent: mariadb-restart-details + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Restart MariaDB + +KubeDB supports restarting the MariaDB database via a `MariaDBOpsRequest`. Restarting is useful if some pods are got stuck in some phase, or they are not working correctly. This tutorial will show you how to use that. + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash + $ kubectl create ns demo + namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/MariaDB](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/mariadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy MariaDB + +In this section, we are going to deploy a MariaDB database using KubeDB. + +```yaml +apiVersion: kubedb.com/v1 +kind: MariaDB +metadata: + name: mariadb + namespace: demo +spec: + version: "10.5.23" + replicas: 3 + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut +``` + +Let's create the `MariaDB` CR we have shown above, + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/mariadb/restart/MariaDB.yaml +MariaDB.kubedb.com/mariadb created +``` + +## Apply Restart opsRequest + +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: MariaDBOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: mariadb + timeout: 3m + apply: Always +``` + +- `spec.type` specifies the Type of the ops Request +- `spec.databaseRef` holds the name of the MariaDB database. The db should be available in the same namespace as the opsRequest +- The `spec.timeout` field specifies the maximum amount of time the operator will wait for the operation to complete before marking it as failed. +- The `spec.apply` field determines whether the operation should always be applied (Always) or if the database phase is ready (IfReady). + + +> Note: The method of restarting the standalone & cluster mode db is exactly same as above. All you need, is to specify the corresponding MariaDB name in `spec.databaseRef.name` section. + +Let's create the `MariaDBOpsRequest` CR we have shown above, + + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/mariadb/restart/ops.yaml +MariaDBopsrequest.ops.kubedb.com/restart created +``` + +In `MariaDB`, all pods act as primary, so the Ops-manager operator will restart the pods one by one in sequence. + +```shell +$ kubectl get mariaops -n demo restart +NAME TYPE STATUS AGE +restart Restart Successful 3m25s + + +$ kubectl get mariaops -n demo restart -oyaml +kubectl get mariaops -n demo restart -oyaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: MariaDBOpsRequest +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ops.kubedb.com/v1alpha1","kind":"MariaDBOpsRequest","metadata":{"annotations":{},"name":"restart","namespace":"demo"},"spec":{"apply":"Always","databaseRef":{"name":"mariadb"},"timeout":"3m","type":"Restart"}} + creationTimestamp: "2025-10-14T12:31:09Z" + generation: 1 + name: restart + namespace: demo + resourceVersion: "1004302" + uid: 4e135330-46c4-41cd-aff6-bf2ddb018911 +spec: + apply: Always + databaseRef: + name: mariadb + timeout: 3m + type: Restart +status: + conditions: + - lastTransitionTime: "2025-10-14T12:31:09Z" + message: 'Controller has started to Progress the MariaDBOpsRequest: demo/restart' + observedGeneration: 1 + reason: Running + status: "True" + type: Running + - lastTransitionTime: "2025-10-14T12:31:17Z" + message: evict pod; ConditionStatus:True; PodName:mariadb-0 + observedGeneration: 1 + status: "True" + type: EvictPod--mariadb-0 + - lastTransitionTime: "2025-10-14T12:31:17Z" + message: get pod; ConditionStatus:True; PodName:mariadb-0 + observedGeneration: 1 + status: "True" + type: GetPod--mariadb-0 + - lastTransitionTime: "2025-10-14T12:32:27Z" + message: evict pod; ConditionStatus:True; PodName:mariadb-1 + observedGeneration: 1 + status: "True" + type: EvictPod--mariadb-1 + - lastTransitionTime: "2025-10-14T12:32:27Z" + message: get pod; ConditionStatus:True; PodName:mariadb-1 + observedGeneration: 1 + status: "True" + type: GetPod--mariadb-1 + - lastTransitionTime: "2025-10-14T12:33:37Z" + message: evict pod; ConditionStatus:True; PodName:mariadb-2 + observedGeneration: 1 + status: "True" + type: EvictPod--mariadb-2 + - lastTransitionTime: "2025-10-14T12:33:37Z" + message: get pod; ConditionStatus:True; PodName:mariadb-2 + observedGeneration: 1 + status: "True" + type: GetPod--mariadb-2 + - lastTransitionTime: "2025-10-14T12:34:47Z" + message: 'Successfully started MariaDB pods for MariaDBOpsRequest: demo/restart ' + observedGeneration: 1 + reason: RestartPodsSucceeded + status: "True" + type: Restart + - lastTransitionTime: "2025-10-14T12:34:47Z" + message: Controller has successfully restart the MariaDB replicas + observedGeneration: 1 + reason: Successful + status: "True" + type: Successful + observedGeneration: 1 + phase: Successful + +``` + + +## Cleaning up + +To clean up the Kubernetes resources created by this tutorial, run: + +```bash +kubectl delete mariaops -n demo restart +kubectl delete mariadb -n demo mariadb +kubectl delete ns demo +``` + +## Next Steps + +- Learn about [backup and restore](/docs/guides/mariadb/backup/kubestash/overview/index.md) MariaDBQL database using Stash. +- Learn about initializing [MariaDBQL with Script](/docs/guides/mariadb/initialization/using-script/index.md) +- Detail concepts of [MariaDB object](/docs/guides/mariadb/concepts/mariadb/index.md). +- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md). diff --git a/docs/guides/mysql/autoscaler/_index.md b/docs/guides/mysql/autoscaler/_index.md index ccaff52036..a6da81d75f 100644 --- a/docs/guides/mysql/autoscaler/_index.md +++ b/docs/guides/mysql/autoscaler/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-autoscaling name: Autoscaling parent: guides-mysql - weight: 47 + weight: 190 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/cli/index.md b/docs/guides/mysql/cli/index.md index 1689e7e04c..9c90b91233 100644 --- a/docs/guides/mysql/cli/index.md +++ b/docs/guides/mysql/cli/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-cli name: CLI parent: guides-mysql - weight: 100 + weight: 230 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/clients/index.md b/docs/guides/mysql/clients/index.md index 0ac44fe1cb..2b635b108f 100644 --- a/docs/guides/mysql/clients/index.md +++ b/docs/guides/mysql/clients/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-clients name: Connecting to a MySQL Cluster parent: guides-mysql - weight: 105 + weight: 240 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/clustering/_index.md b/docs/guides/mysql/clustering/_index.md index 5d5c653249..2fffa88e7c 100644 --- a/docs/guides/mysql/clustering/_index.md +++ b/docs/guides/mysql/clustering/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-clustering name: MySQL Clustering parent: guides-mysql - weight: 25 + weight: 30 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/configuration/_index.md b/docs/guides/mysql/configuration/_index.md index 0b57f8f934..c4b8fa7375 100755 --- a/docs/guides/mysql/configuration/_index.md +++ b/docs/guides/mysql/configuration/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-configuration name: Custom Configuration parent: guides-mysql - weight: 30 + weight: 50 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/custom-rbac/index.md b/docs/guides/mysql/custom-rbac/index.md index b6fc93e6df..30a7505e58 100644 --- a/docs/guides/mysql/custom-rbac/index.md +++ b/docs/guides/mysql/custom-rbac/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-custom-rbac name: Custom RBAC parent: guides-mysql - weight: 31 + weight: 60 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/failure-and-disaster-recovery/_index.md b/docs/guides/mysql/failure-and-disaster-recovery/_index.md index 8f5bbeb007..e52542c945 100644 --- a/docs/guides/mysql/failure-and-disaster-recovery/_index.md +++ b/docs/guides/mysql/failure-and-disaster-recovery/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-failure-and-disaster-recovery name: Failure and DR Scenarios parent: guides-mysql - weight: 27 + weight: 40 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/initialization/index.md b/docs/guides/mysql/initialization/index.md index ef391020da..1cdfbc9170 100644 --- a/docs/guides/mysql/initialization/index.md +++ b/docs/guides/mysql/initialization/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-initialization name: Initialization Using Script parent: guides-mysql - weight: 41 + weight: 110 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/migration/_index.md b/docs/guides/mysql/migration/_index.md index 5209ba9da3..d4a67a4e0c 100644 --- a/docs/guides/mysql/migration/_index.md +++ b/docs/guides/mysql/migration/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-migration name: Migration parent: guides-mysql - weight: 43 + weight: 130 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/monitoring/_index.md b/docs/guides/mysql/monitoring/_index.md index 67bd2a2a60..c2ac627484 100755 --- a/docs/guides/mysql/monitoring/_index.md +++ b/docs/guides/mysql/monitoring/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-monitoring name: Monitoring parent: guides-mysql - weight: 50 + weight: 210 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/pitr/_index.md b/docs/guides/mysql/pitr/_index.md index 5e06fcfef5..70d947a1af 100644 --- a/docs/guides/mysql/pitr/_index.md +++ b/docs/guides/mysql/pitr/_index.md @@ -5,6 +5,6 @@ menu: identifier: pitr-mysql name: Point-in-time Recovery parent: guides-mysql - weight: 42 + weight: 85 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/private-registry/index.md b/docs/guides/mysql/private-registry/index.md index 8751a5d102..c54dbec644 100644 --- a/docs/guides/mysql/private-registry/index.md +++ b/docs/guides/mysql/private-registry/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-private-registry name: Private Registry parent: guides-mysql - weight: 35 + weight: 70 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/quickstart/index.md b/docs/guides/mysql/quickstart/index.md index 6aa055ba54..43959dc814 100644 --- a/docs/guides/mysql/quickstart/index.md +++ b/docs/guides/mysql/quickstart/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-mysql-quickstart name: Quickstart parent: guides-mysql - weight: 15 + weight: 10 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/mysql/reconfigure-tls/_index.md b/docs/guides/mysql/reconfigure-tls/_index.md index 32e86d736f..b8e4923dfa 100644 --- a/docs/guides/mysql/reconfigure-tls/_index.md +++ b/docs/guides/mysql/reconfigure-tls/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-reconfigure-tls name: Reconfigure TLS/SSL parent: guides-mysql - weight: 43 + weight: 90 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/reconfigure/_index.md b/docs/guides/mysql/reconfigure/_index.md index a64fcef06b..01f8b8c1d5 100644 --- a/docs/guides/mysql/reconfigure/_index.md +++ b/docs/guides/mysql/reconfigure/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-reconfigure name: Reconfigure parent: guides-mysql - weight: 41 + weight: 80 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/replication-mode-transform/_index.md b/docs/guides/mysql/replication-mode-transform/_index.md index 9ac713975f..152a5ee2e4 100644 --- a/docs/guides/mysql/replication-mode-transform/_index.md +++ b/docs/guides/mysql/replication-mode-transform/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-mode-transform name: MySQL Replication Mode Transform parent: guides-mysql - weight: 49 + weight: 200 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/restart/_index.md b/docs/guides/mysql/restart/_index.md new file mode 100644 index 0000000000..d77893020c --- /dev/null +++ b/docs/guides/mysql/restart/_index.md @@ -0,0 +1,11 @@ +--- +title: Restart +menu: + docs_{{ .version }}: + identifier: mysql-restart-details + name: Restart + parent: guides-mysql + weight: 120 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- \ No newline at end of file diff --git a/docs/guides/mysql/restart/restart.md b/docs/guides/mysql/restart/restart.md new file mode 100644 index 0000000000..b67d7c077c --- /dev/null +++ b/docs/guides/mysql/restart/restart.md @@ -0,0 +1,185 @@ +--- +title: Restart mysql +menu: + docs_{{ .version }}: + identifier: mysql-restart + name: Restart mysql + parent: mysql-restart-details + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Restart MySQL + +KubeDB supports restarting the MySQL database via a `MySQLOpsRequest`. Restarting is useful if some pods are got stuck in some phase, or they are not working correctly. This tutorial will show you how to use that. + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash + $ kubectl create ns demo + namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/mysql](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/mysql) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy MySQL + +In this section, we are going to deploy a MySQL database using KubeDB. + +```yaml +apiVersion: kubedb.com/v1 +kind: MySQL +metadata: + name: mysql + namespace: demo +spec: + version: "8.2.0" + replicas: 3 + topology: + mode: GroupReplication + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut +``` + +Let's create the `mysql` CR we have shown above, + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/mysql/restart/mysql.yaml +mysql.kubedb.com/mysql created +``` + +## Apply Restart opsRequest + +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: MySQLOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: mysql + timeout: 3m + apply: Always +``` + +- `spec.type` specifies the Type of the ops Request +- `spec.databaseRef` holds the name of the MySQL database. The db should be available in the same namespace as the opsRequest +- The `spec.timeout` field specifies the maximum amount of time the operator will wait for the operation to complete before marking it as failed. +- The `spec.apply` field determines whether the operation should always be applied (Always) or if the database phase is ready (IfReady). + +Let's create the `MySQLOpsRequest` CR we have shown above, + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/mysql/restart/restart.yaml +MySQLOpsRequest.ops.kubedb.com/restart created +``` +In MySQL, pods follow a `primary-standby` architecture: + +- `Standby` pods are restarted **first**, one by one. +- The `primary` pod is restarted last. +- During the primary pod restart, one of the standby pods is automatically promoted to primary to ensure continuous availability. + +Now, let's see the status of the `MySQLOpsRequest` we just created. +```shell +$ kubectl get myops -n demo +NAME TYPE STATUS AGE +restart Restart Successful 64m + +$ kubectl get myops -n demo restart -oyaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: MySQLOpsRequest +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ops.kubedb.com/v1alpha1","kind":"MySQLOpsRequest","metadata":{"annotations":{},"name":"restart","namespace":"demo"},"spec":{"apply":"Always","databaseRef":{"name":"mysql"},"timeout":"3m","type":"Restart"}} + creationTimestamp: "2025-10-15T11:19:36Z" + generation: 1 + name: restart + namespace: demo + resourceVersion: "1031419" + uid: 9e63a9aa-14da-432d-a972-d4e8561dcba5 +spec: + apply: Always + databaseRef: + name: mysql + timeout: 3m + type: Restart +status: + conditions: + - lastTransitionTime: "2025-10-15T11:19:36Z" + message: 'Controller has started to Progress the MySQLOpsRequest: demo/restart' + observedGeneration: 1 + reason: Running + status: "True" + type: Running + - lastTransitionTime: "2025-10-15T11:19:44Z" + message: evict pod; ConditionStatus:True + observedGeneration: 1 + status: "True" + type: EvictPod + - lastTransitionTime: "2025-10-15T11:21:54Z" + message: is pod ready; ConditionStatus:True + observedGeneration: 1 + status: "True" + type: IsPodReady + - lastTransitionTime: "2025-10-15T11:21:59Z" + message: is join in cluster; ConditionStatus:True + observedGeneration: 1 + status: "True" + type: IsJoinInCluster + - lastTransitionTime: "2025-10-15T11:21:19Z" + message: switch primary; ConditionStatus:True + observedGeneration: 1 + status: "True" + type: SwitchPrimary + - lastTransitionTime: "2025-10-15T11:21:59Z" + message: 'Successfully started MySQL pods for MySQLOpsRequest: demo/restart ' + observedGeneration: 1 + reason: RestartPodsSucceeded + status: "True" + type: Restart + - lastTransitionTime: "2025-10-15T11:21:59Z" + message: Controller has successfully restart the MySQL replicas + observedGeneration: 1 + reason: Successful + status: "True" + type: Successful + observedGeneration: 1 + phase: Successful + +``` + + +## Cleaning up + +To clean up the Kubernetes resources created by this tutorial, run: + +```bash +kubectl delete myops -n demo restart +kubectl delete mysql -n demo mysql +kubectl delete ns demo +``` + +## Next Steps + +- Learn about [backup and restore](/docs/guides/mysql/backup/kubestash/overview/index.md) mysqlQL database using Stash. +- Learn about initializing [mysqlQL with Script](/docs/guides/mysql/initialization/index.md) +- Detail concepts of [mysql object](/docs/guides/mysql/concepts/mysqldatabase/index.md). +- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md). diff --git a/docs/guides/mysql/rotate-auth/_index.md b/docs/guides/mysql/rotate-auth/_index.md index a0708e5797..0dfdf9bb23 100644 --- a/docs/guides/mysql/rotate-auth/_index.md +++ b/docs/guides/mysql/rotate-auth/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-rotate-auth name: Rotate Authentication parent: guides-mysql - weight: 43 + weight: 150 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/scaling/_index.md b/docs/guides/mysql/scaling/_index.md index 2e55378ae4..58367f7fa1 100644 --- a/docs/guides/mysql/scaling/_index.md +++ b/docs/guides/mysql/scaling/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-scaling name: Scaling MySQL parent: guides-mysql - weight: 43 + weight: 160 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/schema-manager/_index.md b/docs/guides/mysql/schema-manager/_index.md index c8a4469431..98c45456ad 100644 --- a/docs/guides/mysql/schema-manager/_index.md +++ b/docs/guides/mysql/schema-manager/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-schema-manager name: Schema Manager parent: guides-mysql - weight: 55 + weight: 220 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/mysql/tls/_index.md b/docs/guides/mysql/tls/_index.md index 46288aab13..5b20f25cd7 100644 --- a/docs/guides/mysql/tls/_index.md +++ b/docs/guides/mysql/tls/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-tls name: TLS/SSL Encryption parent: guides-mysql - weight: 45 + weight: 170 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/update-version/_index.md b/docs/guides/mysql/update-version/_index.md index b603c5eb98..017e92385a 100644 --- a/docs/guides/mysql/update-version/_index.md +++ b/docs/guides/mysql/update-version/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-updating name: UpdateVersion MySQL parent: guides-mysql - weight: 42 + weight: 88 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/mysql/volume-expansion/_index.md b/docs/guides/mysql/volume-expansion/_index.md index e2af8446c5..176b732235 100644 --- a/docs/guides/mysql/volume-expansion/_index.md +++ b/docs/guides/mysql/volume-expansion/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-mysql-volume-expansion name: MySQL Volume Expansion parent: guides-mysql - weight: 46 + weight: 180 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/percona-xtradb/failover/_index.md b/docs/guides/percona-xtradb/failover/_index.md index 468c45451c..3f97aec5aa 100644 --- a/docs/guides/percona-xtradb/failover/_index.md +++ b/docs/guides/percona-xtradb/failover/_index.md @@ -1,10 +1,10 @@ --- -title: Failover PerconaXtraDB +title: PerconaXtraDB Failover menu: docs_{{ .version }}: - identifier: guides-perconaxtradb-failover + identifier: guides-perconaxtradb-Failover name: Failover and Disaster Recovery parent: guides-perconaxtradb weight: 46 menu_name: docs_{{ .version }} ---- +--- \ No newline at end of file diff --git a/docs/guides/percona-xtradb/failover/overview.md b/docs/guides/percona-xtradb/failover/overview.md index 3cf629f2e1..de8cec7f1d 100644 --- a/docs/guides/percona-xtradb/failover/overview.md +++ b/docs/guides/percona-xtradb/failover/overview.md @@ -1,11 +1,12 @@ --- -title: PerconaXtraDB Failover and DR Scenarios +title: PerconaXtraDB Failover Overview +description: PerconaXtraDB Failover Overview menu: -docs_{{ .version }}: -identifier: guides-perconaxtradb-failure-and-disaster-recovery-overview -name: Overview -parent: guides-perconaxtradb-failover -weight: 20 + docs_{{ .version }}: + identifier: guides-perconaxtradb-Failover-overview + name: Overview + parent: guides-perconaxtradb-Failover + weight: 10 menu_name: docs_{{ .version }} section_menu_id: guides --- @@ -286,13 +287,6 @@ mysql: [Warning] Using a password on the command line interface can be insecure. ``` -**Why this fixes the mistake:** - -* We replaced the misleading heading "Delete the Primary Node" with an explicit and accurate description: "Delete a single node". -* We added the exact `kubectl delete pod` command so the step actually performs the deletion. -* We included the expected `kubectl get pods` outputs **immediately after deletion**, **during recreation**, and **after readiness** so readers can confirm the cluster state. -* We added `wsrep_cluster_size` checks to show Galera membership changes while a node is down and after it rejoins. - #### Case 2: Delete two nodes (Kept and clarified from the original doc.) Example commands and expected behavior: diff --git a/docs/guides/percona-xtradb/restart/index.md b/docs/guides/percona-xtradb/restart/index.md new file mode 100644 index 0000000000..d4dfadf237 --- /dev/null +++ b/docs/guides/percona-xtradb/restart/index.md @@ -0,0 +1,307 @@ +--- +title: Restart PerconaXtraDB +menu: + docs_{{ .version }}: + identifier: guides-perconaxtradb-Restart + name: Restart + parent: guides-perconaxtradb + weight: 47 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- +> New to KubeDB? Please start [here](/docs/README.md). + +# Restart PerconaXtraDB + +KubeDB supports restarting a PerconaXtraDB database using a `PerconaXtraDBOpsRequest`. Restarting can be +useful if some pods are stuck in a certain state or not functioning correctly. + +This guide will demonstrate how to restart a PerconaXtraDB cluster using an OpsRequest. + +--- + +## Before You Begin + +- You need a running Kubernetes cluster and a properly configured `kubectl` command-line tool. If you don’t have a cluster, you can create one using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Install the KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the [installation steps](/docs/setup/README.md). + +- For better isolation, this tutorial uses a separate namespace called `demo`: + +```bash +kubectl create ns demo +namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/PerconaXtraDB](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/PerconaXtraDB) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy PerconaXtraDB + +In this section, we are going to deploy a PerconaXtraDB database using KubeDB. + +```yaml +apiVersion: kubedb.com/v1 +kind: PerconaXtraDB +metadata: + name: pxc + namespace: demo +spec: + version: "8.0.40" + replicas: 3 + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut +``` + +Let's create the `PerconaXtraDB` CR we have shown above, + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/percona-xtradb/restart/yamls/pxc.yaml +PerconaXtraDB.kubedb.com/PerconaXtraDB created +``` +let's wait until all pods are in the `Running` state, + +```shell +kubectl get pods -n demo +NAME READY STATUS RESTARTS AGE +pxc-0 2/2 Running 0 6m28s +pxc-1 2/2 Running 0 6m28s +pxc-2 2/2 Running 0 6m28s +``` +let's check database is ready to accept connections, + +```bash +$ kubectl get secrets -n demo pxc-auth -o jsonpath='{.data.\username}' | base64 -d +root⏎ banusree@bonusree-datta-PC ~> kubectl get secrets -n demo pxc-auth -o jsonpath='{.data.\password}' | base64 -d +kP!VVJ2e~DUtcD*D⏎ banusree@bonusree-datta-PC ~> kubectl exec -it -n demo sample-pxc-0 -- mysql -u root --password='kP!VVJ2e~DUtcD*D' +Error from server (NotFound): pods "sample-pxc-0" not found +banusree@bonusree-datta-PC ~ [1]> kubectl exec -it -n demo pxc-0 -- mysql -u root --password='kP!VVJ2e~DUtcD*D' +Defaulted container "perconaxtradb" out of: perconaxtradb, px-coordinator, px-init (init) +mysql: [Warning] Using a password on the command line interface can be insecure. +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 651 +Server version: 8.0.40-31.1 Percona XtraDB Cluster (GPL), Release rel31, Revision 4b32153, WSREP version 26.1.4.3 + +Copyright (c) 2009-2024 Percona LLC and/or its affiliates +Copyright (c) 2000, 2024, Oracle and/or its affiliates. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql> show databases; ++--------------------+ +| Database | ++--------------------+ +| information_schema | +| kubedb_system | +| mysql | +| performance_schema | +| sys | ++--------------------+ +5 rows in set (0.01 sec) + +mysql> CREATE DATABASE shastriya; +Query OK, 1 row affected (0.02 sec) + +mysql> exit +Bye +``` + + +# Apply Restart opsRequest + +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: PerconaXtraDBOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: pxc + timeout: 3m + apply: Always +``` + +Here, + +- `spec.type` specifies the type of operation (Restart in this case). + +- `spec.databaseRef` references the PerconaXtraDB database. The OpsRequest must be created in the same namespace as the database. + +- `spec.timeout` the maximum time the operator will wait for the operation to finish before marking it as failed. + +- `spec.apply` determines whether to always apply the operation (Always) or if the database phase is ready (IfReady). + +Let's create the `PerconaXtraDBOpsRequest` CR we have shown above, + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/percona-xtradb/restart/yamls/restart.yaml +PerconaXtraDBOpsRequest.ops.kubedb.com/restart created +``` + +In a PerconaXtraDB cluster, all pods act as primary nodes. When you apply a restart OpsRequest, the KubeDB operator will restart the pods sequentially, one by one, to maintain cluster availability. + +Let's watch the rolling restart process with: +```shell +NAME READY STATUS RESTARTS AGE +pxc-0 2/2 Terminating 0 56m +pxc-1 2/2 Running 0 55m +pxc-2 2/2 Running 0 54m +``` + +```shell +NAME READY STATUS RESTARTS AGE +pxc-0 2/2 Running 0 112s +pxc-1 2/2 Terminating 0 55m +pxc-2 2/2 Running 0 56m + +``` +```shell +NAME READY STATUS RESTARTS AGE +pxc-0 2/2 Running 0 112s +pxc-1 2/2 Running 0 42s +pxc-2 2/2 Terminating 0 56m + +``` + +```shell +$ kubectl get PerconaXtraDBopsrequest -n demo +NAME TYPE STATUS AGE +restart Restart Successful 64m + +$ kubectl get PerconaXtraDBopsrequest -n demo restart -oyaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: PerconaXtraDBOpsRequest +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ops.kubedb.com/v1alpha1","kind":"PerconaXtraDBOpsRequest","metadata":{"annotations":{},"name":"restart","namespace":"demo"},"spec":{"apply":"Always","databaseRef":{"name":"pxc"},"timeout":"3m","type":"Restart"}} + creationTimestamp: "2025-10-17T05:45:40Z" + generation: 1 + name: restart + namespace: demo + resourceVersion: "22350" + uid: c6ef7130-9a31-4f64-ae49-1b4e332f0817 +spec: + apply: Always + databaseRef: + name: pxc + timeout: 3m + type: Restart +status: + conditions: + - lastTransitionTime: "2025-10-17T05:45:41Z" + message: 'Controller has started to Progress the PerconaXtraDBOpsRequest: demo/restart' + observedGeneration: 1 + reason: Running + status: "True" + type: Running + - lastTransitionTime: "2025-10-17T05:45:49Z" + message: evict pod; ConditionStatus:True; PodName:pxc-0 + observedGeneration: 1 + status: "True" + type: EvictPod--pxc-0 + - lastTransitionTime: "2025-10-17T05:45:49Z" + message: get pod; ConditionStatus:True; PodName:pxc-0 + observedGeneration: 1 + status: "True" + type: GetPod--pxc-0 + - lastTransitionTime: "2025-10-17T05:46:59Z" + message: evict pod; ConditionStatus:True; PodName:pxc-1 + observedGeneration: 1 + status: "True" + type: EvictPod--pxc-1 + - lastTransitionTime: "2025-10-17T05:46:59Z" + message: get pod; ConditionStatus:True; PodName:pxc-1 + observedGeneration: 1 + status: "True" + type: GetPod--pxc-1 + - lastTransitionTime: "2025-10-17T05:48:09Z" + message: evict pod; ConditionStatus:True; PodName:pxc-2 + observedGeneration: 1 + status: "True" + type: EvictPod--pxc-2 + - lastTransitionTime: "2025-10-17T05:48:09Z" + message: get pod; ConditionStatus:True; PodName:pxc-2 + observedGeneration: 1 + status: "True" + type: GetPod--pxc-2 + - lastTransitionTime: "2025-10-17T05:49:19Z" + message: 'Successfully started PerconaXtraDB pods for PerconaXtraDBOpsRequest: + demo/restart ' + observedGeneration: 1 + reason: RestartPodsSucceeded + status: "True" + type: Restart + - lastTransitionTime: "2025-10-17T05:49:19Z" + message: Controller has successfully restart the PerconaXtraDB replicas + observedGeneration: 1 + reason: Successful + status: "True" + type: Successful + observedGeneration: 1 + phase: Successful + +``` +**Verify Data Persistence** + +After the restart, reconnect to the database and verify that the previously created database still exists: + +```bash +$ kubectl exec -it -n demo pxc-0 -- mysql -u root --password='kP!VVJ2e~DUtcD*D' +Defaulted container "perconaxtradb" out of: perconaxtradb, px-coordinator, px-init (init) +mysql: [Warning] Using a password on the command line interface can be insecure. +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 112 +Server version: 8.0.40-31.1 Percona XtraDB Cluster (GPL), Release rel31, Revision 4b32153, WSREP version 26.1.4.3 + +Copyright (c) 2009-2024 Percona LLC and/or its affiliates +Copyright (c) 2000, 2024, Oracle and/or its affiliates. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql> show databases; ++--------------------+ +| Database | ++--------------------+ +| information_schema | +| kubedb_system | +| mysql | +| performance_schema | +| shastriya | +| sys | ++--------------------+ +6 rows in set (0.02 sec) + +mysql> exit +Bye +``` +## Cleaning up + +To clean up the Kubernetes resources created by this tutorial, run: + +```bash +kubectl delete PerconaXtraDBopsrequest -n demo restart +kubectl delete PerconaXtraDB -n demo PerconaXtraDB +kubectl delete ns demo +``` + +## Next Steps + +- Detail concepts of [PerconaXtraDB object](/docs/guides/percona-xtradb/concepts/perconaxtradb/index.md). +- Detail concepts of [PerconaXtraDBopsRequest object](/docs/guides/percona-xtradb/concepts/opsrequest/index.md). +- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md).. diff --git a/docs/guides/percona-xtradb/restart/yamls/pxc.yaml b/docs/guides/percona-xtradb/restart/yamls/pxc.yaml new file mode 100644 index 0000000000..72e9ff26c0 --- /dev/null +++ b/docs/guides/percona-xtradb/restart/yamls/pxc.yaml @@ -0,0 +1,17 @@ +apiVersion: kubedb.com/v1 +kind: PerconaXtraDB +metadata: + name: pxc + namespace: demo +spec: + version: "8.0.40" + replicas: 3 + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut \ No newline at end of file diff --git a/docs/guides/percona-xtradb/restart/yamls/restart.yaml b/docs/guides/percona-xtradb/restart/yamls/restart.yaml new file mode 100644 index 0000000000..193e8b13e8 --- /dev/null +++ b/docs/guides/percona-xtradb/restart/yamls/restart.yaml @@ -0,0 +1,11 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: PerconaXtraDBOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: pxc + timeout: 3m + apply: Always \ No newline at end of file diff --git a/docs/guides/percona-xtradb/rotateauth/rotateauth.md b/docs/guides/percona-xtradb/rotateauth/rotateauth.md index 9a70d2e8bc..902f5fbff6 100644 --- a/docs/guides/percona-xtradb/rotateauth/rotateauth.md +++ b/docs/guides/percona-xtradb/rotateauth/rotateauth.md @@ -99,7 +99,7 @@ Forwarding from [::1]:11211 -> 11211 ``` Now, you can exec into the pod `sample-pxc` and connect to database using `username` and `password` ```shell -kubectl exec -it -n demo sample-pxc-0 -- mysql -u root --password='Q!IsZ7.NXM.ZIxvT' +$ kubectl exec -it -n demo sample-pxc-0 -- mysql -u root --password='Q!IsZ7.NXM.ZIxvT' Defaulted container "perconaxtradb" out of: perconaxtradb, px-coordinator, px-init (init) mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. diff --git a/docs/guides/proxysql/autoscaler/_index.md b/docs/guides/proxysql/autoscaler/_index.md index 825fa8876d..4660f0147b 100644 --- a/docs/guides/proxysql/autoscaler/_index.md +++ b/docs/guides/proxysql/autoscaler/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-autoscaling name: Autoscaling parent: guides-proxysql - weight: 46 + weight: 140 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/backends/_index.md b/docs/guides/proxysql/backends/_index.md index 9ec1e9f7ac..237eabdbf9 100644 --- a/docs/guides/proxysql/backends/_index.md +++ b/docs/guides/proxysql/backends/_index.md @@ -5,6 +5,6 @@ menu: identifier: proxysql-backends name: Backends parent: guides-proxysql - weight: 25 + weight: 50 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/proxysql/backends/xtradb-galera/kubedb/index.md b/docs/guides/proxysql/backends/xtradb-galera/kubedb/index.md index f47473cf2a..2e82f25271 100644 --- a/docs/guides/proxysql/backends/xtradb-galera/kubedb/index.md +++ b/docs/guides/proxysql/backends/xtradb-galera/kubedb/index.md @@ -140,7 +140,7 @@ spec: ``` ```bash -$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/backends/xtradb-galera/kubedb/examples/xtradb-galera.yaml +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/backends/xtradb-galera/kubedb/examples/xtradb-proxy.yaml proxysql.kubedb.com/xtradb-proxy created ``` diff --git a/docs/guides/proxysql/clustering/_index.md b/docs/guides/proxysql/clustering/_index.md index af461677f5..1919860e76 100644 --- a/docs/guides/proxysql/clustering/_index.md +++ b/docs/guides/proxysql/clustering/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-clustering name: ProxySQL Clustering parent: guides-proxysql - weight: 30 + weight: 40 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/proxysql/concepts/_index.md b/docs/guides/proxysql/concepts/_index.md index b3ae3f63f2..9e24aae8af 100644 --- a/docs/guides/proxysql/concepts/_index.md +++ b/docs/guides/proxysql/concepts/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-concepts name: Concepts parent: guides-proxysql - weight: 10 + weight: 30 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/concepts/opsrequest/index.md b/docs/guides/proxysql/concepts/opsrequest/index.md index ce1ab2618a..0aab3cbdc6 100644 --- a/docs/guides/proxysql/concepts/opsrequest/index.md +++ b/docs/guides/proxysql/concepts/opsrequest/index.md @@ -152,7 +152,20 @@ spec: rotateCertificates: true ``` - +**Sample ProxySQLOpsRequest Objects for Restart of the ProxySQL:** +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: ProxySQLOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + proxyRef: + name: mysql-proxy + timeout: 3m + apply: Always +``` Here, we are going to describe the various sections of a `ProxySQLOpsRequest` crd. A `ProxySQLOpsRequest` object has the following fields in the `spec` section. @@ -175,6 +188,14 @@ A `ProxySQLOpsRequest` object has the following fields in the `spec` section. - `Restart` > You can perform only one type of operation on a single `ProxySQLOpsRequest` CR. For example, if you want to update your proxysql and scale up its replica then you have to create two separate `ProxySQLOpsRequest`. At first, you have to create a `ProxySQLOpsRequest` for updating. Once it is completed, then you can create another `ProxySQLOpsRequest` for scaling. You should not create two `ProxySQLOpsRequest` simultaneously. +### spec.timeout + +`spec.timeout` the maximum time the operator will wait for the operation to finish before marking it as failed. + +### spec.apply + +`spec.apply` determines whether to always apply the operation (Always) or only if there are changes (IfReady). + ### spec.updateVersion diff --git a/docs/guides/proxysql/custom-rbac/index.md b/docs/guides/proxysql/custom-rbac/index.md index 4d83247dc0..0c9b79c162 100644 --- a/docs/guides/proxysql/custom-rbac/index.md +++ b/docs/guides/proxysql/custom-rbac/index.md @@ -5,7 +5,7 @@ menu: identifier: guides-proxysql-custom-rbac name: Custom RBAC parent: guides-proxysql - weight: 31 + weight: 80 menu_name: docs_{{ .version }} section_menu_id: guides --- diff --git a/docs/guides/proxysql/monitoring/_index.md b/docs/guides/proxysql/monitoring/_index.md index 759e5afbff..5d75e045d3 100644 --- a/docs/guides/proxysql/monitoring/_index.md +++ b/docs/guides/proxysql/monitoring/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-monitoring name: Monitoring parent: guides-proxysql -weight: 120 +weight: 70 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/reconfigure-tls/_index.md b/docs/guides/proxysql/reconfigure-tls/_index.md index 204427d0e5..321fc429f7 100644 --- a/docs/guides/proxysql/reconfigure-tls/_index.md +++ b/docs/guides/proxysql/reconfigure-tls/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-reconfigure-tls name: Reconfigure TLS/SSL parent: guides-proxysql - weight: 46 + weight: 110 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/reconfigure/_index.md b/docs/guides/proxysql/reconfigure/_index.md index b1b94a7928..be944afe6c 100644 --- a/docs/guides/proxysql/reconfigure/_index.md +++ b/docs/guides/proxysql/reconfigure/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-reconfigure name: Reconfigure parent: guides-proxysql - weight: 46 + weight: 100 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/restart/examples/restart.yaml b/docs/guides/proxysql/restart/examples/restart.yaml new file mode 100644 index 0000000000..b3fb71ff0d --- /dev/null +++ b/docs/guides/proxysql/restart/examples/restart.yaml @@ -0,0 +1,11 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: ProxySQLOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + proxyRef: + name: mysql-proxy + timeout: 3m + apply: Always \ No newline at end of file diff --git a/docs/guides/proxysql/restart/index.md b/docs/guides/proxysql/restart/index.md new file mode 100644 index 0000000000..b4fdb88fc9 --- /dev/null +++ b/docs/guides/proxysql/restart/index.md @@ -0,0 +1,273 @@ +--- +title: Restart +menu: + docs_{{ .version }}: + identifier: guides-proxysql-restart + name: Restart ProxySQL + parent: guides-proxysql + weight: 90 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Restart ProxySQL + +KubeDB supports restarting the ProxySQL database via a `ProxySQLOpsRequest`. Restarting is useful if some pods are stuck in an unexpected phase or not functioning correctly. This tutorial will show you how to use a `ProxySQLOpsRequest` to restart ProxySQL. + +## Before You Begin + +- You need to have a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Install KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash +$ kubectl create ns demo +namespace/demo created +``` +> Note: YAML files used in this tutorial are stored in the [docs/examples/proxysql](https://github.com/kubedb/docs/tree/{{ +< param "info.version" >}}/docs/examples/proxysql) folder in the GitHub repository kubedb/docs. + +## Prepare MySQL Backend + +In this tutorial we are going to set up ProxySQL using KubeDB for a MySQL Group Replication. We will use KubeDB to set up our MySQL servers. + +We need to apply the following yaml to create our MySQL Group Replication +`Note`: If your `KubeDB version` is less or equal to `v2024.6.4`, You have to use `kubedb.com/v1alpha2` apiVersion. + +```yaml +apiVersion: kubedb.com/v1 +kind: MySQL +metadata: + name: mysql-server + namespace: demo +spec: + version: "8.4.3" + replicas: 3 + topology: + mode: GroupReplication + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + deletionPolicy: WipeOut +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/backends/mysql/examples/sample-mysql.yaml +mysql.kubedb.com/mysql-server created +``` + +Let's wait for the MySQL to be Ready. + +```bash +$ kubectl get my -n demo +NAME VERSION STATUS AGE +mysql-server 8.4.3 Ready 7m6s +``` +> Here you can use MariaDB or PerconXtraDB as well as backend. Have a look at other [ProxySQL backend examples](https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/backends/) + +Now we are ready to deploy and test our ProxySQL server. + +## Deploy ProxySQL Server + +With the following yaml we are going to create our desired ProxySQL server. + +`Note`: If your `KubeDB version` is less or equal to `v2024.6.4`, You have to use `kubedb.com/v1alpha2` apiVersion. + +```yaml +apiVersion: kubedb.com/v1 +kind: ProxySQL +metadata: + name: mysql-proxy + namespace: demo +spec: + version: "2.7.3-debian" + replicas: 3 + syncUsers: true + backend: + name: mysql-server + deletionPolicy: WipeOut +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/backends/mysql/examples/sample-proxysql.yaml +proxysql.kubedb.com/mysql-proxy created +``` + + +Let's wait for the ProxySQL to be Ready. + +```bash +$ kubectl get proxysql -n demo +NAME VERSION STATUS AGE +mysql-proxy 2.7.3-debian Ready 3m45s +``` +## Apply Restart opsRequest +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: ProxySQLOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + proxyRef: + name: mysql-proxy + timeout: 3m + apply: Always +``` + +> For details on the fields of ProxySQLOpsRequest, please visit to the [ProxySQLOpsRequest API reference](/docs/guides/proxysql/concepts/opsrequest/index.md) + +Let's create the `ProxySQLOpsRequest` CR we have shown above, + +```bash +kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/proxysql/restart/examples/restart.yaml +proxysql.kubedb.com/restart created +``` +let's see how the pods are restarting + +```shell +kubectl get pods -n demo -w +NAME READY STATUS RESTARTS AGE +mysql-proxy-0 1/1 Running 0 46s +mysql-proxy-1 1/1 Running 0 21s +mysql-proxy-2 1/1 Running 0 20s +mysql-server-0 2/2 Running 0 12m +mysql-server-1 2/2 Running 0 11m +mysql-server-2 2/2 Running 0 11m +mysql-proxy-0 1/1 Running 0 3m23s +mysql-proxy-0 1/1 Terminating 0 3m23s +mysql-proxy-0 1/1 Terminating 0 3m23s + +``` + +```shell +NAME READY STATUS RESTARTS AGE +mysql-proxy-0 1/1 Running 0 6s +mysql-proxy-1 1/1 Running 0 3m35s +mysql-proxy-2 1/1 Running 0 3m34s +mysql-server-0 2/2 Running 0 15m +mysql-server-1 2/2 Running 0 14m +mysql-server-2 2/2 Running 0 14m +mysql-proxy-2 1/1 Running 0 3m48s +mysql-proxy-2 1/1 Terminating 0 3m48s +mysql-proxy-2 1/1 Terminating 0 3m48s + +``` +After some time all the pods will be restarted successfully. +```shell + +NAME READY STATUS RESTARTS AGE +mysql-proxy-0 1/1 Running 0 114s +mysql-proxy-1 1/1 Running 0 74s +mysql-proxy-2 1/1 Running 0 34s +mysql-server-0 2/2 Running 0 17m +mysql-server-1 2/2 Running 0 16m +mysql-server-2 2/2 Running 0 16m + +``` +Now let's check the status of our `ProxySQLOpsRequest` and the Yaml output of the created `ProxySQLOpsRequest` CR. +```shell +$ kubectl get Proxysqlopsrequest -n demo +NAME TYPE STATUS AGE +restart Restart Successful 31m + +$ kubectl get Proxysqlopsrequest -n demo restart -oyaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: ProxySQLOpsRequest +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ops.kubedb.com/v1alpha1","kind":"ProxySQLOpsRequest","metadata":{"annotations":{},"name":"restart","namespace":"demo"},"spec":{"apply":"Always","proxyRef":{"name":"mysql-proxy"},"timeout":"3m","type":"Restart"}} + creationTimestamp: "2025-10-20T06:38:39Z" + generation: 1 + name: restart + namespace: demo + resourceVersion: "104283" + uid: e76276f1-6682-41f9-a5a2-81ed54903556 +spec: + apply: Always + proxyRef: + name: mysql-proxy + timeout: 3m + type: Restart +status: + conditions: + - lastTransitionTime: "2025-10-20T06:38:39Z" + message: 'Controller has started to Progress the ProxySQLOpsRequest: demo/restart' + observedGeneration: 1 + reason: Running + status: "True" + type: Running + - lastTransitionTime: "2025-10-20T06:38:47Z" + message: evict pod; ConditionStatus:True; PodName:mysql-proxy-0 + observedGeneration: 1 + status: "True" + type: EvictPod--mysql-proxy-0 + - lastTransitionTime: "2025-10-20T06:38:47Z" + message: get pod; ConditionStatus:True; PodName:mysql-proxy-0 + observedGeneration: 1 + status: "True" + type: GetPod--mysql-proxy-0 + - lastTransitionTime: "2025-10-20T06:39:27Z" + message: evict pod; ConditionStatus:True; PodName:mysql-proxy-1 + observedGeneration: 1 + status: "True" + type: EvictPod--mysql-proxy-1 + - lastTransitionTime: "2025-10-20T06:39:27Z" + message: get pod; ConditionStatus:True; PodName:mysql-proxy-1 + observedGeneration: 1 + status: "True" + type: GetPod--mysql-proxy-1 + - lastTransitionTime: "2025-10-20T06:40:07Z" + message: evict pod; ConditionStatus:True; PodName:mysql-proxy-2 + observedGeneration: 1 + status: "True" + type: EvictPod--mysql-proxy-2 + - lastTransitionTime: "2025-10-20T06:40:07Z" + message: get pod; ConditionStatus:True; PodName:mysql-proxy-2 + observedGeneration: 1 + status: "True" + type: GetPod--mysql-proxy-2 + - lastTransitionTime: "2025-10-20T06:40:47Z" + message: 'Successfully started ProxySQL pods for ProxySQLOpsRequest: demo/restart ' + observedGeneration: 1 + reason: RestartPodsSucceeded + status: "True" + type: Restart + - lastTransitionTime: "2025-10-20T06:40:47Z" + message: Controller has successfully restart the ProxySQL replicas + observedGeneration: 1 + reason: Successful + status: "True" + type: Successful + observedGeneration: 1 + phase: Successful + +``` + +## Cleaning up + +To clean up the Kubernetes resources created by this tutorial, run: + +```bash +kubectl delete Proxysqlopsrequest -n demo restart +kubectl delete ProxySQL -n demo mysql-proxy +kubectl delete MySQL -n demo mysql-server +kubectl delete ns demo +``` + +## Next Steps + +- Detail concepts of [ProxySQL object](/docs/guides/proxysql/concepts/proxysql/index.md). +- Detail concepts of [ProxySQLOpsRequest object](/docs/guides/proxysql/concepts/opsrequest/index.md). +- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md).. diff --git a/docs/guides/proxysql/scaling/_index.md b/docs/guides/proxysql/scaling/_index.md index a69adab150..c40cbe8eda 100644 --- a/docs/guides/proxysql/scaling/_index.md +++ b/docs/guides/proxysql/scaling/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-scaling name: Scaling parent: guides-proxysql - weight: 43 + weight: 120 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/tls/_index.md b/docs/guides/proxysql/tls/_index.md index c5a99316a5..f619ebdc96 100644 --- a/docs/guides/proxysql/tls/_index.md +++ b/docs/guides/proxysql/tls/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-tls name: TLS/SSL Encryption parent: guides-proxysql - weight: 110 + weight: 130 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/proxysql/update-version/_index.md b/docs/guides/proxysql/update-version/_index.md index 343d9369f3..c769667f18 100644 --- a/docs/guides/proxysql/update-version/_index.md +++ b/docs/guides/proxysql/update-version/_index.md @@ -5,6 +5,6 @@ menu: identifier: guides-proxysql-updating name: UpdateVersion parent: guides-proxysql - weight: 45 + weight: 60 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/autoscaler/_index.md b/docs/guides/redis/autoscaler/_index.md index c1fd508cfc..4b16f7dcdd 100644 --- a/docs/guides/redis/autoscaler/_index.md +++ b/docs/guides/redis/autoscaler/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-auto-scaling name: Autoscaling parent: rd-redis-guides - weight: 47 + weight: 120 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/backup/_index.md b/docs/guides/redis/backup/_index.md index 2b500db3a7..1e9d8ed00d 100644 --- a/docs/guides/redis/backup/_index.md +++ b/docs/guides/redis/backup/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-guides-redis-backup name: Backup & Restore parent: rd-redis-guides - weight: 50 + weight: 140 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/cli/_index.md b/docs/guides/redis/cli/_index.md index b7af215e28..a5e78b9cf1 100755 --- a/docs/guides/redis/cli/_index.md +++ b/docs/guides/redis/cli/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-cli-redis name: Cli parent: rd-redis-guides - weight: 100 + weight: 160 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/initialization/_index.md b/docs/guides/redis/initialization/_index.md index a1fba8dd8a..53c14f6095 100755 --- a/docs/guides/redis/initialization/_index.md +++ b/docs/guides/redis/initialization/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-initialization-redis name: Initialization parent: rd-redis-guides - weight: 41 + weight: 40 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/monitoring/_index.md b/docs/guides/redis/monitoring/_index.md index 11085a2544..32dedf724b 100755 --- a/docs/guides/redis/monitoring/_index.md +++ b/docs/guides/redis/monitoring/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-monitoring-redis name: Monitoring parent: rd-redis-guides - weight: 55 + weight: 150 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/reconfigure-tls/_index.md b/docs/guides/redis/reconfigure-tls/_index.md index e0535c52e7..29642a6b87 100644 --- a/docs/guides/redis/reconfigure-tls/_index.md +++ b/docs/guides/redis/reconfigure-tls/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-reconfigure-tls name: Reconfigure TLS/SSL parent: rd-redis-guides - weight: 46 + weight: 110 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/reconfigure/_index.md b/docs/guides/redis/reconfigure/_index.md index 5771559c29..375965b4a0 100644 --- a/docs/guides/redis/reconfigure/_index.md +++ b/docs/guides/redis/reconfigure/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-reconfigure name: Reconfigure parent: rd-redis-guides - weight: 46 + weight: 100 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/redis/restart/restart.md b/docs/guides/redis/restart/restart.md new file mode 100644 index 0000000000..43c8b40421 --- /dev/null +++ b/docs/guides/redis/restart/restart.md @@ -0,0 +1,243 @@ +--- +title: Restart Redis +menu: + docs_{{ .version }}: + identifier: rd-restart-redis + name: Restart + parent: rd-redis-guides + weight: 50 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Overview + +KubeDB supports restarting a Redis/Valkey database via a `RedisOpsRequest`. Restarting is useful if some pods are stuck in an unexpected state or are not functioning correctly. This tutorial will guide you through the process of restarting a Redis cluster using KubeDB. + +## Before You Begin + +- You need a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you don’t have a cluster, you can create one using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Install the KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a namespace called `demo`. + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +> Note: The YAML files used in this tutorial are stored in the [docs/examples/redis](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/redis) folder in the GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy Redis Cluster + +In this section, we will deploy a Redis cluster using KubeDB. + +```yaml +apiVersion: kubedb.com/v1 +kind: Redis +metadata: + name: redis-cluster + namespace: demo +spec: + version: 8.2.2 + mode: Cluster + cluster: + replicas: 2 + storageType: Durable + storage: + resources: + requests: + storage: 1Gi + storageClassName: local-path + accessModes: + - ReadWriteOnce + deletionPolicy: WipeOut +``` + +Let’s create the `Redis` custom resource (CR) shown above: + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/redis/restart/redis.yaml +redis.kubedb.com/redis-cluster created +``` + +Once the Redis cluster is created, you can check the pods created: + +```bash +$ kubectl get pods -n demo -l app.kubernetes.io/instance=redis-cluster -w +NAME READY STATUS RESTARTS AGE +redis-cluster-shard0-0 1/1 Running 0 19h +redis-cluster-shard0-1 1/1 Running 0 19h +redis-cluster-shard1-0 1/1 Running 0 19h +redis-cluster-shard1-1 1/1 Running 0 19h +redis-cluster-shard2-0 1/1 Running 0 19h +redis-cluster-shard2-1 1/1 Running 0 19h +``` + +## Apply Restart OpsRequest + +To restart the Redis cluster, we will create a `RedisOpsRequest` to initiate the restart operation. + +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: RedisOpsRequest +metadata: + name: restart + namespace: demo +spec: + type: Restart + databaseRef: + name: redis-cluster + apply: Always +``` + +- `spec.type`: Specifies the type of operation, in this case, `Restart`. +- `spec.databaseRef`: References the name of the Redis database (`redis-cluster`) in the same namespace as the `RedisOpsRequest`. +- `spec.apply`: Determines whether the operation should always be applied (`Always`) or only when there are changes (`IfReady`). + +Let’s create the `RedisOpsRequest` CR: + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/redis/restart/restart.yaml +RedisOpsRequest.ops.kubedb.com/restart created +``` + +### Restart Process for Redis Cluster + +In a Redis cluster, pods are organized into shards, each containing multiple replicas in a master-slave +setup. The restart process follows these steps: + +- Restart replicas first: For each shard, restart all slave pods one by one. +- Restart masters last: After all slaves in all shards are restarted, restart the master pods one by one. + +This ensures high availability and minimal disruption during the restart. + +You can check the status of the `RedisOpsRequest` to confirm the restart operation: + +```bash +$ kubectl get rdops -n demo +NAME TYPE STATUS AGE +restart Restart Successful 6m51s + +$ kubectl get rdops -n demo restart -o yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: RedisOpsRequest +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ops.kubedb.com/v1alpha1","kind":"RedisOpsRequest","metadata":{"annotations":{},"name":"restart","namespace":"demo"},"spec":{"apply":"Always","databaseRef":{"name":"redis-cluster"},"type":"Restart"}} + creationTimestamp: "2025-10-21T08:41:47Z" + generation: 1 + name: restart + namespace: demo + resourceVersion: "157658" + uid: 234fb008-ca91-420d-a2ae-4121c2c34595 +spec: + apply: Always + databaseRef: + name: redis-cluster + type: Restart +status: + conditions: + - lastTransitionTime: "2025-10-21T08:41:47Z" + message: Redis ops request is restarting the database nodes + observedGeneration: 1 + reason: Restart + status: "True" + type: Restart + - lastTransitionTime: "2025-10-21T08:41:53Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard0-1 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard0-1 + - lastTransitionTime: "2025-10-21T08:42:28Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard0-1 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard0-1 + - lastTransitionTime: "2025-10-21T08:42:28Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard1-1 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard1-1 + - lastTransitionTime: "2025-10-21T08:43:03Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard1-1 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard1-1 + - lastTransitionTime: "2025-10-21T08:43:03Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard2-1 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard2-1 + - lastTransitionTime: "2025-10-21T08:43:38Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard2-1 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard2-1 + - lastTransitionTime: "2025-10-21T08:43:38Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard0-0 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard0-0 + - lastTransitionTime: "2025-10-21T08:44:13Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard0-0 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard0-0 + - lastTransitionTime: "2025-10-21T08:44:13Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard1-0 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard1-0 + - lastTransitionTime: "2025-10-21T08:44:48Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard1-0 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard1-0 + - lastTransitionTime: "2025-10-21T08:44:48Z" + message: evict pod; ConditionStatus:True; PodName:redis-cluster-shard2-0 + observedGeneration: 1 + status: "True" + type: EvictPod--redis-cluster-shard2-0 + - lastTransitionTime: "2025-10-21T08:45:23Z" + message: is pod ready; ConditionStatus:True; PodName:redis-cluster-shard2-0 + observedGeneration: 1 + status: "True" + type: IsPodReady--redis-cluster-shard2-0 + - lastTransitionTime: "2025-10-21T08:45:23Z" + message: Successfully restarted pods + observedGeneration: 1 + reason: RestartPods + status: "True" + type: RestartPods + - lastTransitionTime: "2025-10-21T08:45:23Z" + message: Successfully Restarted Database + observedGeneration: 1 + reason: Successful + status: "True" + type: Successful + observedGeneration: 1 + phase: Successful + +``` + +## Cleaning Up + +To clean up the Kubernetes resources created in this tutorial, run: + +```bash +$ kubectl delete rdops -n demo restart +$ kubectl delete redis -n demo redis-cluster +$ kubectl delete ns demo +``` + +## Next Steps + +- Learn about [backup and restore](/docs/guides/redis/backup/kubestash/overview/index.md) Redis databases using KubeStash. +- Explore initializing a [Redis database with scripts](/docs/guides/redis/initialization/using-script.md). +- Understand the detailed concepts of the [Redis object](/docs/guides/redis/concepts/redis.md). +- Want to contribute to KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md). \ No newline at end of file diff --git a/docs/guides/redis/rotateauth/_index.md b/docs/guides/redis/rotateauth/_index.md index 59a11c83d9..fec5969d63 100644 --- a/docs/guides/redis/rotateauth/_index.md +++ b/docs/guides/redis/rotateauth/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-rotate-auth-redis name: Rotate Authentication parent: rd-redis-guides - weight: 48 + weight: 130 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/scaling/_index.md b/docs/guides/redis/scaling/_index.md index 1a3d700d1d..30acdfdb8f 100644 --- a/docs/guides/redis/scaling/_index.md +++ b/docs/guides/redis/scaling/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-scaling name: Scaling parent: rd-redis-guides - weight: 43 + weight: 80 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/redis/tls/_Index.md b/docs/guides/redis/tls/_Index.md index 00fa045b80..0d6d7626ef 100644 --- a/docs/guides/redis/tls/_Index.md +++ b/docs/guides/redis/tls/_Index.md @@ -5,6 +5,6 @@ menu: identifier: rd-tls name: TLS/SSL Encryption parent: rd-redis-guides - weight: 45 + weight: 90 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/redis/update-version/_index.md b/docs/guides/redis/update-version/_index.md index 3143414b51..b6e1c23a7a 100644 --- a/docs/guides/redis/update-version/_index.md +++ b/docs/guides/redis/update-version/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-update-version name: UpdateVersion parent: rd-redis-guides - weight: 42 + weight: 60 menu_name: docs_{{ .version }} --- \ No newline at end of file diff --git a/docs/guides/redis/volume-expansion/_index.md b/docs/guides/redis/volume-expansion/_index.md index 7001bdf70a..ce4680fa2d 100644 --- a/docs/guides/redis/volume-expansion/_index.md +++ b/docs/guides/redis/volume-expansion/_index.md @@ -5,6 +5,6 @@ menu: identifier: rd-volume-expansion name: Volume Expansion parent: rd-redis-guides - weight: 42 + weight: 70 menu_name: docs_{{ .version }} --- diff --git a/docs/liche b/docs/liche new file mode 100755 index 0000000000..afb7d48a45 Binary files /dev/null and b/docs/liche differ