Database Connection¶
Before you start¶
Goal
- Connect the hub to a PostgreSQL database.
Prerequisites
- Complete the initial installation (run
hubctl
to verify). - Have the credentials for the running PostgreSQL database (unless using the internal Altair SLC Hub database).
- Altair SLC Hub configuration privileges for the host.
What database to use¶
Altair SLC Hub requires a connection to a PostgreSQL database to store relational data.
The instance of PostgreSQL to be used with Altair SLC Hub can be in one of the following:
- Hosted in the cloud. This is recommended if Altair SLC Hub is being installed in a cloud environment. When hosted in a cloud environment, using the cloud's managed PostgreSQL service will provide the best cost and performance, as well as providing simple and efficient backup and restore solutions.
- Hosted on-premise. This is recommended if Altair SLC Hub is being installed on-premise as a PostgreSQL instance can be setup with your standard infrastructure practices, including any replication and backup solutions.
- Use the version of PostgreSQL included with the Altair SLC Hub installation. This is recommended where existing infrastructure does not exist or is not practical to use. Backup must be considered when using this to ensure minimal data loss in the case of disaster.
Configuring the Hub database connection¶
Using an on-premise or cloud hosted PostgreSQL¶
The connection to the database is configured using the database
configuration
section. A list of the configuration settings and comments on their use is found in the file [etc directory]/config.d/database.yaml
in the hub installation.
To configure a database connection, take a copy of this file and
save it to a file in the same directory with a lexicographically greater name.
For example, save it as database_custom.yaml
.
Then modify the settings in that file appropriately.
To avoid conflicts we recommend a dedicated database in the database server. For security, create a dedicated user for Altair SLC Hub to access that database. Altair SLC Hub requires table creation permission in order to run the database schema migration step.
Using the internal database¶
Alternatively to an on-premise or cloud hosted PostgreSQL instance, you can use the database that is bundled with the Altair SLC Hub installation. This is only recommended if it is impractical to use either an on-premise or cloud hosted PostgreSQL instance.
To use the internal PostgreSQL database, ensure that database
configuration section contains type: internal
. To check your current database configuration values, run:
hubctl config print database
Once you have confirmed that the database configuration includes type: internal
, you can start the internal database by running the command:
hubctl service start internaldb
Verification¶
Verify database
- Run the hubctl verify db
Before continuing, it is necessary to verify that the connection information for the database is correct.
This can be done using the hubctl
commands, as follows:
hubctl verify db