# How to Build a Cluster Database and Create a Repository

{% embed url="<https://youtu.be/ZWpayouhIts?list=PLmyM3TZtVUyIzZY7XdayHNzJy7VF4vn5Q>" %}

Before you start using the Astera server, a repository must be set up. Astera Data Stack supports SQL Server and PostgreSQL for building cluster databases, which can then be used for maintaining the repository. The repository is where job logs, job queues, and schedules are kept.

To see these options, go to *Server > Configure > Step 1: Build repository database and configure server*.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FKVRaKVAmvJ0iKwo9SQbE%2F01-Configure-and-build-repo.png?alt=media&#x26;token=da91f3c9-aac7-42b8-a976-427739ac77e1" alt=""><figcaption></figcaption></figure>

The first step is to point to the SQL Server or PostgreSQL instance where you want to build the repository and provide the credentials to establish the connection.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2Ff2YEQ7EZv6tCqFMNvTYh%2F02-Connection-window.png?alt=media&#x26;token=e5799ccf-c31a-404e-b8c6-fff8586babcf" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** Astera will not create the database itself, just the tables. A database will have to be created beforehand or an existing database can be used. We recommend Astera to have its own database for this purpose.
{% endhint %}

### Building a Repository on SQL Server

1. Go to *Server > Configure > Step 1: Build repository database and configure server*.
2. Select *SQL Server* from the *Data Provider* drop-down list and provide the credentials for establishing the connection.
3. From the drop-down list next to the *Database* option, select the database on the SQL instance where you want to host the repository.

```
<figure><img src="../.gitbook/assets/03-SQL-table-connection.png" alt=""><figcaption></figcaption></figure>
```

4. Click *Test Connection* to test whether the connection is successfully established or not. You should be able to see the following message if the connection is successfully established.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FiivqI4QWCMvjPfvsl5jt%2F03-Test-connection-window.png?alt=media&#x26;token=3deb4562-641a-45e1-a221-adf55d1f1526" alt=""><figcaption></figcaption></figure>

5. Click *OK* and the following message will appear. Select *Yes* to proceed.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F5v2vjpHZRcSYTDhpp0kU%2F04-Reset-Confirmation.png?alt=media&#x26;token=6c884374-808a-4145-b9e8-5ba247bd2e16" alt=""><figcaption></figcaption></figure>

6. The following message will appear, which will indicate that the repository is successfully built.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2Fsgt8OaDITvoVFLY0X5DM%2F05-Success-SQL.png?alt=media&#x26;token=e0738ae2-d087-45b2-9b49-00181b2fce7b" alt=""><figcaption></figcaption></figure>

The next step is to log in using your credentials.

### Building a Repository on PostgreSQL

1. Go to *Server > Configure > Step 1: Build repository database and configure server*.
2. Select *PostgreSQL* from the *Data Provider* drop-down list and provide the credentials for establishing the connection.
3. From the drop-down list next to the *Database* option, select the database on the PostgreSQL instance where you want to host the repository.

```
<figure><img src="../.gitbook/assets/07-Postgres-Connection.png" alt=""><figcaption></figcaption></figure>
```

4. Click *Test Connection* to test whether the connection is successfully established or not. You should be able to see the following message if the connection is successfully established.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F95b12EG0BkRexbRHUunS%2F06-Tested-Connection-PSQL.png?alt=media&#x26;token=07cfcb4e-286e-4ec3-8f6d-d82a6ac26e5b" alt=""><figcaption></figcaption></figure>

5. Click *OK* and the following message will appear. Select *Yes* to proceed.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FKqr7kT6qa9DX9ARtx6Ww%2F07-Warning-to-reset-repo.png?alt=media&#x26;token=81982a66-2ed4-4a43-8c33-33fc83f40abc" alt=""><figcaption></figcaption></figure>

6. The following message will appear, which will indicate that the repository is successfully built.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FVkpix4AH3ikVYopJ4MRt%2F08-Success-PSQL.png?alt=media&#x26;token=f31c31fb-99f4-4cd6-b49e-d49b9e7091b1" alt=""><figcaption></figcaption></figure>

The repository is now set up and configured with the server to be used.

Once the server is configured, it will have a green arrow.\\

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FbE0ctEJ6dfa0obkyAlYb%2F09-Server-Configured.png?alt=media&#x26;token=ef8fc692-84f9-4d94-83b0-313b56e0af2b" alt=""><figcaption></figcaption></figure>

To view the server properties, right-click on the connected server and select *Server Properties*.

<figure><img src="https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FAUUugwoFQsU2iEJdbBb8%2F10-Server-Properties.png?alt=media&#x26;token=33c4edf1-c514-4d6d-a4b3-67a91fc38773" alt=""><figcaption></figcaption></figure>

\
The next step is to log in using your credentials.
