-
Notifications
You must be signed in to change notification settings - Fork 53
restart #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bonusree
wants to merge
15
commits into
master
Choose a base branch
from
restart
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
restart #822
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0e57427
mariadb failover 2nd edition
Bonusree 10b0b77
mysql restart
Bonusree 9be3cda
perconaxtra restart
Bonusree a428f30
proxysql restart
Bonusree f5e9bef
redis restart
Bonusree 7473e58
version and field fix
Bonusree b5c5fdc
fix error in percona failover
Bonusree 19ddb06
guide link fixed
Bonusree abdc9a6
weight fixed
Bonusree 5ac7443
redis review
Bonusree 980c87f
weight changes
Bonusree 53a888a
review2
Bonusree ec90482
review mysql,percona,proxy
Bonusree b1f22f9
added yaml in opsrequest
Bonusree 150f451
fixed ignite links
Bonusree File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: local-path | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| deletionPolicy: WipeOut |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| --- | ||
| 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: | ||
| storageClassName: local-path | ||
| 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 only when there are changes (IfReady). | ||
Bonusree marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| > Note: The method of restarting the standalone & cluster mode db is exactly same as above. All you need, is to specify the corresponding Postgres name in `spec.databaseRef.name` section. | ||
|
|
||
| Let's create the `PostgresOpsRequest` 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. | ||
| > Note: This will not restart the arbiter pod if you have one. Arbiter pod doesn't have any data related to your database. So you can ignore restarting this pod because no restart is necessary for arbiter pod but if you want so, just kubectl delete the arbiter pod (dbName-arbiter-0) in order to restart it. | ||
Bonusree marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```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). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.