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:
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\""
cp /opt/rudder/etc/postgresql/reportsSchema.sql /opt/rudder/etc/postgresql/reportsSchema-alternate.sql
ALTER database rudder SET standard_conforming_strings=true; To: ALTER database alternate_base_name SET standard_conforming_strings=true;
su - postgres -c "psql -q -U alternate_user_name -h localhost -d alternate_base_name \ -f /opt/rudder/etc/postgresql/reportsSchema-alternate.sql"
|
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:
|
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 →