> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v2.ard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL on cluster-n03 / cluster-n04

> MySQL topology, versions, and roles on the n03/n04 databases cluster.

## MySQL topology

MySQL runs on both nodes of the databases cluster:

* `cluster-n03` – treated operationally as the **primary** MySQL node.
* `cluster-n04` – treated operationally as the **backup / replica** MySQL node.

Exact replication status (master vs slave, GTID, etc.) cannot be queried without proper MySQL credentials, but from the services’ perspective both hosts run MySQL 5.7 and are configured as part of the same topology.

## MySQL on cluster-n03

* **Version**: `mysql  Ver 14.14 Distrib 5.7.33, for Linux (x86_64)`
* **Service**: `mysql.service` (enabled, active)
* **Unit file**: `/lib/systemd/system/mysql.service`
* **Data / config**:
  * Uses the standard Debian/Ubuntu layout.
  * Exact `datadir` and replication settings require MySQL access.

Useful commands:

```bash theme={null}
ssh cluster-n03
systemctl status mysql
mysql --version
```

Notes:

* Access for the `yazan` user without a password is **not permitted** (`ERROR 1045`), so DBAs should use appropriate MySQL users/credentials.
* Operationally, this node is considered the **main write node** for MySQL workloads.

## MySQL on cluster-n04

* **Version**: `mysql  Ver 14.14 Distrib 5.7.36, for Linux (x86_64)`
* **Service**: `mysql.service` (enabled, active)
* **Unit file**: `/lib/systemd/system/mysql.service`

Useful commands:

```bash theme={null}
ssh cluster-n04
systemctl status mysql
mysql --version
```

Notes:

* Similar to `cluster-n03`, we cannot read replication status without DB credentials.
* Treated as the **backup / replica** node in case of issues with `cluster-n03`.

## Operational hints

* To confirm roles and replication, DBAs should run:

  ```sql theme={null}
  SHOW SLAVE STATUS\G
  SHOW MASTER STATUS\G
  SELECT @@hostname, @@server_id, @@global.read_only;
  ```

* Application endpoints and failover logic for MySQL should be documented in the relevant application or infrastructure modules (load balancers, DNS, etc.).

## Cron jobs & backups

### cluster-n03

* No custom **root crontab** configured for MySQL or other database tasks.
* Only standard system cron jobs under `/etc/cron.*` (e.g. `logrotate`, `mdadm`, `fstrim`, etc.).

### cluster-n04

* Root crontab includes a **MySQL backup job**:

  ```cron theme={null}
  5 3,9,15,21 * * * bash -c "/root/mysql.backup.sh"
  ```

  * Runs at **03:05, 09:05, 15:05, and 21:05** every day.
  * Executes `/root/mysql.backup.sh` as root (exact backup behavior is defined in that script).

System cron directories on `cluster-n04` otherwise contain only standard OS maintenance jobs.
