Menu

Sessions 3.0.9 Cluster and Load Balancer Installation Guide for Windows

In this article, we'll run you through a sample scenario to install qTest Sessions 3.0.9 on different Windows server machines with a Load Balancer, then connect it to qTest Manager 8.4.4 on another machine.

Before you begin

Before you install qTest Sessions, make sure following things:

  • Your machines need to satisfy qTest's recommended hardware requirements
  • qTest Sessions 3.0.9 only works with qTest Manager 8.4+
  • This instruction is specific for deploying qTest Sessions on Windows Server 2012 environment, if you are installing qTest Sessions with load balancing on other Windows version, consult our customer support

Install qTest Sessions with Load Balancer

Screenshot below demonstrates a sample scenario to deploy qTest Sessions in a load balancing environment:

sessions-load-balancing-windows.png

qTest Manager: an instance of qTest Manager deployed in a Windows server that connects to a PostgreSQL database engine in a same server

  • IPv4 Public IP: 13.113.89.125
  • qTest URL: http://13.113.89.125:8080

qTest Manager DB Server: a PostgreSQL database server that manages qTest Manager database. For the sake of simplicity we will install PostgreSQL database engine in the same Windows machine with qTest Manager

qTest Sessions Server #1: a server that host qTest Sessions application

  • IPv4 Public IP: we will not expose its IP address to the outside world
  • Private IP: 10.0.10.68

qTest Sessions Server #2: another server that hosts qTest Sessions application

  • IPv4 Public IP: we will not expose its IP address to the outside world
  • Private IP: 10.0.10.90

Shared Server: a server that hosts shared components that are required to run qTest Sessions

  • Redis: used as a cache store
  • Elasticsearch: a distributed search and analytics engine
  • PostgreSQL: a database engine used to manage qTest Sessions data
  • NFS (Network File Systems): used to share directories and files with others over a network. We will use NFS to manage and share files created by qTest Sessions applications deployed on the 2 qTest Sessions servers
  • IPv4 Public IP: we will not use the public IP address since this server will not be exposed to the outside world
  • Private IP: 10.0.10.230

qTest Sessions Load Balancer: a server acts as a load balancer for the two qTest Sessions servers. We will install and use nginx on this server for that purpose.

  • IPv4 Public IP: 54.92.55.101. We will expose this IP address to qTest Manager for the two application can connect to each other.
  • Private IP: 10.0.10.180

Installation instructions:

1. Install qTest Manager:

Follow one of below instructions to install qTest Manager on Windows Server:

After installed qTest Manager, note down its IPv4 Public IP address. This is the IP address that qTest Manager and qTest Sessions application will access to it. In our example, qTest Manager IPv4 Public IP address is 13.113.89.125.

2. Setup Shared Server:

Access to the shared server and install following applications and/or packages:

2.1 Install and Configure Redis

2.1.1 Install Redis

qTest Sessions requires Redis version 2.8+ installed. You can click here to download.

After you have downloaded the package, extract it to a folder on your machine. For example: C:\redis-2.8.17.

2.1.2 Configure Redis

In the extracted folder, open file redis.windows.conf. Search and update the following lines:

  1. # maxheap
    Remove the # and specify a max heap size. The size is half the volume of your server RAM. For example, if your server's RAM is 8GB, then:
    maxheap 4G
    
  2. # heapdir
    Remove the # and specify heap directory path. Please make sure the directory's free space should be larger than [Total RAM + 2*maxheap]. For example:
    heapdir "C:\Redis Heap"
    

Open your console. Change the current path to C:\redis-2.8.17. Execute the following command to install Redis as a Windows service:

C:\redis-2.8.17>redis-server --service-install redis.windows.conf --loglevel verbose

2.1.3 Start Redis service

From command console, enter following command to start Redis service:

C:\redis-2.8.17>redis-server --service-start

Important note:

  • By default, Redis runs on port 6379. We will configure firewall for this later.

2.1.4 Verify Redis has been installed successfully on this server

  • Open command prompt and type services.msc to open Services window 
  • On Services window, look for the service named Redis and verify that its Status is Running and its Startup Type is set to Automatic, as shown in below screenshot

redis-service-status.png

2.2 Install and Configure Elasticsearch

2.2.1 Install Elasticsearch

Important note:

  • Elasticsearch 1.7.3 requires Java SDK 1.8 installed and $JAVA_HOME environment variable must be configured properly. Click Installing the JDK Software and Setting JAVA_HOME for the instruction to download, install and configure $JAVA_HOME environment variable

