Skip to content

Commit 7dcd9c7

Browse files
committed
add UI
Signed-off-by: SK Ali Arman <[email protected]>
1 parent b81e682 commit 7dcd9c7

File tree

3 files changed

+51
-47
lines changed

3 files changed

+51
-47
lines changed
Loading

docs/guides/mariadb/clustering/mariadb-replication/index.md

+42-41
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,25 @@ pod/sample-mariadb-mx-2 1/1 Running 0 3m9s
315315

316316
```
317317

318+
## Check the Cluster Status
319+
320+
Now, we are ready to check newly created cluster status. Connect to maxscale pod and run the following commands from any of the maxscale pod and you will get the same result.
321+
322+
```bash
323+
$ kubectl exec -it -n demo svc/sample-mariadb-mx -- bash
324+
bash-4.4$ maxctrl list servers
325+
┌─────────┬─────────────────────────────────────────────────────────────┬──────┬─────────────┬─────────────────┬─────────┬────────────────────┐
326+
│ Server │ Address │ Port │ Connections │ State │ GTID │ Monitor │
327+
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
328+
│ server1 │ sample-mariadb-0.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Master, Running │ 0-1-125 │ ReplicationMonitor │
329+
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
330+
│ server2 │ sample-mariadb-1.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Slave, Running │ 0-1-125 │ ReplicationMonitor │
331+
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
332+
│ server3 │ sample-mariadb-2.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Slave, Running │ 0-1-125 │ ReplicationMonitor │
333+
└─────────┴─────────────────────────────────────────────────────────────┴──────┴─────────────┴─────────────────┴─────────┴────────────────────┘
334+
335+
```
336+
318337
## Connect with MariaDB database
319338

320339
Once the database is in running state we can conncet to each of three nodes. We will use login credentials `MYSQL_ROOT_USERNAME` and `MYSQL_ROOT_PASSWORD` saved as container's environment variable.
@@ -323,7 +342,7 @@ Once the database is in running state we can conncet to each of three nodes. We
323342
We recommend using a non-root user for production environments. The root user has extensive privileges, which can pose security risks. Therefore, it is advisable to create a dedicated user with appropriate permissions for production use.
324343

325344
```bash
326-
kubectl exec -it -n demo svc/sample-mariadb -- bash
345+
$ kubectl exec -it -n demo svc/sample-mariadb -- bash
327346
root@sample-mariadb-0:/ mariadb -u${MYSQL_ROOT_USERNAME} -p${MYSQL_ROOT_PASSWORD}
328347
Welcome to the MariaDB monitor. Commands end with ; or \g.
329348
Your MariaDB connection id is 11
@@ -349,9 +368,10 @@ Bye
349368
root@sample-mariadb-0:/ exit
350369
exit
351370
```
371+
## Insert and Query Data using Test User
352372

353373
```bash
354-
# First Node
374+
# Master Node
355375
$ kubectl exec -it -n demo svc/sample-mariadb -- bash
356376
root@sample-mariadb-0:/ mariadb -utestuser -ptestpassword
357377
Welcome to the MariaDB monitor. Commands end with ; or \g.
@@ -374,7 +394,7 @@ MariaDB [(none)]> quit;
374394
Bye
375395

376396

377-
# Second Node
397+
# Slave Node
378398
$ kubectl exec -it -n demo svc/sample-mariadb-standby -- bash
379399
root@sample-mariadb-1:/ mariadb -utestuser -ptestpassword
380400
Welcome to the MariaDB monitor. Commands end with ; or \g.
@@ -396,48 +416,11 @@ MariaDB [(none)]> SELECT 1;
396416
MariaDB [(none)]> quit;
397417
Bye
398418

399-
400-
# Third Node
401-
$ kubectl exec -it -n demo sample-mariadb-2 -- bash
402-
root@sample-mariadb-2:/ mariadb -utestuser -ptestpassword
403-
Welcome to the MariaDB monitor. Commands end with ; or \g.
404-
Your MariaDB connection id is 78
405-
Server version: 10.5.23-MariaDB-1:10.5.23+maria~focal mariadb.org binary distribution
406-
407-
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
408-
409-
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
410-
411-
MariaDB [(none)]> SELECT 1;
412-
+---+
413-
| 1 |
414-
+---+
415-
| 1 |
416-
+---+
417-
1 row in set (0.000 sec)
418-
419419
MariaDB [(none)]> quit;
420420
Bye
421421
```
422422

423-
## Check the Cluster Status
424-
425-
Now, we are ready to check newly created cluster status. Connect to maxscale pod and run the following commands from any of the maxscale pod and you will get the same result.
426-
427-
```bash
428-
$ kubectl exec -it -n demo sample-mariadb-mx-0 -- bash
429-
bash-4.4$ maxctrl list servers
430-
┌─────────┬─────────────────────────────────────────────────────────────┬──────┬─────────────┬─────────────────┬─────────┬────────────────────┐
431-
│ Server │ Address │ Port │ Connections │ State │ GTID │ Monitor │
432-
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
433-
│ server1 │ sample-mariadb-0.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Master, Running │ 0-1-125 │ ReplicationMonitor │
434-
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
435-
│ server2 │ sample-mariadb-1.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Slave, Running │ 0-1-125 │ ReplicationMonitor │
436-
├─────────┼─────────────────────────────────────────────────────────────┼──────┼─────────────┼─────────────────┼─────────┼────────────────────┤
437-
│ server3 │ sample-mariadb-2.sample-mariadb-pods.demo.svc.cluster.local │ 3306 │ 0 │ Slave, Running │ 0-1-125 │ ReplicationMonitor │
438-
└─────────┴─────────────────────────────────────────────────────────────┴──────┴─────────────┴─────────────────┴─────────┴────────────────────┘
439423

