Skip to content

Commit fcc5416

Browse files
authored
Merge pull request #430 from Patrick-LuoYu/install-on-k8s-rancher
docs: Translate 'deploy_radondb-mysql_operator_on_k8s.md' and 'deploy_radondb-mysql_operator_on_rancher.md'
2 parents a6386c7 + 4b5c926 commit fcc5416

File tree

2 files changed

+403
-0
lines changed

2 files changed

+403
-0
lines changed
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
Contents
2+
===
3+
4+
* [Install a RadonDB MySQL Cluster on Kubernetes](#install-a-radondb-mysql-cluster-operator-on-kubernetes)
5+
* [Introduction](#introduction)
6+
* [Prerequisites](#prerequisites)
7+
* [Procedure](#procedure)
8+
* [Step 1: Add a Helm Repository](#step-1-add-a-helm-repository)
9+
* [Step 2: Install Operator](#step-2-install-operator)
10+
* [Step 3: Install a RadonDB MySQL Cluster](#step-3-install-a-radondb-mysql-cluster)
11+
* [Verification](#verification)
12+
* [Verify RadonDB MySQL Operator](#verify-radondb-mysql-operator)
13+
* [Verify the RadonDB MySQL Cluster](#verify-the-radondb-mysql-cluster)
14+
* [Access RadonDB MySQL](#access-radondb-mysql)
15+
* [Uninstallation](#uninstallation)
16+
* [Uninstall Operator](#uninstall-operator)
17+
* [Uninstall RadonDB MySQL](#uninstall-radondb-mysql)
18+
* [Uninstall the Custom Resources](#uninstall-the-custom-resources)
19+
20+
# Install a RadonDB MySQL Cluster (Operator) on Kubernetes
21+
22+
## Introduction
23+
24+
RadonDB MySQL is an open-source, highly available, and cloud-native database cluster solution based on MySQL. It supports a high availability (HA) architecture with one leader node and multiple follower nodes, and supports a full set of management features such as security, automatic backup, monitoring and alerting, and automatic scaling. RadonDB MySQL has been widely used in production by enterprises such as banks, insurance enterprises, and other traditional large enterprises.
25+
26+
RadonDB MySQL can be installed and managed on Kubernetes so that tasks relevant to RadonDB MySQL clusters are run automatically.
27+
28+
This tutorial demonstrates how to install a RadonDB MySQL cluster (Operator) on Kubernetes.
29+
30+
## Prerequisites
31+
32+
* You need to prepare a Kubernetes cluster.
33+
34+
## Procedure
35+
36+
### Step 1: Add a Helm Repository
37+
38+
```shell
39+
helm repo add radondb https://radondb.github.io/radondb-mysql-kubernetes/
40+
```
41+
42+
Check that a chart named `radondb/mysql-operator` exists in the repository.
43+
44+
```shell
45+
$ helm search repo
46+
NAME CHART VERSION APP VERSION DESCRIPTION
47+
radondb/mysql-operator 0.1.0 v2.1.0 Open Source,High Availability Cluster,based on MySQL
48+
```
49+
50+
### Step 2: Install Operator
51+
52+
The following sets the release name to `demo` and creates a [deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) named `demo-mysql-operator`.
53+
54+
```
55+
helm install demo radondb/mysql-operator
56+
```
57+
58+
> **Note**
59+
>
60+
> This step also creates the [CRD](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) required by the cluster.
61+
62+
### Step 3: Install a RadonDB MySQL Cluster
63+
64+
Run the following command to create an instance of the `mysqlclusters.mysql.radondb.com` CRD and thereby create a RadonDB MySQL cluster by using the default parameters. You can customize the cluster parameters by referring to [Configuration Parameters](../zh-cn/config_para.md).
65+
66+
```kubectl
67+
kubectl apply -f https://github.com/radondb/radondb-mysql-kubernetes/releases/latest/download/mysql_v1alpha1_mysqlcluster.yaml
68+
```
69+
70+
## Verification
71+
72+
### Verify RadonDB MySQL Operator
73+
74+
Run the following command to check the `demo` deployment and its monitoring service. If the following information is displayed, the installation is successful.
75+
76+
```kubectl
77+
$ kubectl get deployment,svc
78+
NAME READY UP-TO-DATE AVAILABLE AGE
79+
demo-mysql-operator 1/1 1 1 7h50m
80+
81+
82+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
83+
service/mysql-operator-metrics ClusterIP 10.96.142.22 <none> 8443/TCP 8h
84+
```
85+
86+
### Verify the RadonDB MySQL Cluster
87+
88+
Run the following command to check the CRDs:
89+
90+
```kubectl
91+
$ kubectl get crd | grep mysql.radondb.com
92+
backups.mysql.radondb.com 2021-11-02T07:00:01Z
93+
mysqlclusters.mysql.radondb.com 2021-11-02T07:00:01Z
94+
mysqlusers.mysql.radondb.com 2021-11-02T07:00:01Z
95+
```
96+
97+
Run the following command to check the cluster. If a statefulset of three replicas (RadonDB MySQL nodes) and services used to access the nodes are displayed, the installation is successful.
98+
99+
```kubectl
100+
$ kubectl get statefulset,svc
101+
NAME READY AGE
102+
sample-mysql 3/3 7h33m
103+
104+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
105+
service/sample-follower ClusterIP 10.96.131.84 <none> 3306/TCP 7h37m
106+
service/sample-leader ClusterIP 10.96.111.214 <none> 3306/TCP 7h37m
107+
service/sample-mysql ClusterIP None <none> 3306/TCP 7h37m
108+
```
109+
110+
## Access RadonDB MySQL
111+
112+
> **Note**
113+
>
114+
> You need to prepare a client used to connect to MySQL.
115+
116+
- If the client is installed in a different Kubernetes cluster from the database, you need to configure port forwarding rules and load balancing by referring to [Access Applications in a Cluster](https://kubernetes.io/docs/tasks/access-application-cluster/).
117+
118+
- In the Kubernetes cluster, you can access RadonDB MySQL by using service names or cluster IP addresses.
119+
120+
> **Note**
121+
>
122+
> RadonDB MySQL provides a leader service and a follower service, which are used to access the leader node and follower nodes respectively. The leader service always points to the leader node that supports read and write, and the follower service always points to the follower nodes that are read-only.
123+
124+
The following demonstrates how to access RadonDB MySQL by using a client in the same Kubernetes cluster as the database.
125+
126+
### Use a Cluster IP Address
127+
128+
The HA read-and-write IP address of RadonDB MySQL points to the cluster IP address of the leader service, and the HA read-only IP address points to the IP address of the follower service.
129+
130+
```shell
131+
mysql -h <clusterIP> -P <mysql_Port> -u <user_name> -p
132+
```
133+
134+
For example, run the following command to access the leader service, where the username is `radondb_usr` and the cluster IP address of the leader service is `10.10.128.136`:
135+
136+
```shell
137+
mysql -h 10.10.128.136 -P 3306 -u radondb_usr -p
138+
```
139+
140+
### Use a Service Name
141+
142+
Pods in the Kubernetes cluster can access RadonDB MySQL by using a service name.
143+
144+
> **Note**
145+
>
146+
> Service names cannot be used to access RadonDB MySQL from the host machines of the Kubernetes cluster.
147+
148+
* Access the leader service (RadonDB MySQL leader node)
149+
150+
```shell
151+
mysql -h <leader_service_name>.<namespace> -u <user_name> -p
152+
```
153+
154+
For example, run the following command to access the leader service, where the username is `radondb_usr`, the release name is `sample`, and the namespace of RadonDB MySQL is `default`:
155+
156+
```shell
157+
mysql -h sample-leader.default -u radondb_usr -p
158+
```
159+
160+
* Access the follower service (RadonDB MySQL follower nodes)
161+
162+
```shell
163+
mysql -h <follower_service_name>.<namespace> -u <user_name> -p
164+
```
165+
166+
For example, run the following command to access the follower service, where the username is `radondb_usr`, the release name is `sample`, and the namespace of RadonDB MySQL is `default`:
167+
168+
```shell
169+
mysql -h sample-follower.default -u radondb_usr -p
170+
```
171+
172+
## Uninstallation
173+
174+
### Uninstall Operator
175+
176+
Uninstall RadonDB MySQL Operator with the release name `demo` in the current namespace.
177+
178+
```shell
179+
helm delete demo
180+
```
181+
182+
### Uninstall RadonDB MySQL
183+
184+
Uninstall the RadonDB MySQL cluster with the release name `sample`.
185+
186+
```kubectl
187+
kubectl delete mysqlclusters.mysql.radondb.com sample
188+
```
189+
190+
### Uninstall the Custom Resources
191+
192+
```kubectl
193+
kubectl delete customresourcedefinitions.apiextensions.k8s.io mysqlclusters.mysql.radondb.com
194+
kubectl delete customresourcedefinitions.apiextensions.k8s.io mysqlusers.mysql.radondb.com
195+
kubectl delete customresourcedefinitions.apiextensions.k8s.io backups.mysql.radondb.com
196+
```

0 commit comments

Comments
 (0)