Next, click here to download Elasticsearch. After downloading, extract the downloaded package to a directory on your computer. For example: C:\elasticsearch-1.7.3

From the Console, access to the bin directory (C:\elasticsearch-1.7.3\bin) and run the following command to install the Elasticsearch service:

C:\elasticsearch-1.7.3\bin>service.bat install

2.2.2 Configure Elasticsearch

Open command prompt, type services.msc and press Enter.

On Services window, look for a service named Elasticsearch 1.7.3 (elasticsearch-service-x64). Right click on the service and select Properties

elasticsearch-service-properties.png

From Elasticsearch 1.7.3 (elasticsearch-service-x64) Properties window, set `Startup type` field to Automatic, then click OK button.

elasticsearch-startup-type.png

Important note:

  • By default, Elasticsearch's HTTP and TCP ports are respectively 9200 and 9300. We will configure Firewall for it later.

2.3 Install PostgreSQL 9.5

2.3.1 Download and install PostgreSQL

qTest Sessions requires PostgreSQL 9.5 that you can download it here. After downloading, double click on the downloaded file and follow the installation wizard to install it.

When installation completes, verify that the PostgreSQL service is running by following below steps:

  • Open command prompt and type services.msc to open Services window 
  • On Services window, look for the service named postgresql-x64-9.5 and make sure its Status is Running and its Startup Type is set to Automatic, as shown in below screenshot:

postgresql-service-status.png

2.3.2 Configure PostgreSQL

After installing PostgreSQL, you need to enable remote access to PostgreSQL database server.

Open file C:\Program Files\PostgreSQL\9.5\data\pg_hba.conf. Look for the following line and if it does not exist, append the line to the file.

host all all 0.0.0.0/0 md5
host all all ::1/0 md5

Your C:\Program Files\PostgreSQL\9.5\data\pg_hba.conf now will look like below:

pg-hba-conf.png

Next, open file C:\Program Files\PostgreSQL\9.5\data\postgresql.conf. Look for the following line, and if it does not exit, append it to the file:

listen_addresses = '*'

Save and close the file when you have finished.

2.3.3 Configure PostgreSQL

You need to restart PostgreSQL service for the changes to take effect.

Open command prompt and type services.msc to open Services window 

On Services window, look for the service named postgresql-x64-9.5, right click on it and select Restart in the popup menu. As below screenshot:

pg-restart.png

Important note:

  • By default, PostgreSQL runs on port 5432. We will configure firewall for this later.

2.3.4 Create qTest Sessions database schema 

After PostgreSQL has been successfully installed and configured, you will need to create a database schema for qTest Sessions.

Open the console on your machine. Change the current path to PostgreSQL installation directory:

C:\Users\SampleUser>cd C:\Program Files\PostgreSQL\9.5\bin

Create a database schema using the command below:

createdb -h [YOUR_POSTGRES_SERVER_IP_ADDRESS] -p [YOUR_POSTGRES_SERVER_PORT] -U postgres -W [YOUR_DATABASE_NAME]

For example:

C:\Program Files\PostgreSQL\9.5\bin>createdb -h 10.0.10.230 -p 5432 -U postgres -W sessions //postgres is the username and sessions is the schema name
Password: root // in this example we use `root` as the password of user postgres

Connect to the database:

C:\Program Files\PostgreSQL\9.5\bin>psql -h 10.0.10.230 -U postgres -W sessions
Password for user postgres: root // again, we will use `root` as the password of user postgres
psql (9.5.6)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

List out existing schema to verify sessions database schema has been successfully created, as show below, in bold:

postgres=# \l
                          List of databases
 Name             |  Owner   | Encoding |          Collate           |
 Ctype            |   Access privileges
------------------+----------+----------+----------------------------+----------------------------+-----------------------
 postgres         | postgres | UTF8     | English_United States.1252 | English_United States.1252 |
 template0        | postgres | UTF8     | English_United States.1252 | English_United States.1252 | 
 sessions         | postgres | UTF8     | English_United States.1252 | English_United States.1252 |
(3 rows)

Quit the psql program.

postgres-# \q

2.4 Install and configure NFS

Network File System (NFS) is a Windows component that is used to share files across machine. Follow below instruction to install and setup NFS.

2.4.1 Install NFS

Open Server Manager, navigate to Dashboard then click on Add Roles and Features.

NFS-01.png

Click Next on the 'Before you begin' window.

NFS-02.png

In Select installation type screen, make sure the option 'Role-based or feature-based installation' is selected, then click Next.

NFS-03.png

On Select destination server screen, make sure the option 'Select server from the server pool' is selected, and click Next.

NFS-04.png