440-
```
441424

442425
## Data Availability
443426

@@ -802,9 +785,27 @@ MariaDB [playground]> SELECT * FROM test_db.t1;
802785

803786
# write query is only running on master node.
804787
```
805-
806788
We can see the queries are successfully executed through the Maxscale Proxy server and read write split is working as expected.
807789
790+
## Access and Explore the MaxScale UI
791+
To enable the MaxScale UI, set `spec.topology.maxscale.enableUI: true` in the configuration. The MaxScale UI runs on port 8989. To access it, use the following kubectl command to forward the port:
792+
793+
```bash
794+
➤ kubectl port-forward -n demo service/sample-mariadb-mx 8989:8989
795+
Forwarding from 127.0.0.1:8989 -> 8989
796+
Forwarding from [::1]:8989 -> 8989
797+
```
798+
799+
The MaxScale UI is accessible at http://127.0.0.1:8989.
800+
801+
Use the default credentials to log in:
802+
- Username: admin
803+
- Password: mariadb
804+
805+
After logging in, you will be greeted by an intuitive dashboard showcasing servers list and current node state.
806+
807+
![Maxscale Dashboard](/docs/guides/mariadb/clustering/mariadb-replication/examples/maxscale-homepage.png)
808+
808809
## Cleaning up
809810
810811
Clean what we created in this tutorial.

docs/guides/mariadb/clustering/overview/index.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ section_menu_id: guides
1414
1515
# MariaDB Clustering
1616

17-
KubeDB currently supports two cluster modes: Multi-Master MariaDB Galera Cluster and Master-Slave MariaDB Standard Replication.
17+
KubeDB supports two primary clustering modes for MariaDB: Multi-Master MariaDB Galera Cluster and Master-Slave MariaDB Standard Replication. Below, we explore key concepts of these clustering approaches, highlighting their mechanisms, benefits, and use cases in a distributed database environment.
1818

19-
Here we'll discuss some concepts about Cluster.
19+
Below, we explore key concepts of MariaDB clustering, focusing on the two clustering modes supported by KubeDB: Multi-Master MariaDB Galera Cluster and Master-Slave MariaDB Standard Replication
2020

21-
## So What is Replication
21+
## What is Replication
2222

23-
Replication involves copying data from one MariaDB server to one or more other MariaDB servers, rather than storing it on a single server. The replication mode determines read and write capabilities. In a multi-master setup, you can perform read and write operations on any server. In a master and slave architecture, read and write operations are supported on the master host, while slave hosts support only read operations.
23+
Replication in MariaDB involves duplicating data from one MariaDB server (the source) to one or more other MariaDB servers (replicas), rather than storing it on a single server. This process enhances data availability, scalability, and fault tolerance. The replication mode determines the read and write capabilities of each server in the cluster. MariaDB supports two primary replication architectures: multi-master and master-slave.
24+
25+
- Multi-Master Replication: In a multi-master setup, every server in the cluster can handle both read and write operations. This architecture, exemplified by the MariaDB Galera Cluster, ensures high availability and scalability by allowing applications to distribute workloads across all nodes.
26+
- Master-Slave Replication: In a master-slave architecture, the master server supports both read and write operations, while slave servers are limited to read operations. This setup is ideal for read-heavy workloads, with slaves providing scalability for queries and serving as backups.
2427

2528
The following figure shows a cluster of four MariaDB servers of multi-master replication:
2629

@@ -52,7 +55,7 @@ There are some limitations in MariaDB Galera Cluster that are listed [here](http
5255

5356
## MariaDB Standard Replication
5457

55-
MariaDB Standard Replication is a widely used mechanism for copying data from one MariaDB server (the master) to one or more other MariaDB servers (the slaves). This replication mode ensures data redundancy, enhances availability, and supports read scalability by distributing read operations across multiple servers. It operates in a single-master and slave architecture, where the master server handles both read and write operations, while slave servers are limited to read operations.
58+
MariaDB Standard Replication is a widely used mechanism for copying data from one MariaDB server (master) to one or more other MariaDB servers (slave). This replication mode ensures data redundancy, enhances availability, and supports read scalability by distributing read operations across multiple servers. It operates in a single-master and slave architecture, where the master server handles both read and write operations, while slave servers are limited to read operations.
5659

5760
Ref: [About MariadDB Standard Replication](https://mariadb.com/kb/en/replication-overview/#standard-replication)
5861

@@ -65,7 +68,7 @@ Ref: [About MariadDB Standard Replication](https://mariadb.com/kb/en/replication
6568
- Active-passive single-master topology
6669
- Read and write to master, and read only to slave node
6770
- Automatic node joining
68-
- Automatic failover using maxscale proxy
71+
- Automatic failover using Maxscale Proxy Server
6972
- Binary Log-Based replication
7073
- Direct client connections, native MariaDB look & feel
7174
- Load Balance using Maxscale Proxy Server

0 commit comments

Comments
 (0)