nová verze
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
[KUBE](../../README.md) / [k3s](../k3s.md) / MariaDB
|
||||
|
||||
# Resource MariaDB
|
||||
|
||||
> [!NOTE]
|
||||
> A replica of two pods `mariadb-master` and `mariadb-slave` is created. Each of the pods has a separate storage. When configuring the connection, the host is specified: `mariadb-master`.
|
||||
|
||||
- [Install](#install)
|
||||
- [Remove](#remove)
|
||||
- [Status](#status)
|
||||
- [Info](#info)
|
||||
- [Version](#version)
|
||||
- [Database list](#database-list)
|
||||
- [User list](#user-list)
|
||||
- [Dump](#dump)
|
||||
***
|
||||
|
||||
## Install
|
||||
|
||||
### Processing
|
||||
1. Preparation.
|
||||
- Recreate the secret with the passwords `root-password` and `replication-password`.
|
||||
|
||||
2. Creation.
|
||||
- Prepare the import file.
|
||||
- Import the YAML.
|
||||
|
||||
3. Post-processing.
|
||||
- Initialize the replica.
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb install
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[K3S] Resource add | mariadb
|
||||
✅[MariaDB] | Delete old Secret: OK
|
||||
✅[MariaDB] | Create new Secret: OK
|
||||
🔹[MariaDB] Preparing /app/kube/assets/yaml/mariadb.yaml
|
||||
🔹[K3S] Applying YAML /app/kube/data/yaml/mariadb.yaml
|
||||
💡[K3S] Waiting for pods to be ready... | 2 not ready
|
||||
💡[K3S] Waiting for pods to be ready... | 1 not ready
|
||||
✅[MariaDB] Applied /app/kube/data/yaml/mariadb.yaml
|
||||
🔹[MariaDB] Replica initialization...
|
||||
✅[MariaDB] Master node | Create replication user: OK
|
||||
✅[MariaDB] Master node | Status: OK
|
||||
✅[MariaDB] Slave node | Change master: OK
|
||||
✅[MariaDB] Slave node | Status: OK | Delay 0s
|
||||
✅[MariaDB] Replica initialization completed successfully
|
||||
```
|
||||
***
|
||||
|
||||
## Remove
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb remove
|
||||
```
|
||||
***
|
||||
|
||||
## Status
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb status
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] Status
|
||||
✅[MariaDB] Databases: 10 | Users: 10 | Size: 1.234 Gb
|
||||
✅[MariaDB] Master node | Running
|
||||
✅[MariaDB] Slave node | Running
|
||||
```
|
||||
***
|
||||
|
||||
## Info
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb info
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] Info
|
||||
🔹[MariaDB] Master node
|
||||
mysql-bin.000025 10341
|
||||
🔹[MariaDB] Slave node
|
||||
*************************** 1. row ***************************
|
||||
Slave_IO_State: Waiting for master to send event
|
||||
Master_Host: mariadb-master
|
||||
Master_User: replication_user
|
||||
Master_Port: 3306
|
||||
...
|
||||
```
|
||||
***
|
||||
|
||||
## Version
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb version
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] Version
|
||||
✅[MariaDB] Master node | mariadb from 11.7.2-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
|
||||
✅[MariaDB] Slave node | mariadb from 11.7.2-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
|
||||
```
|
||||
***
|
||||
|
||||
## Database list
|
||||
|
||||
> [!NOTE]
|
||||
> List of databases (except for service databases: `information_schema`, `performance_schema`, `mysql`, `sys`)
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb database
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] Database list
|
||||
us1_example_com
|
||||
us2_example_com
|
||||
us3_example_com
|
||||
```
|
||||
***
|
||||
|
||||
## User list
|
||||
|
||||
> [!NOTE]
|
||||
> List of users (except for service users `root`, `replication_user`)
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb user
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] User list
|
||||
us1_example_com
|
||||
us2_example_com
|
||||
us3_example_com
|
||||
```
|
||||
***
|
||||
|
||||
## Dump
|
||||
|
||||
Command:
|
||||
```bash
|
||||
sudo kube.sh --mariadb dump
|
||||
sudo kube.sh --mariadb dump dump.sql
|
||||
sudo kube.sh --mariadb dump dump.sql us1_example_com
|
||||
```
|
||||
|
||||
Example of log:
|
||||
```bash
|
||||
🔹[MariaDB] Dump
|
||||
✅[MariaDB] Dump: /app/kube/data/mariadb/2025-10-27_10-10-58.sql.tar.gz
|
||||
```
|
||||
Reference in New Issue
Block a user