Skip to main content

Load balanced environment

Basic load balancer architecture is show as below:

For a load balanced environment, Redis is a mandatory component as it is used for session and cache management.

The prerequisites for the web server are the same, except for the need of a NFS (shared file system).

You can have any number of web servers.

Install all the prerequisites on to all the web servers and then set up a NFS shared directory /var/www/jadu between all the web servers.

It is good practice to have the database and Redis separated from the web server. The database and Redis can either be on the same server or separated.

Installation

The process is similar to the installation of Jadu on a single server, except for a few extra steps.

Run prerequisites check on node 1

  1. Download the installer from Jadu
  2. Upload the TLS file into the server
  3. Create params.yml from params.yml-LINUX and populate the values
  4. Run the prerequisites check command
$ php installer.phar check:setup

Install the application on node 1

You will be running the install command only on main node.

$ php installer.phar install

Run prerequisites check on other nodes

  1. Download the installer from Jadu into all web servers
  2. Create params.yml from params.yml-LINUX and populate the values, you can exclude tls file configuration here
$ php installer.phar check:setup --application-only
note

Try to make sure all the check passes. If you have not configured root access to the database from all the nodes, then your check will fail saying root connection details invalid. In this case you can ignore this one error and continue configuring the node. It is mandatory to have root user access on the main server you are installing and on other nodes it's ok to restrict the access.

Configure apache and php-fpm in other nodes

After the installation on the main server, on the other web servers you must update the apache configuration and php-fpm configuration.

Create a file jadu.conf in /etc/httpd/conf.d directory and paste the following

#
<IfVersion >= 2.4>
IncludeOptional JADU_HOME/config/apache/vhost*.conf
</IfVersion>

<IfVersion < 2.4>
Include JADU_HOME/config/apache/vhost*.conf
</IfVersion>

Create a file jadu.conf in /etc/php-fpm.d directory and paste the following

;
;First include global settings
include = JADU_HOME/config/php-fpm/global.d/*.conf

;Then jadu application pools
include = JADU_HOME/config/php-fpm/*.conf

Setting up application cache and session

Edit the file 34-sessions.conf in config/php-fpm/conf.d/ to include the configuration below:

php_value[session.save_handler] = redis
php_value[session.save_path] = tcp://{redist-host}:{redis-port}

Once the changes are made restart php-fpm

$ service php-fpm restart

To set the application to use Redis, update the node cache_data_store in config/system.xml to use Redis instead of "file":

<cache_data_store>redis</cache_data_store>

In config/datastore.xml, update the connection details in the server node of the redis block:

<?xml version="1.0" encoding="utf-8" ?>
<datastore xmlns:config="http://www.jadu.co.uk/schema/config">
<redis>
<servers>
<server host="1.2.3.4" port="6379"/>
</servers>
</redis>
</datastore>