From Select server roles screen, locate and expand 'File and Storage Services (2 of 12 installed)' item then expand 'File and iSCSI Services (1 of 11 installed)', then click on the checkbox before the item 'Server for NFS'

NFS-05.01.png

Next, Click on 'Add Features' in the popup.

NFS-05.02.png

The 'Server for NFS' is now checked. Click Next.

NFS-05.03.png

In 'Select features' screen, click Next.

NFS-06.png

In 'Confirmation' screen, click Install.

NFS-07.png

In 'Installation progress' screen, wait for the installation completes then click Close.

NFS-09.png

2.4.2 Create and configure shared folder

Next, we are going to create a folder to store data created by multiple qTest Sessions applications and use NFS to share the folder to the other machines where qTest Sessions installed.

In Fire Explorer, create a folder named "sessions-storage" in C:\ drive. 

Right click on sessions-storage folder and select Properties. On 'sessions-storage Properties' windows, select 'NFS Sharing' tab then click on 'Manage NFS Sharing...' button.

NFS-Sharing-Server-01.png

In the opening NFS Advanced Sharing window, check the checkbox 'Share this folder', then click on Permissions button.

NFS-Sharing-Server-02.png

From NFS Share Permissions screen, do the following:

  • Select 'Read-Write' option in the 'Type of access:' field
  • Check the checkbox 'Allow root access'
  • Click 'OK' button

NFS-Sharing-Server-03.png

Click OK, then Close to complete sharing the folder sessions-storage.

 

Configure Shared Server Firewall

We need to configure Firewall on the Shared Server to enable qTest Sessions to access to the components we just installed. What we are going to do is to open the ports of the following components:

  • Redis: the running port is 6379
  • Elasticsearch: its TCP and HTTP ports are 9200 and 9300
  • PostgreSQL: the running port is 5432
  • NFS: the running port is 2049

Go to Control Panel and open Windows Firewall then click on Advanced settings.

configure-firewall-01.png

On Windows Firewall with Advanced Security window, select Inbound Rules from the left panel, then click on New Rule... in the Inbound Rules from the right panel

configure-firewall-02.png

In New Inbound Rule Wizard screen, select option 'Port' and click Next.

configure-firewall-03.png

In Protocol and Ports screen, do the following:

  • Select TCP option
  • Select Specific local ports option, and enter the port values of Redis, Elasticsearch, PostgreSQL and NFS, separate each value by a comma. For example: 6379, 9200, 9300, 5432, 2049.
  • Click Next when you are done.

configure-firewall-04.png

In Action screen, make sure the option Allow the connection is selected, then click Next.

configure-firewall-05.png

In the Profile screen, make sure all the options for Domain, Private and Public are checked, then click Next.

configure-firewall-06.png

In Name screen, enter a name for your new rule, e.g. 'Shared Ports for qTest Sessions', then click Finish.

configure-firewall-07.png

You have finished setting up the Shared Server.

You need to restart the server for the changes and configurations to take effect, then move on to the next step.

3. Install qTest Sessions in a separated server:

First, login to a Windows Server where you are going to install qTest Sessions.

3.1 Install NFS client

Before install qTest Sessions, we need to install NFS client then use it to mount the shared folder 'sessions-storage' that we have set up in Shared Server to a local drive. The local drive will be used to configure qTest Sessions when we install it.

Follow these steps to install NFS client.

First, open Server Manager, navigate to Dashboard then click on Add Roles and Features.

NFS-01.png

Click Next on the 'Before you begin' window.

NFS-02.png

In Select installation type screen, make sure the option 'Role-based or feature-based installation' is selected, then click Next.

NFS-03.png

On Select destination server screen, make sure the option 'Select server from the server pool' is selected, and click Next.

NFS-04-Client.png

In Select server roles screen, click Next.

NFS-05-Client.png

In Select features screen, select 'Client for NFS', then click Next.

NFS-Client-Select-Features.png

In Confirm installation selections, click Install.

NFS-Client-Install.png

In Installation progress screen, wait for the installation to complete, and click Close.

NFS-Client-Complete.png

3.2 Automatically mount shared folder on Shared Server at system startups

Next step is to automatically mount the shared folder in Shared Server to a local drive when server starts up.

3.2.1 First, create a batch file and put it at C:\mount.bat. Open the file in a text editor and enter following command that mount the sessions-storage folder in the shared server, whose IP address is 10.0.10.230, we set up in step #2 to a local drive name S::

mount -o fileaccess=777 10.0.10.230:/sessions-storage S:

Save and close the file when you have finished.

