Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. READ MORE

How to configure Qlik Sense to use a dedicated PostgreSQL database

100% helpful (1/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
Sebastian_Linser

How to configure Qlik Sense to use a dedicated PostgreSQL database

Last Update:

Feb 8, 2024 7:58:47 AM

Updated By:

Sonja_Bauernfeind

Created date:

Mar 16, 2021 10:33:39 AM

This article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

The Qlik Sense Repository Database (QSR) can be moved to a dedicated standalone PostgreSQL instance not hosted on the same machine as other Qlik Sense Services. It is also possible to move an already existing QSR from a local Sense install, to a dedicated PostgresSQL database.

Content:

 

Set up a postgresSQL database

Instructions for this might vary slightly. Please refer to the Qlik Online Help for details.  We recommend watching this video.

Qlik Sense Enterprise server has a set of five databases. For more details visit Installing and configuring PostgreSQL on help.qlik.com.

1. The Qlik Sense repository database (QSR):

The QSR is the primary database in your Qlik Sense deployment.

2. The Qlik Sense services database (SenseServices):

The SenseServices database contains schemas for each of the Qlik Sense services and allows growth independently of the Qlik Sense Repository Database, while still sharing the same PostgreSQL instance and login role.

3. The Qlik Sense message queue database (QSMQ):

The QSMQ database provides a light-weight method of passing messages internally between services in Qlik Sense Enterprise. The NOTIFY and LISTEN functionality in PostgreSQL allows services to be notified about new messages that have been written to the messaging table.

4. The Qlik Sense logging database (QLogs): No longer supported after May 2021

The QLogs database centralizes logging by collecting log messages from all Qlik Sense nodes in your deployment and stores them in a PostgreSQL database.

5. The Qlik Sense license service database (Licenses):

The Licenses database is used to sync the assignments between the Qlik license backend and the local installation.


 

Simplified checklist of steps:

  1. Download a valid version of postgresSQL.  For Sense June 2017 and up, 9.6.x is required, from November 2019 version 11.5.x as well. From May 2021 version 12.5 can be used. Review the system requirements of your version before proceeding.
  2. Install based on instructions found on the Qlik Online Help for Qlik Sense; select the version you are running on then select from Menu , Deploy - Qlik Sense installation - Installing and configuring PostgreSQL.

 

Moving the Qlik Sense Share Folders as well?

Follow How to change the shared path in Qlik Sense 

Backup 

Depending on the version, you need to backup different databases, on the current Qlik Sense central node hosting the Qlik Sense Repository Database service, follow the backup instructions to obtain a database copy of each Qlik Sense Database Present . 
   Example for February 2021  you need to backup the databases reported in section "Installing and configuring PostgreSQL"; referring to the Help site these are : 
    QSR , QSMQ , SenseServices , Licenses , if configured QLogs    

Restore

On the dedicated remote postgresSQL host, perform a restore   of the backed up Databases of previous point. 

Changing the Connection String to QSR and QSMQ Database 

  1. On the Qlik Sense central node, all services but the Qlik Sense Repository Service are shut down.
  2. Open QlikSenseUtil. By default, this will be installed in: C:\Program Files\Qlik\Sense\Repository\Util\QlikSenseUtil\QlikSenseUtil.exe
  3. Open the Connection String Editor and Read the current configuration, decrypting the current data.

    Sebastian_Linser_0-1615898800179.png
  4. Replace all mentions of the current database hostname.  In our example, the new database resides on 172.16.16.103. Instead of an IP you can also use the FQDN of the db server.
  5. You need to repeat this step for the   sections <add name="QSMQ" and <add name="postgres"
  6. Hit Save Value in config file encrypted, committing any changes. 

 

Sebastian_Linser_1-1615898853355.png

 

Changing the Connection String to SenseServices Databases. 

       Execute steps in Moved Postgress database to new host, but some qliksense is still accessing the SenseServices old da...; check if different version of article are present for different Qlik Sense version .

Changing the Connection String to Licenses Database ( April 2019 and up ) 

Starting from April 2019 new License Service implementation is using this database.

  1.   Open an elevated Powershell and change directory to C:\Program Files\Qlik\Sense\Licenses
  2.    Run the script .\Configure-Service.ps1 and provide:
    • new Hostname or IP  
    • database port default is 4432
    • database user qliksenserepository
    • databasepassword is the qliksenserepository password  used during configuration of  the new database.
  3. example: 
  4. cd  'C:\Program Files\Qlik\Sense\Licenses'
  5. .\Configure-Service.ps1 172.16.16.102 4432 qliksenserepository Password123!

It will look like this:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> cd \
PS C:\> cd  'C:\Program Files\Qlik\Sense\Licenses'
PS C:\Program Files\Qlik\Sense\Licenses> .\Configure-Service.ps1 172.16.16.102 4432 qliksenserepository Password123!
Licenses configuration started.
WARNING: Skipping the database initialization. No superuser or password specified.
Reading the settings file.
Saving the modified settings.
Licenses configuration successful.
PS C:\Program Files\Qlik\Sense\Licenses>


repeat this for:

C:\Program Files\Qlik\Sense\NotifierService\install\Configure-Service.ps1
C:\Program Files\Qlik\Sense\AppDistributionService\Configure-Service.ps1
C:\Program Files\Qlik\Sense\HybridDeploymentService\Configure-Service.ps1
C:\Program Files\Qlik\Sense\MobilityRegistrarService\install\Configure-Service.ps1
C:\Program Files\Qlik\Sense\PrecedentsService\install\Configure-Service.ps1
C:\Program Files\Qlik\Sense\NLAppSearch\install\Configure-Service.ps1

there might come new services or disappear with new releases, please check in the C:\Program Files\Qlik\Sense\ folder for "Configure-Service.ps1" to find additional one in your version of Qlik Sense.

 

Note: If you have installed Qlik Sense in a different directory the Configure-Service.ps1 would have to be updated as in this example:

File: Configure-Service.ps1 Folders: Various (9 microservices)
Before:
11 | [string] $senseInstallPath
"$env:ProgramFiles\Qlik Sense",
After:
11
[string] $senseInstallPath = "D:\Qlik",

Remove Database Service dependency and Postgres Server

After successfully verifying your new setup, remove the Qlik Sense Repository service dependencies and the old Postgres database. This is done to avoid issues with future Upgrade of Environment. 

  1. In an elevated command prompt, execute the following on prompt:

    c:\sc config "QlikSenseRepositoryService" depend= ""
    c:\sc config "QlikLoggingService" depend= ""

    This will return: 

    [SC] ChangeServiceConfig SUCCESS

  2. Restart the Qlik Sense Repository Service.

    Check that Qlik Sense Repository Database doesn't start (confirms [SC] ChangeServiceConfig SUCCESS ).

  3. Remove the (local) Qlik Sense Repository Database

    Find the most recent PostgreSQL.msi in C:\ProgramData\Package Cache\  and remove it. This removes the service but no old local database data. This is needed to prevent issues on future upgrades of Environment.

    You can find the precise folder with this command depending on the Postgresql Version you used installing the inital release.

    9.6:

    c:\cd ProgramData\Package Cache
    c:\ProgramData\Package Cache\dir /s PostgreSQL.msi

    The folder containing PostgreSQL.msi will be revealed. Right click on the PostgreSQL.msi file and select uninstall from the menu.

    12.5:

    c:\cd ProgramData\Package Cache
    c:\ProgramData\Package Cache\dir /s PostgreSQL125.msi

    The folder containing PostgreSQL.msi will be revealed. Right click on the PostgreSQL.msi file and select uninstall from the menu.

    

Finalize

  1. Restart the Qlik Sense Repository Service and verify that Qlik Sense Repository Database Service doesn't exist when followed the previous steps.
  2. Start all remaining Sense Services 
  3. Progress on the startup sequence (including the connection to the new database) can be tracked in the _System_Repository log files located in C:\ProgramData\Qlik\Sense\Log\Repository\Trace
  4. Verify functionality.
  5. In Multi-node scenario you need to repeat steps "Changing the Connection Strings to Databases" on all Rim nodes (QlikSenseUtil for Repository.exe.config and Configure-Service.ps1 for the micro services), and if required configure "Update the Qlik Logging Service Connection String" (note that is EOL with Qlik Sense Enterprise on Windows February 2022) .   

 

Environment

Qlik Sense Enterprise on Windows 

Labels (1)
Comments
adamb14
Contributor
Contributor

Hi,

While doing this can you also go from a Different PostgreSQL DB version to another? (e.g. 9.6 to 14.8)

Thanks.

 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @adamb14 

I assume you intend to set up a new standalone database on a higher version (so, 14.8) and then restore the 9.6 database from your previous bundled PostgreSQL?

That is usually how PostgreSQL upgrades are done between major versions (install a new major version, restore the previous one), so the answer would be yes. If, however, you are also upgrading Qlik Sense at the same time we recommend staggering the procedure: Move to an identical version of PostgreSQL first, then upgrade Qlik Sense, then upgrade the database, taking the appropriate backups along the way.

You may also want to look into the Qlik PostgreSQL installer, which not only unbundles Qlik Sense from the PostgreSQL database but can also install a standalone DB. General "upgrade standalone PostgreSQL" instructions that go hand in hand with Qlik can be found here: Qlik Sense Enterprise on Windows: How To Upgrade Standalone PostgreSQL.

All the best,
Sonja 

Luck
Partner - Contributor II
Partner - Contributor II

Hi,

Is this article still valid if I would like to just change port of the dedicated postgresql?
(example from port 4432 to 4433)

 

Regards,

Lucky

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @Luck 

The article is still accurate,  yes. And you can change the port of your standalone PostgreSQL environment. If you have more detailed questions on how to achieve this, please post your question in the Qlik Sense Management and Deployment board. 

All the best,
Sonja 

TusharDev_Qlik
Creator II
Creator II

@Sebastian_Linser @Sonja_Bauernfeind 

Remove Database Service dependency and Postgres Server

Can this step be performed post successful verification to change existing local install PostgreSQL database to dedicated server. This will help to rollback to previous setup in case we face any issues post implementation.

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @TusharDev_Qlik 

I can confirm that this step should be performed after you have successfully verified your setup. Will clarify this in the text above, thank you for getting in touch!

All the best,
Sonja 

 

TusharDev_Qlik
Creator II
Creator II

@Sonja_Bauernfeind Thank you for your prompt response.

Could you please include details rollback steps(how to restore databases configurations to the previous version) in the above document which will complete the entire process.

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @TusharDev_Qlik 

A "rollback" by itself does not exist for this process. To move back to a bundled PostgreSQL instance, Qlik Sense Enterprise on Windows would need to be uninstalled and reinstalled on the identical Sense version and the database restored.

All the best,
Sonja 

TusharDev_Qlik
Creator II
Creator II

@Sonja_Bauernfeind By rollback I mean if we repoint all databases to Localhost again before uninstalling PostgreSQL  from Central, the system will be restored to the previous setup automatically isn't it?

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @TusharDev_Qlik 

If you walk back all settings previously done, and have not yet uninstalled the bundled PostgreSQL database, then, yes, this will restore you back to the original setup. This will require a complete walking back of the steps though and it is not a method we recommend.

Uninstalling, re-installing, and storing the database is our recommended method.

All the best,
Sonja 

Version history
Last update:
‎2024-02-08 07:58 AM
Updated by: