How to setup High Availability PrestaShop on multiple servers with MariaDB Galera Cluster

November 7, 2014 By Severalnines

PrestaShop is a popular open source e-commerce software powering over 200,000 online stores, according to the company. We’ve seen a bit of interest into high availability PrestaShop setups, so this post will show you how to achieve that on multiple servers. Note that this setup not only caters for failures, but by load balancing traffic across multiple servers, it also allows the system to scale and handle more users.

This post is similar to our previous posts on web application scalability and high availability:

 

We will focus on migrating Prestashop 1.6 from standalone server installation to three separate servers with MariaDB Galera Cluster and GFS2 (Global File System) running on CentOS 6.5 64 bit. We will use a server for shared storage and ClusterControl. Please review the above posts if you’d like to use a different clustered file system or MySQL Galera vendor. 

 

The following diagram illustrates our setup:

 

Our setup consists of 6 servers or nodes:

  • prestashop1: web server + database server
  • prestashop2: web server + database server
  • prestashop3: web server + database server
  • lb1: load balancer (master) + keepalived
  • lb2: load balancer (backup) + keepalived
  • storage1: shared storage + ClusterControl

 

Our major steps would be:

  1. Prepare 6 hosts
  2. Deploy MariaDB Galera Cluster onto prestashop1, prestashop2 and prestashop3 from storage1
  3. Configure iSCSI target on storage1
  4. Configure GFS2 and mount the shared disk onto prestashop1, prestashop2 and prestashop3
  5. Configure Apache on prestashop1, prestashop2 and prestashop3
  6. Configure Keepalived and HAProxy for web and database load balancing with auto failover
  7. Install Prestashop and connect it to the Web/DB cluster via the load balancer

 

Preparing Hosts

 

Add following hosts definition in /etc/hosts:

192.168.50.100             virtual-ip prestashop
192.168.50.101          prestashop1 web1 maria1
192.168.50.102          prestashop2 web2 maria2
192.168.50.103          prestashop3 web3 maria3
192.168.50.111          lb1
192.168.50.112          lb2
192.168.50.120          storage1 clustercontrol

 

read more