3.2.2 Next we will create a task from Task Scheduler that will execute our batch file at system start up.

Open Task Scheduler application and click on Create Basic Task in the right panel.

Mount-01.png

In Create a Basic Task screen, enter a name for our task, e.g. "Mount shared storage to S drive", then click Next.

Mount-02.png

In Task Trigger screen, select option 'When the computer starts', then click Next.

Mount-03.png

In Action screen, select the option Start a program and click Next.

Mount-04.png

In Start a Program screen, enter 'C:\mount.bat' to Program/script field then click Next.

Mount-05.png

In Summary screen, click Finish.

Mount-06.png

Next, we will edit the task properties.

From Task Scheduler, select Task Scheduler Library folder in the left panel.

Look for our newly created task in the middle panel. When you found it, right click on it and select 'Properties' in the popup menu.

Mount-07.png

In the Properties window, perform following actions:

  • Check the checkbox 'Run with highest privileges'
  • Click on 'Change User or Group...'

Mount-08.png

In Select User or Group window, do the following:

  • Enter 'system' to the field Enter the object to select
  • Click on Check Names button
  • Click OK button

Mount-09.png

The property window now will look like below. Click OK to finish setting up the task property.

Mount-10.png

3.3 Restart Server

We need to restart the server for the changes to take effect, then move on with next step.

3.4 Install qTest Sessions

After installing Client for NFS feature and schedule a task to mount the shared folder on Shared Server when system starts up. We are now ready to install qTest Sessions.

Click download qTest Sessions 3.0.9. Once download is completed, double click on the downloaded installer to start the installation 

Install_Sessions_-_Step_01.png

Click the Next button to review our EULA document before proceeding.

Install_Sessions_-_Step_02.png

Select the option "I accept the terms in the License Agreement." Then click the Next button to move on to the next page, in which you will be given 2 options to perform the installation:

  • Express install: This will allow you to install with default installation directory and Start menu folder
  • Custom install: This will allow you to manually select the installation directory and Start menu folder

Install_Sessions_-_Step_03.png

 

Select the Express install option, then click on Next to review the default installation settings as illustrated below.


Install_Sessions_-_Step_04.png

Once you accept with the default settings (or enter custom settings), click on the Install button to let the installer start extracting files into the installation directory.

Install_Sessions_-_Step_05.png

After the files are extracted, you will be allowed to specify web server ports for qTest Sessions

Select the 'Use custom ports' and input these values:

  • HTTP Port: 9090
  • Admin Port: 9005
  • AJP Port: 9009
  • HTTPS Port: 9443

SessionsNode-01.png

IMPORTANT:

  • Make sure the ports you selected above are not blocked by your firewall
  • When specifying the port numbers, make sure the selected ports are all available and there are no other applications running on them. Follow this Check network ports to check your network ports

 

In the next screen, you will have an option to enable a secured connection (HTTPS) between users’ browsers and qTest Session servers. For the sake of simplicity, we will not enable secured connection, so click Next to continue.

SessionsNode-02.png

You are then required to configure the connection to your PostgreSQL database. Enter the information of PostgreSQL running on our Shared Server and click Next:

  • Hostname: 10.0.10.230
  • Port: 5432
  • Password: root
  • Database: sessions

SessionsNode-03.png

Next, specify the hostname and port number to connect to Redis server. Again, we will enter the information of Redis server running on Shared Server, as below:

  • Hostname: 10.0.10.230
  • Port: 6379

SessionsNode-04.png 

Next step is to specify the information of your Elasticsearch server. We will enter information of Elasticsearch server running on Shared Server, then click Next

  • Cluster name: elasticsearch
  • Host name: 10.0.10.230
  • HTTP Port: 9200
  • TCP Port: 9300

SessionsNode-05.png

We will then need to specify a location to store session data. We will enter S:, which is the local drive that is mounted to the sessions-storage folder in the Shared Server we have done earlier, then click Next.

SessionsNode-06.png 

In the next step, we will specify the qTest URL and qTest Master Token to connect to your qTest Manager instance. Enter below information then click Next to continue:

  • qTest URL: http://13.113.89.125:8080
    • Note: the IP Address is the Public IP Address of our pre-installed qTest Manager. In our example, it is 13.113.89.125 and qTest Manager is running on port 8080
  • Master Token: go to Get qTest Master Token for instructions to get your qTest Master Token
  • IMPORTANT: qTest Manager must be running

SessionsNode-07.png

After you have input all required information and click on Next button, the wizard starts configuring qTest Sessions services 

SessionsNode-08.png

After this process is done, you will be directed to the final information screen, where you can review all the installed components and their settings.

