Advanced multi-server installation

Use a database on a separate server

This section allows installing a separate database only without splitting the rest of the server components like when using the rudder-multiserver-setup script. The setup is done in two places: on the database server and on the Rudder root server.

It also allows moving an existing database to another server.

Use different user and database names

It can be useful, for example if you want to share you database server between several Rudder root servers (see note below), to use a different database for your Rudder root server. To do so:

  • Create the new database (replace alternate_user_name, alternate_base_name and specify a password):

su - postgres -c "psql -q -c \"CREATE USER alternate_user_name WITH PASSWORD 'GENERATE_A_PASSWORD'\""
su - postgres -c "psql -q -c \"CREATE DATABASE alternate_base_name WITH OWNER = alternate_user_name\""
  • Initialize it. First copy the initialization script:

cp /opt/rudder/etc/postgresql/reportsSchema.sql /opt/rudder/etc/postgresql/reportsSchema-alternate.sql
  • In the copied file, change the:

ALTER database rudder SET standard_conforming_strings=true;

To:

ALTER database alternate_base_name SET standard_conforming_strings=true;
  • Then apply the script:

su - postgres -c "psql -q -U alternate_user_name -h localhost -d alternate_base_name \
     -f /opt/rudder/etc/postgresql/reportsSchema-alternate.sql"
  • Follow the standard instructions of this section, with two differences:

    • You need to adjust the line added to pg_hba.conf to match your user and database name.

    • You need to also change the database name and user in rudder-web.properties.

Use the same database server for several Rudder root servers

It is possible to share the same database server between several Rudder instances, by following the preceding tip to use a different database than the default one. However, there are some important points to know:

  • This database server can only be used with the rudder-db role in case of multiserver setup.

  • This database server can only be a node for one of the Rudder servers. This also means that this root server will have indirect access to the content of the other databases.

On the database server

  • Install and configure the agent on the node, and install the rudder-reports package.

  • Change the postgresql.conf file (usually in /var/lib/pgsql or /etc/postgresql), to listen on the right interface to communicate with the server:

# you can use '*' to listen on all interfaces
listen_addresses = 'IP_TO_USE'
  • Also ensure that network policies (i.e. the firewall settings) allow PostgreSQL flows from the root server to the database server.

  • Add an authorization line for the server (in pg_hba.conf, in the same directory):

host    rudder          rudder          ROOT_SERVER_IP/32       md5
  • Restart postgresql to apply the new settings:

systemctl restart postgresql
  • Execute the following command to configure the password (that should be the same as RUDDER_PSQL_PASSWORD in /opt/rudder/etc/rudder-passwords.conf on the root server):

su - postgres -c "psql -c \"ALTER USER rudder WITH PASSWORD 'RUDDER_SERVER_DATABASE_PASSWORD'\""
  • Run an inventory to the server:

rudder agent inventory

On the root server

In the following section, DATABASE_HOST refers to the hostname of the new database server, and SERVER_HOST to the hostname of the root server.

  • Remove the rudder-server-root and rudder-reports packages if installed. For example, you can run on Debian:

systemctl restart rudder-server
apt-mark manual rudder-webapp
apt-get remove --purge rudder-reports
  • You can also remove the postgresql package and database from the server if installed, but keep in mind you will lose all existing data. You can follow the backup and restore procedure to migrate the data to the new database.

  • Change the hostname in /opt/rudder/etc/rudder-web.properties:

rudder.jdbc.url=jdbc:postgresql://DATABASE_HOST:5432/rudder
  • Edit /var/rudder/cfengine-community/inputs/rudder-server-roles.conf and set the following line:

rudder-db:DATABASE_HOST
  • Edit the /etc/rsyslog.d/rudder.conf file and change the hostname in:

:ompgsql:DATABASE_HOST,rudder,rudder,...
  • Run an inventory:

rudder agent inventory
  • Restart rudder services:

systemctl restart rsyslog
systemctl restart rudder-server
  • Clear the cache (in Administration → Settings)

You should now have finished configuring the database server. You can check the technical logs to see if reports are correctly written into the database and read by the web application.


← Server installation options Integration →