Running a WordPress Cluster with Jelastic

By | September 24, 2013

It’s no secret that WordPress is one of the most widely used CMSs in the world. This software can be used to create a website or blog and it’s absolutely free. High profile American government organizations such as the CIA, the FBI and the Airforce are using WordPress. In addition, famous companies such as CNN, Forbes, The New York Times and eBay also use WordPress for their websites.

No company wants to lose a customer when their services are unavailable, especially since that downtime can cost them money. Clustering technology has been used for many years, but has only recently started to become globally pervasive. Today, we’ll show you how to run your WordPress cluster in a highly-available environment, to increase performance, reliability and scalability.

We will use a Memcached node, two Apache servers, an NGINX load balancer and two replicated MySQL databases. In this case if one Apache server fails, the sessions are stored for backup on the Memcached node. The other server can fetch the sessions from Memcached and then proceed serving the session. An NGINX load balancer distributes the traffic across the cluster. The MySQL master-slave replication mechanism improves the performance, the data security and the fail-over capabilities.

WordPress Cluster

Let’s get started!

Deploy WordPress

1. Log in with your Jelastic credentials.

2. While in the Jelastic dashboard, click the Create environment button.

3. In the Environment Topology window, select Apache application server and memcached. Specify the resource limits for both nodes. After that enter your environment name and confirm the environment creation.

WordPress Cluster Environment

Wait momentarily until your environment is successfully created.

WordPress Cluster

4. Upload the WordPress .zip package to the Deployment manager (you can easily download it from the official WordPress web site).

Upload WordPress

5. Deploy it to your environment.

WordPress Deployment

Configure session storage

1. Click the Config button for Apache, navigate to etc > php.ini and activate PHP Memcached module by adding the following line:

Activate Memcached Module

2. Enable sessions support by editing the Session block of php.ini file:

session.save_handler = memcached
session.save_path = "< server >:11211"

Enable Memcached Sessions Support

Note: < server > is the Memcached IP or URL which can be found by clicking Info button for the Memcached.

3. Save the changes and restart Apache in order to apply new settings.

Configure database

1. Use the “Database Master-Slave Replication in the Cloud” tutorial to get a MySQL cluster configured in just a few minutes.

2. After you’ve set up the replication, create a new database in the master base. Let’s name it wordpress.

WordPress Cluster Database

Install WordPress

1. Go back to the Jelastic dashboard and open WordPress in a browser.

2. The installation steps are very simple. Let’s review database connection settings only. Fill in the required fields in the following way:

  • Database name > type your database name (wordpress in our case)
  • Database username > type the username (root by default)
  • Database password > type your password (which you received via email)
  • Database host > insert the link to your master database (without “http:// ” and “/”)

WordPress Database Connection

Configure cluster

1. After WordPress has been successfully installed, navigate to the Jelastic dashboard and click the Change environment topology button.

WordPress Change Topology

2. Add one more application server and click Apply.

WordPress Cluster Configuration

Note: We added the second server node only after installation, in order to synchronize all of the data between the two Apache instances and to avoid a double installation.


WordPress Site

That’s all you have to do to get a highly-available WordPress cluster in the cloud. Do you have a different experience with WP clustering? Please share it with us in the comments below.

Related articles:

Subscribe to get the latest updates