Install Rudder server with an external database

Rudder uses a PostgreSQL database to store its reports.

People having a dedicated database server or having a report database becoming too big can setup an external database instead of letting Rudder manage one on the Rudder server itself.

Install a new server with a separate database

Install PostgreSQL server

If you have to install the PostgreSQL service on a separate server, we provide here a simplified PostgreSQL documentation.

If your organization has a database administrator, just ask him to create a new database with an associated user and permissions.

If in doubt, please always refer to the officiel PostgreSQL documentation https://www.postgresql.org/docs/ Check that you have the minimum required PostgreSQL version and install it.

Rudder requires PostgreSQL 10.3 or higher.

On a RHEL-like system

$ yum install postgresql-server
$ postgresql-setup --initdb
$ systemctl start postgresql

On a Debian-like system

$ apt-get install postgresql

On a SLES system

$ zypper install postgresql-server
$ systemctl start postgresql

Then, you need to create the rudder user with a secure password, and then the rudder database

$ su postgres -c "psql -q -c \"CREATE USER rudder WITH PASSWORD '${PASSWORD}'\""

$ su postgres -c "psql -q -c 'CREATE DATABASE rudder WITH OWNER = rudder'"

Make sure to give access to this user from the outside by editing pg_hba.conf.

On debian like it is /etc/postgresql/<your version>/main/pg_hba.conf, on redhat like it is /var/lib/pgsql/data/pg_hba.conf.

In any case, it can be found with the command : ̀ su postgres -c "psql -t -P format=unaligned -c 'show hba_file';"`

# this line must be adapted to you installation and put into pg_hba.conf
# host  <database>         <user>          <rudder server IP>/32       md5
host    rudder             rudder          196.168.0.1/32           md5

Make sure your postgresql server listens on a public interface. In postgresql.conf.

On debian like it is /etc/postgresql/<your version>/main/postgresql.conf, on redhat like it is /var/lib/pgsql/data/postgresql.conf.

In any case, it should be in the same directory as pg_hba.conf.

listen_addresses = '*'

Finally restart PostgreSQL service:

systemctl restart postgresql

Install rudder-external-db

On Rudder host, first install the rudder-external-db package, before installing any rudder package:

On a RHEL-like system

$ yum install rudder-external-db

On a Debian-like system

$ apt-get install rudder-external-db

On a SLES system

$ zypper install rudder-external-db

You need to complete the configuration file /opt/rudder/etc/external-db.conf:

# Host where rudder server must connect to access the database
DB_HOST="postgresql.example.com"

# Database user and password, to create them ask your database administrator or use the following command
#    su postgres -c "psql -q -c \"CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}'\""
DB_USER="rudder"
DB_PASSWORD="xxx"

# Postgresql database name, to create it ask your database administrator or use the following command
#    su postgres -c "psql -q -c \"CREATE DATABASE ${DB_NAME} WITH OWNER = ${DB_USER}\""
DB_NAME="rudder"

And check that you can connect to the database server

psql -U rudder -h $DB_HOST

Install Rudder

Finally follow the regular Rudder server installation process depending on your system: Debian/Ubuntu | RHEL/CentOS/AlmaLinux/Rocky | SLES | Amazon Linux


← on SLES on Debian/Ubuntu →