> For the complete documentation index, see [llms.txt](https://asus-isg-aidc.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asus-isg-aidc.gitbook.io/guide/v1.4.0/cli/commandreference/database.md).

# Database Management

| Developer | Last modified |
| --------- | ------------- |
| AIDC Team | 2026/02/12    |

## Table of Contents

* [1. Overview](#overview)
* [2. Subcommands](#subcommands)
* [3. Verifying the Cluster](#verifying-the-cluster)
* [4. Supported Operating Systems](#supported-operating-systems)
* [5. Usage Examples](#usage-examples)
* [6. Related Commands](#related-commands)

***

## 1. Overview <a href="#overview" id="overview"></a>

The `database` command manages database cluster deployments on target nodes.

```bash
aidc-cli database <subcommand> [flags]
```

***

## 2. Subcommands <a href="#subcommands" id="subcommands"></a>

### 2.1 `maria-galera` — MariaDB Galera Cluster

Deploys a MariaDB Galera multi-master cluster for high-availability database services (commonly used as the Slurm accounting database backend).

```bash
aidc-cli database maria-galera
```

This will:

1. Install MariaDB server on designated nodes
2. Configure Galera replication
3. Bootstrap the cluster and join nodes
4. Set up users and privileges

{% hint style="info" %}
Configure MariaDB parameters first with `aidc-cli init mariadb-set` before deploying. Ensure that the "mariaDB-galera group" in the inventory has been set. Inventory CSV files must be set up correctly.
{% endhint %}

***

## 3. Verifying the Cluster <a href="#verifying-the-cluster" id="verifying-the-cluster"></a>

After deployment, verify the MariaDB Galera cluster:

```bash
# Enter the SQL environment
mysql -u root -p

# Check cluster status
SHOW STATUS LIKE 'wsrep_cluster_status';

# Check cluster sync status
SHOW STATUS LIKE 'wsrep_local_state_comment';

# Check cluster node count
SHOW STATUS LIKE 'wsrep_cluster_size';
```

***

## 4. Supported Operating Systems <a href="#supported-operating-systems" id="supported-operating-systems"></a>

| OS          | Version | Architecture |
| ----------- | ------- | ------------ |
| RHEL        | 8.9     | x86\_64      |
| Rocky Linux | 8.10    | x86\_64      |
| Ubuntu      | 22.04.5 | x86\_64      |

{% hint style="info" %}
MariaDB Galera supports both multi-server and single-server installations; however, a single-server installation is not considered a Galera DB cluster.
{% endhint %}

***

## 5. Usage Examples <a href="#usage-examples" id="usage-examples"></a>

```bash
# Configure and deploy MariaDB Galera
aidc-cli init mariadb-set
aidc-cli database maria-galera

# Deploy on specific nodes
aidc-cli database maria-galera -l db01,db02,db03
```

***

## Related Commands <a href="#related-commands" id="related-commands"></a>

| Command                | Purpose                                    |
| ---------------------- | ------------------------------------------ |
| `init mariadb-get/set` | View/set MariaDB configuration             |
| `slurm setup-cluster`  | Deploy Slurm (uses MariaDB for accounting) |