SessionsNode-09.png

Click Finish to exit the installation wizard.

4. Install 2nd instance of qTest Sessions in yet another Windows Server:

Repeat step #3 to install qTest Sessions on another server.

5. Setup a load balancer to load balance qTest Sessions

Now we have installed the two instances of qTest Sessions on two separate Windows servers with the following Private IP addresses:

  • qTest Sessions Server #1: 10.0.10.68
  • qTest Sessions Server #2: 10.0.10.90

It's time to load balance it.

We will need another Windows Server to install a load balancing software. In our example, we will install and configure nginx it to load balance the two qTest Sessions applications on a Windows server whose public IP address is 54.92.55.101.

Note: in this example, we use nginx to load balance qTest Sessions applications deployed on two Windows servers. However, you could absolutely install your preferred load balancing software and follow the instructions of the software vendor to install and configure it to meet your need.

5.1 Download nginx

Access to the Windows server where we will install nginx

Download nginx 1.13.0 here.

Extract the downloaded nginx packaged it to C:\nginx-1.13.0

5.2 Configure nginx

Open nginx configuration file at C:\nginx-1.13.0\conf\nginx.conf and edit the file as below (notice the highlighted configuration in bold).

Notes: it is highly recommended that you copy and paste all of below content to your nginx.conf file:


#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

upstream sessions_servers {
server 10.0.10.68:9090;
server 10.0.10.90:9090;
}

server {
listen 80;
server_name localhost;

#charset koi8-r;
#access_log logs/host.access.log main;

location / {
proxy_pass http://sessions_servers;
proxy_redirect http://$http_host $scheme://$http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
}

5.2 Make nginx start at Windows starts up

5.1 Create a batch file that, when executed, will start nginx.

Go to folder C:\nginx-1.13.0\ and create a file named startup.bat, then enter following information to the file:

start nginx.exe

Save and close the file.

Open Task Scheduler and click on Create Basic Task in the right panel

nginx-startup-task-scheduler-01.png

In Create Basic Task screen, enter 'Start nginx' to the Name field then click Next.

nginx-startup-task-scheduler-02.png

In Task Trigger screen, select option 'When the computer starts', then click Next.

nginx-startup-task-scheduler-03.png

In Action screen, select the option 'Start a program', then click Next.

nginx-startup-task-scheduler-04.png

In Start a Program screen, enter the following to the relevant fields, then click Next:

  • Program/script: C:\nginx-1.13.0\startup.bat
  • Start in (optional): C:\nginx-1.13.0

nginx-startup-task-scheduler-05.png

In the Summary screen, click Finish.

nginx-startup-task-scheduler-06.png

You will be back to Task Scheduler screen.

Select Task Scheduler Library item in the left panel, locate the task we just created with the name 'Start nginx' in the middle panel, right click on it and select Properties in the popup menu.

nginx-startup-task-scheduler-07.png

From the Properties window, click on Change User or Group...

nginx-startup-task-scheduler-08.png

In Select User or Group window:

  • Enter system to the 'Enter the object name to select' field
  • Click Check Names button
  • Click OK

nginx-startup-task-scheduler-09.png

You will get back to the Properties window.

Now check the check box 'Run with highest privileges' then click OK.

nginx-startup-task-scheduler-10.png

You have finished setting up the load balancer with nginx and configuration for it to load balance the two qTest Sessions instance.

Now, restart the server make sure it is up and running before proceeding to the next step.

6. Configure qTest Manager to connect to qTest Sessions via the load balancer

6.1 Login to your qTest Manager application at URL http://13.113.89.125:8080 with a Site Administrator account

6.2 Go to the Site Administration page and click on the tab SYSTEM CONFIGURATIONS

6.3 In the QTEST EXPLORER | SESSIONS section, input the URL with the Public IP address of your qTest Sessions Load Balancer: http://54.95.55.101

 

configure-qtest-sessions-url.png

6.4 Click on Save button.

6.5 From qTest Manager's top navigation, access to qTest Sessions

access-to-sessions-from-qtest.png

 

You will notice that qTest Manager now can access to qTest Sessions applications via the load balancer, as below screenshot.

sessions-lb.png

 

In qTest Sessions home page, click + Session button to create a new Session


test-create-session-01.png

 

In Create Session page, enter Session's Title and click Save & Close


test-create-session-02.png

Verify that the Session you have recently saved appears in the home page.

test-create-session-03.png

 

That's it. You have successfully installed load balanced qTest Sessions on Windows environment.

Subscribe To Our Blog
Powered by Zendesk