3.4 KiB
3.4 KiB
Resource MariaDB
Note
A replica of two pods
mariadb-masterandmariadb-slaveis created. Each of the pods has a separate storage. When configuring the connection, the host is specified:mariadb-master.
Install
Processing
-
Preparation.
- Recreate the secret with the passwords
root-passwordandreplication-password.
- Recreate the secret with the passwords
-
Creation.
- Prepare the import file.
- Import the YAML.
-
Post-processing.
- Initialize the replica.
Command:
sudo kube.sh --mariadb install
Example of log:
🔹[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:
sudo kube.sh --mariadb remove
Status
Command:
sudo kube.sh --mariadb status
Example of log:
🔹[MariaDB] Status
✅[MariaDB] Databases: 10 | Users: 10 | Size: 1.234 Gb
✅[MariaDB] Master node | Running
✅[MariaDB] Slave node | Running
Info
Command:
sudo kube.sh --mariadb info
Example of log:
🔹[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:
sudo kube.sh --mariadb version
Example of log:
🔹[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:
sudo kube.sh --mariadb database
Example of log:
🔹[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:
sudo kube.sh --mariadb user
Example of log:
🔹[MariaDB] User list
us1_example_com
us2_example_com
us3_example_com
Dump
Command:
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:
🔹[MariaDB] Dump
✅[MariaDB] Dump: /app/kube/data/mariadb/2025-10-27_10-10-58.sql.tar.gz